From: Elvira Khabirova Date: Wed, 19 Aug 2015 02:33:34 +0000 (+0300) Subject: Mpersify tprint_msgsnd and tprint_msgrcv X-Git-Tag: v4.11~232 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c2445b4aa7dbcd2fb91797e5daa3199e7a5da557;p=strace Mpersify tprint_msgsnd and tprint_msgrcv Fix multiple personalities support in tprint_msgsnd and tprint_msgrcv by converting tprint_msgbuf into a mpersified printer. * print_msgbuf.c (msgbuf_t): New typedef. Mpersify it. (tprint_msgbuf): Use it instead of long. Wrap function name into MPERS_PRINTER_DECL. * ipc_msg.c (tprint_msgsnd, tprint_msgrcv): Use mpersified tprint_msgbuf. --- diff --git a/ipc_msg.c b/ipc_msg.c index 5052eace..3ec04eb3 100644 --- a/ipc_msg.c +++ b/ipc_msg.c @@ -38,8 +38,6 @@ #include "xlat/ipc_msg_flags.h" #include "xlat/resource_flags.h" -extern void tprint_msgbuf(struct tcb *tcp, const long addr, const unsigned long count); - SYS_FUNC(msgget) { if (tcp->u_arg[0]) @@ -56,7 +54,7 @@ static void tprint_msgsnd(struct tcb *tcp, const long addr, const unsigned long count, const unsigned long flags) { - tprint_msgbuf(tcp, addr, count); + MPERS_PRINTER_NAME(tprint_msgbuf)(tcp, addr, count); printflags(ipc_msg_flags, flags, "MSG_???"); } @@ -77,7 +75,7 @@ static void tprint_msgrcv(struct tcb *tcp, const long addr, const unsigned long count, const long msgtyp) { - tprint_msgbuf(tcp, addr, count); + MPERS_PRINTER_NAME(tprint_msgbuf)(tcp, addr, count); tprintf("%ld, ", msgtyp); } diff --git a/print_msgbuf.c b/print_msgbuf.c index ac3dab09..c7e87e49 100644 --- a/print_msgbuf.c +++ b/print_msgbuf.c @@ -32,14 +32,19 @@ #include "defs.h" -void -tprint_msgbuf(struct tcb *tcp, const long addr, const unsigned long count) +#include + +#include DEF_MPERS_TYPE(msgbuf_t) +typedef struct msgbuf msgbuf_t; +#include MPERS_DEFS + +MPERS_PRINTER_DECL(void, tprint_msgbuf)(struct tcb *tcp, const long addr, const unsigned long count) { - long mtype; + msgbuf_t msg; - if (!umove_or_printaddr(tcp, addr, &mtype)) { - tprintf("{%lu, ", mtype); - printstr(tcp, addr + sizeof(mtype), count); + if (!umove_or_printaddr(tcp, addr, &msg)) { + tprintf("{%lu, ", (long) msg.mtype); + printstr(tcp, addr + sizeof(msg.mtype), count); tprints("}"); } tprintf(", %lu, ", count);