[PATCH v5] Print absolute paths in printpathn when -yy is used
Dmitry V. Levin
ldv at altlinux.org
Wed Aug 20 16:56:52 UTC 2014
On Mon, Aug 11, 2014 at 09:31:25AM +0530, Zubin Mithra wrote:
[...]
> Currently this is how I've implemented it(this is a portion of the diff
> minus the usage/documentation/variable declaration/print_tracee_cwd
> function for brevity).
>
> diff --git a/util.c b/util.c
> index c78e962..57ea9fe 100644
> --- a/util.c
> +++ b/util.c
> @@ -559,6 +559,60 @@ string_quote(const char *instr, char *outstr, long
> len, int size)
> return 0;
> }
> +
> +/* Returns the index of the dirfd to be decoded if the syscall
> + * is a *at syscall */
> +static bool
> +is_at_syscall(struct tcb *tcp)
> +{
> + if (tcp->s_ent->sys_func == sys_openat ||
> + tcp->s_ent->sys_func == sys_mkdirat ||
> + tcp->s_ent->sys_func == sys_mknodat ||
> + tcp->s_ent->sys_func == sys_fchownat ||
> + tcp->s_ent->sys_func == sys_futimesat ||
> + tcp->s_ent->sys_func == sys_newfstatat ||
> + tcp->s_ent->sys_func == sys_unlinkat ||
> + tcp->s_ent->sys_func == sys_renameat ||
> + tcp->s_ent->sys_func == sys_linkat ||
> + tcp->s_ent->sys_func == sys_readlinkat ||
> + tcp->s_ent->sys_func == sys_fchmodat ||
> + tcp->s_ent->sys_func == sys_faccessat)
> + return 0;
> + else if (tcp->s_ent->sys_func == sys_symlinkat)
> + return 1;
> + return -1;
This won't work for renameat, renameat2, and linkat syscalls.
A more robust approach is to introduce a new printing function, e.g.
printpathat, and use it in these decoders.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20140820/5aad89f6/attachment.bin>
More information about the Strace-devel
mailing list