RFC: path display and path filtering features.

Roland McGrath roland at redhat.com
Fri Feb 18 23:16:36 UTC 2011


> Is /proc/$pid/cwd less reliable than /proc/$pid/fd/$fd?

No, they all use the same mechanism.  What those report are from the
perspective of the readlink caller, i.e. strace's view of the filesystem
rather than the tracee's.  (I'm not entirely sure how that interacts
with per-process mount points, but I think it's all uniformly from
strace's perspective.)  So when those perspectives differ, the view
strace sees can be different than what the file names in the tracee's
own syscalls mean.  You want to keep that in mind when doing any kind of
massaging on names.  

I guess if the only thing you do is append a relative name from a
syscall argument to strace's view of the tracee's cwd or fd, then it
can't get too weird.  But it's not really clear when giving a file name
for matching purposes whether the user will want that to mean the file
name as it appears in the tracee's calls or the file name that the user
of strace would use to access that same file.  If you wanted to be
entirely consistent about it, then you'd have to check the tracee's
/proc/$pid/root and, if it's not just "/", prepend that to the absolute
file names in tracee calls too.


Thanks,
Roland




More information about the Strace-devel mailing list