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]

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


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


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