[dtrace-discuss] How to get from file descriptor to file name

MC egapcr at gmail.com
Tue Feb 13 18:50:40 PST 2007


I am enabling the syscall::write:entry probe on a running process.  Within
dtrace, I have easy access to the file descriptor.  I can also easily
cross-reference this using pfiles to determine the filename.  I am
interested in doing this from within dtrace.  I started with curpsinfo and
from there I was going to access the user struct and follow the trail to the
vnode where I expected I would find the goods I am interested in.  Once I
include <sys/proc.h> I get error messages related to <sys/kstat.h>.

I suspect that there is an easier way.  I'm new to this, so I'll appreciate
whatever pointer you can give me.

This is somewhat of a pointless exercise, as I have what I need, but I'm
using this as an opportunity to learn.  What is the dtrace way?

Given that i didn't have enabled probes when the file was opened, and I'm in
the action clause with a file descriptor, how do I get the name of the file?

Thanks,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070213/95feeb71/attachment.html


More information about the dtrace-discuss mailing list