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

Attachment: pgpLlP91wMFDG.pgp
Description: PGP signature

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to