I would like to find out how can I trace (show) file access on Solaris.
I already found the dtrace toolkit in a hope that voptrace
will fit the bill. I ran it with voptrace -t /my/path
if I ls
or cat
files under that path it produces no output. Am I looking at the wrong tool? Can someone suggest another one to find a solution?
UPDATE
@bahamat
Okay, it was giving error messages like this:
dtrace: error on enabled probe ID 3 (ID 126: syscall::openat:entry): invalid address (0xffd19652) in predicate at DIF offset 28
After redirecting stderr it seems it actually gives quite close to what I want.
Brendan Gregg has a number of good
dtrace
one liners on his site. Among them, this one liner to watch files opened by process:Expanding that, you can watch a particular file being opened by adding a predicate:
Yielding the following output:
ls
is slightly different, in thatls file
doesn't openfile
. It usesstat
instead (specifically,lstat64
) so the probe would besyscall::*stat*:entry
.Note that
dtrace
implementations vary. The commands above were run on illumos. YMMV.