[PATCH] Decode paths associated with file descriptors returned by syscalls
Dmitry V. Levin
ldv at altlinux.org
Mon Jun 2 15:04:53 UTC 2014
On Mon, Jun 02, 2014 at 07:35:55PM +0530, Zubin Mithra wrote:
> Hey Dmitry,
> >> $ strace -yeclose cat /dev/null
> >> close(3</etc/ld.so.cache>) = 0</dev/pts/1>
> >> close(3</lib64/libc-2.19.so>) = 0</dev/pts/1>
> >> close(3</dev/null>) = 0</dev/pts/1>
> >> close(1</dev/pts/1>) = 0</dev/pts/1>
> >> close(2</dev/pts/1>) = 0</dev/pts/1>
> >> +++ exited with 0 +++
> I had tested it out by running it on a few binaries. I hadn't noticed
> that erroneous decoding in the output, but it was present.
> > btw, wouldn't it be better to introduce a new return value code, e.g.
> > RVAL_FD, and update these several handlers to return RVAL_FD instead
> > of RVAL_DECIMAL, so that no sys_func checks would be necessary?
> > sys_dup and sys_delete_module would have to be split out anyway.
> Got it. Please find below a git diff of the code changes to have
> return fd decoding for sys_open. I'll send over a patch as soon as I'm
> done with the other syscalls.
> Do the changes to RVAL macros look good?
> diff --git a/defs.h b/defs.h
> index c862de5..7f23f45 100644
> --- a/defs.h
> +++ b/defs.h
> @@ -533,10 +533,11 @@ extern const struct xlat whence_codes;
> # endif
> # define RVAL_LUDECIMAL 007 /* long unsigned decimal format */
> -#define RVAL_MASK 007 /* mask for these values */
> +#define RVAL_FD 010
Just add a short comment for the new value, too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 181 bytes
Desc: not available
More information about the Strace-devel