From: Dmitry V. Levin Date: Thu, 11 Dec 2014 19:25:02 +0000 (+0000) Subject: process.c: move get_robust_list parser to a separate file X-Git-Tag: v4.10~304 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=83576385688fa8539078f0e44888c1ca3ff94e2b;p=strace process.c: move get_robust_list parser to a separate file * get_robust_list.c: New file. * Makefile.am (strace_SOURCES): Add it. * process.c (sys_get_robust_list): Move to get_robust_list.c. --- diff --git a/Makefile.am b/Makefile.am index f72fd076..917e08c7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,6 +34,7 @@ strace_SOURCES = \ fallocate.c \ fanotify.c \ file.c \ + get_robust_list.c \ getcpu.c \ getcwd.c \ inotify.c \ diff --git a/get_robust_list.c b/get_robust_list.c new file mode 100644 index 00000000..1b667cab --- /dev/null +++ b/get_robust_list.c @@ -0,0 +1,29 @@ +#include "defs.h" + +int +sys_get_robust_list(struct tcb *tcp) +{ + if (entering(tcp)) { + tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]); + } else { + void *addr; + size_t len; + + if (syserror(tcp) || + !tcp->u_arg[1] || + umove(tcp, tcp->u_arg[1], &addr) < 0) { + tprintf("%#lx, ", tcp->u_arg[1]); + } else { + tprintf("[%p], ", addr); + } + + if (syserror(tcp) || + !tcp->u_arg[2] || + umove(tcp, tcp->u_arg[2], &len) < 0) { + tprintf("%#lx", tcp->u_arg[2]); + } else { + tprintf("[%lu]", (unsigned long) len); + } + } + return 0; +} diff --git a/process.c b/process.c index ea73594d..46b980f0 100644 --- a/process.c +++ b/process.c @@ -2201,31 +2201,3 @@ sys_futex(struct tcb *tcp) } return 0; } - -int -sys_get_robust_list(struct tcb *tcp) -{ - if (entering(tcp)) { - tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]); - } else { - void *addr; - size_t len; - - if (syserror(tcp) || - !tcp->u_arg[1] || - umove(tcp, tcp->u_arg[1], &addr) < 0) { - tprintf("%#lx, ", tcp->u_arg[1]); - } else { - tprintf("[%p], ", addr); - } - - if (syserror(tcp) || - !tcp->u_arg[2] || - umove(tcp, tcp->u_arg[2], &len) < 0) { - tprintf("%#lx", tcp->u_arg[2]); - } else { - tprintf("[%lu]", (unsigned long) len); - } - } - return 0; -}