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.
This commit is contained in:
Elvira Khabirova 2015-08-19 05:33:34 +03:00 committed by Dmitry V. Levin
parent 422f793364
commit c2445b4aa7
2 changed files with 14 additions and 11 deletions

View File

@ -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);
}

View File

@ -32,14 +32,19 @@
#include "defs.h"
void
tprint_msgbuf(struct tcb *tcp, const long addr, const unsigned long count)
{
long mtype;
#include <sys/msg.h>
if (!umove_or_printaddr(tcp, addr, &mtype)) {
tprintf("{%lu, ", mtype);
printstr(tcp, addr + sizeof(mtype), count);
#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)
{
msgbuf_t msg;
if (!umove_or_printaddr(tcp, addr, &msg)) {
tprintf("{%lu, ", (long) msg.mtype);
printstr(tcp, addr + sizeof(msg.mtype), count);
tprints("}");
}
tprintf(", %lu, ", count);