This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Get filename from fd


"Rob Donovan" <rob@proivrc.com> writes:


> Is it possible to get from $fd to a filename in some way, in probes like
> syscall.fcntl  etc?
>
> I know I can probe syscall.open() and then keep an array of FD / filenames,
> but this doesn't help me when I need to trace a process that has already
> been started some time ago, and already has opened files.

There's a undocumented internal utility function for this in vfs.stp:
__file_filename()

I agree it would make sense to export it. I have been using it too.

The usual caveats with multiple name spaces apply. Also it does
not necessarily give anything useful with sockets and pipes.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]