From: Elvira Khabirova Date: Thu, 20 Aug 2015 18:15:41 +0000 (+0300) Subject: Mpersify parsers of mq_open and mq_getsetattr syscalls X-Git-Tag: v4.11~234 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f53730965614f2e569d5985d698267362fb7e2f;p=strace Mpersify parsers of mq_open and mq_getsetattr syscalls Fix multiple personalities support in parsers of mq_open and mq_getsetattr by converting printmqattr into a mpersified printer. * print_mq_attr.c (mq_attr_t): New typedef. Mpersify it. (printmqattr): Use it instead of struct mq_attr. Wrap function name into MPERS_PRINTER_DECL. * mq.c (mq_open, mq_getsetattr): Use mpersified printmqattr. --- diff --git a/mq.c b/mq.c index 464045ff..2d745732 100644 --- a/mq.c +++ b/mq.c @@ -29,8 +29,6 @@ #include "defs.h" #include -extern void printmqattr(struct tcb *tcp, const long addr); - SYS_FUNC(mq_open) { printpath(tcp, tcp->u_arg[0]); @@ -40,7 +38,7 @@ SYS_FUNC(mq_open) if (tcp->u_arg[1] & O_CREAT) { /* mode */ tprintf(", %#lo, ", tcp->u_arg[2]); - printmqattr(tcp, tcp->u_arg[3]); + MPERS_PRINTER_NAME(printmqattr)(tcp, tcp->u_arg[3]); } return RVAL_DECODED; } @@ -77,9 +75,9 @@ SYS_FUNC(mq_getsetattr) { if (entering(tcp)) { tprintf("%ld, ", tcp->u_arg[0]); - printmqattr(tcp, tcp->u_arg[1]); + MPERS_PRINTER_NAME(printmqattr)(tcp, tcp->u_arg[1]); tprints(", "); } else - printmqattr(tcp, tcp->u_arg[2]); + MPERS_PRINTER_NAME(printmqattr)(tcp, tcp->u_arg[2]); return 0; } diff --git a/print_mq_attr.c b/print_mq_attr.c index 184fff1c..f9bff342 100644 --- a/print_mq_attr.c +++ b/print_mq_attr.c @@ -28,17 +28,19 @@ #include "defs.h" +#include DEF_MPERS_TYPE(mq_attr_t) #ifdef HAVE_MQUEUE_H # include +typedef struct mq_attr mq_attr_t; #endif +#include MPERS_DEFS -void -printmqattr(struct tcb *tcp, const long addr) +MPERS_PRINTER_DECL(void, printmqattr)(struct tcb *tcp, const long addr) { # ifndef HAVE_MQUEUE_H printaddr(addr); # else - struct mq_attr attr; + mq_attr_t attr; if (umove_or_printaddr(tcp, addr, &attr)) return; tprints("{mq_flags=");