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 5531bbc..9e5528c 100644
--- a/defs.h
+++ b/defs.h
@@ -414,6 +414,7 @@
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 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 59a093a..ca0cfda 100644
--- a/mq.c
+++ b/mq.c
@@ -67,7 +67,7 @@
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 52337cb..f752120 100644
--- a/print_sigevent.c
+++ b/print_sigevent.c
@@ -28,61 +28,23 @@
#include "defs.h"
+#include DEF_MPERS_TYPE(struct_sigevent)
+
#include <signal.h>
+typedef struct sigevent struct_sigevent;
-#include "xlat/sigev_value.h"
+#include MPERS_DEFS
-#if SUPPORTED_PERSONALITIES > 1
-static void
-printsigevent32(struct tcb *tcp, long arg)
-{
- struct {
- int sigev_value;
- int sigev_signo;
- int sigev_notify;
-
- union {
- int tid;
- struct {
- int function, attribute;
- } thread;
- } un;
- } sev;
-
- 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 @@
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 429f461..91e0915 100644
--- a/time.c
+++ b/time.c
@@ -514,7 +514,7 @@
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");