This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Get filename from fd
- From: Andi Kleen <andi at firstfloor dot org>
- To: "Rob Donovan" <rob at proivrc dot com>
- Cc: <systemtap at sourceware dot org>
- Date: Tue, 07 Sep 2010 11:50:16 +0200
- Subject: Re: Get filename from fd
- References: <031b01cb4e70$520dc950$f6295bf0$@com>
"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.