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: Improvement to disktop.stp: how to find the full file name?


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


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