Heed help: Calling sys_getcwd to resolve relative pathnames from within systemtap

Sebastian Pipping sebastian@pipping.org
Thu Sep 29 00:31:00 GMT 2011


Hello!


Simplified, I have a probe printing filenames as files are opened:

   probe syscall.open.return {
     filename = user_string($filename)
     printf("OPEN %s\n", filename)
   }

Now the problem is: filename can be relative.
To make it absolute I would like to call sys_getcwd to get the current
working directory of the process that just opened that file so I can
prepend it to filename to make an absolute path.

However, I fail to call sys_getcwd, even from pure blocks like

   %{ /* pure */ /* unprivileged */
     [..]
   %}

Can you help me with calling sys_getcwd or point me to other ways of
making a pathname absolute from within systemtap?  I doubt I'm the first
to wonder about this but I find no documentation on this.

Thanks in advance,



Sebastian Pipping



More information about the Systemtap mailing list