From: Dmitry V. Levin Date: Wed, 16 Sep 2015 16:31:43 +0000 (+0000) Subject: Convert parser of struct sigevent to new mpers infrastructure X-Git-Tag: v4.11~198 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6f950cc49907c0357aeaa66a9ef32970733f14ae;p=strace Convert parser of struct sigevent to new mpers infrastructure * defs.h (sigev_value): New prototype. (printsigevent): Remove. * print_sigevent.c (struct_sigevent): New typedef. Mpersify it. [IN_MPERS]: Do not include "xlat/sigev_value.h". (printsigevent32): Remove. (printsigevent): Rename to print_sigevent. Mpersify it. * mq.c (sys_mq_notify): Rename printsigevent to print_sigevent. * time.c (sys_timer_create): Likewise. --- diff --git a/defs.h b/defs.h index 5531bbc4..9e5528cf 100644 --- a/defs.h +++ b/defs.h @@ -414,6 +414,7 @@ extern const struct xlat at_flags[]; extern const struct xlat open_access_modes[]; extern const struct xlat open_mode_flags[]; extern const struct xlat resource_flags[]; +extern const struct xlat sigev_value[]; extern const struct xlat whence_codes[]; /* Format of syscall return values */ @@ -650,7 +651,6 @@ extern void printtv_bitness(struct tcb *, long, enum bitness_t, int); extern char *sprinttv(char *, struct tcb *, long, enum bitness_t, int special); extern void print_timespec(struct tcb *, long); extern void sprint_timespec(char *, struct tcb *, long); -extern void printsigevent(struct tcb *tcp, long arg); extern void printfd(struct tcb *, int); extern bool print_sockaddr_by_inode(const unsigned long, const char *); extern void print_dirfd(struct tcb *, int); diff --git a/mq.c b/mq.c index 59a093a0..ca0cfdaf 100644 --- a/mq.c +++ b/mq.c @@ -67,7 +67,7 @@ SYS_FUNC(mq_timedreceive) SYS_FUNC(mq_notify) { tprintf("%ld, ", tcp->u_arg[0]); - printsigevent(tcp, tcp->u_arg[1]); + print_sigevent(tcp, tcp->u_arg[1]); return RVAL_DECODED; } diff --git a/print_sigevent.c b/print_sigevent.c index 52337cb7..f752120b 100644 --- a/print_sigevent.c +++ b/print_sigevent.c @@ -28,61 +28,23 @@ #include "defs.h" -#include - -#include "xlat/sigev_value.h" +#include DEF_MPERS_TYPE(struct_sigevent) -#if SUPPORTED_PERSONALITIES > 1 -static void -printsigevent32(struct tcb *tcp, long arg) -{ - struct { - int sigev_value; - int sigev_signo; - int sigev_notify; +#include +typedef struct sigevent struct_sigevent; - union { - int tid; - struct { - int function, attribute; - } thread; - } un; - } sev; +#include MPERS_DEFS - if (!umove_or_printaddr(tcp, arg, &sev)) { - tprintf("{%#x, ", sev.sigev_value); - if (sev.sigev_notify == SIGEV_SIGNAL) - tprintf("%s, ", signame(sev.sigev_signo)); - else - tprintf("%u, ", sev.sigev_signo); - printxval(sigev_value, sev.sigev_notify, "SIGEV_???"); - tprints(", "); - if (sev.sigev_notify == SIGEV_THREAD_ID) - tprintf("{%d}", sev.un.tid); - else if (sev.sigev_notify == SIGEV_THREAD) - tprintf("{%#x, %#x}", - sev.un.thread.function, - sev.un.thread.attribute); - else - tprints("{...}"); - tprints("}"); - } -} +#ifndef IN_MPERS +# include "xlat/sigev_value.h" #endif -void -printsigevent(struct tcb *tcp, long arg) +MPERS_PRINTER_DECL(void, print_sigevent)(struct tcb *tcp, const long addr) { - struct sigevent sev; + struct_sigevent sev; -#if SUPPORTED_PERSONALITIES > 1 - if (current_wordsize == 4) { - printsigevent32(tcp, arg); - return; - } -#endif - if (!umove_or_printaddr(tcp, arg, &sev)) { - tprintf("{%p, ", sev.sigev_value.sival_ptr); + if (!umove_or_printaddr(tcp, addr, &sev)) { + tprintf("{%#lx, ", (unsigned long) sev.sigev_value.sival_ptr); if (sev.sigev_notify == SIGEV_SIGNAL) tprintf("%s, ", signame(sev.sigev_signo)); else @@ -102,8 +64,9 @@ printsigevent(struct tcb *tcp, long arg) tprints("{...}"); #endif else if (sev.sigev_notify == SIGEV_THREAD) - tprintf("{%p, %p}", sev.sigev_notify_function, - sev.sigev_notify_attributes); + tprintf("{%#lx, %#lx}", + (unsigned long) sev.sigev_notify_function, + (unsigned long) sev.sigev_notify_attributes); else tprints("{...}"); tprints("}"); diff --git a/time.c b/time.c index 429f4618..91e09158 100644 --- a/time.c +++ b/time.c @@ -514,7 +514,7 @@ SYS_FUNC(timer_create) if (entering(tcp)) { printclockname(tcp->u_arg[0]); tprints(", "); - printsigevent(tcp, tcp->u_arg[1]); + print_sigevent(tcp, tcp->u_arg[1]); tprints(", "); } else { printnum_int(tcp, tcp->u_arg[2], "%d");