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.
This commit is contained in:
parent
d6b0558ad6
commit
6f950cc499
2
defs.h
2
defs.h
@ -414,6 +414,7 @@ extern const struct xlat at_flags[];
|
||||
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 void printtv_bitness(struct tcb *, long, enum bitness_t, int);
|
||||
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);
|
||||
|
2
mq.c
2
mq.c
@ -67,7 +67,7 @@ SYS_FUNC(mq_timedreceive)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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 @@ printsigevent(struct tcb *tcp, long arg)
|
||||
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("}");
|
||||
|
Loading…
x
Reference in New Issue
Block a user