]> granicus.if.org Git - strace/commitdiff
Mpersify parsers of mq_open and mq_getsetattr syscalls
authorElvira Khabirova <lineprinter0@gmail.com>
Thu, 20 Aug 2015 18:15:41 +0000 (21:15 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 28 Aug 2015 08:46:23 +0000 (08:46 +0000)
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.

mq.c
print_mq_attr.c

diff --git a/mq.c b/mq.c
index 464045ff75bf091cb24e24cad42a16d502ae67d0..2d74573247da7cbcc4866502ba7e27dcff59d71a 100644 (file)
--- a/mq.c
+++ b/mq.c
@@ -29,8 +29,6 @@
 #include "defs.h"
 #include <fcntl.h>
 
-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;
 }
index 184fff1ca69d16cd8a026387f0b6ea8060dc1521..f9bff3429bdc56873cb0c979d68c557c17a2749d 100644 (file)
 
 #include "defs.h"
 
+#include DEF_MPERS_TYPE(mq_attr_t)
 #ifdef HAVE_MQUEUE_H
 # include <mqueue.h>
+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=");