This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Improvement to disktop.stp: how to find the full file name?
- From: Mark Wielaard <mjw at redhat dot com>
- To: laurent at guerby dot net
- Cc: systemtap at sourceware dot org
- Date: Mon, 06 Sep 2010 15:19:07 +0200
- Subject: Re: Improvement to disktop.stp: how to find the full file name?
- References: <928bc4d6fc6161210370b297fc9948b3@localhost>
On Sun, 2010-09-05 at 17:23 +0200, laurent@guerby.net wrote:
> I'd like to add disltop.stp the capability to print which file are
> being read/written by each process. It's quite easy to get the filename
> by using the provided __file_pathname function (eg: "kern.log"), but
> I'm unable to figure out how to find the full pathname (eg:
> "/var/log/kern.log"). Any idea on how to do that?
dentry.stp provides a function reverse_path_walk() that mostly seems to
do what you want. It takes a dentry, which you could get as follows:
$ stap -e 'probe vfs.read { if (file != 0 && devname != "N/A")
{ dentry = @cast(file, "file")->f_path->dentry;
log(execname() . " " . devname . ":"
. reverse_path_walk(dentry)); } }'
Don't know if there is an easy way to map the dev/devname to the mount
point to complete the full path name.
Cheers,
Mark