RFC: path display and path filtering features.
Dmitry V. Levin
ldv at altlinux.org
Tue Feb 15 22:12:50 UTC 2011
On Mon, Feb 14, 2011 at 02:44:29PM -0600, Grant Edwards wrote:
> Attached is a patch against 4.5.20 that adds two new command line
> options:
>
> -y Attempt to display paths associated with file descriptor
> arguments.
This feature looks promising, I'd like to have it implemented in strace.
I'm not sure about option name; at least, the link between -y and its
effect is not obvious to me.
> -P <pathlist>
>
> Display only system calls accessing one of the paths in the
> specified colon-separated path list.
I think colon-separated path list is not quite convenient; from user point
of view, I'd prefer to specify one path per option, like -p.
> The features above depend on added code that attempts to track the
> state of the traced process's fd table based on the observed
> open/close/dup/clone system calls. Another approach would be to do a
> readlink() on /proc/<pid>/fd/<fd> every time we handle a system call
> with a file descriptor argument. I decided against the readlink()
> approach in order to avoid the additional overhead and to provide a
> workable solution on systems that don't have /proc/<pid>/fd links
> available.
The approach to track descriptors is much more complicated (and therefore
more error-prone) and less reliable than readlink-based because of all
details that have to be taken into account to trace descriptors properly.
The overhead of readlink-based method is one syscall per descriptor,
that's hardly noticeable compared to multiple syscalls strace already
does to parse a single syscall made by the target process.
> While the attached patch currently meets all of my requirements, there
> are areas where it would need to be improved before it could be
> merged into the repository:
>
> 1) Support for non-Linux OSes isn't done yet. For example, the
> handling of the clone system call where it is determined whether
> to copy or share the descriptor state assumes the OS is Linux.
I wouldn't bother of non-Linux OSes. There are no feedback from these
OSes at all, so lets place the feature under #ifdef LINUX and leave
non-Linux case to people who care about strace on non-Linux.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20110216/15f43c81/attachment.bin>
More information about the Strace-devel
mailing list