diff options
author | Roland McGrath <roland@redhat.com> | 2003-01-14 09:46:17 +0000 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 2003-01-14 09:46:17 +0000 |
commit | 8073179e985bdf460926cbaa91737d844e201f8c (patch) | |
tree | 782aa78bc9da0dd102ed8bafce39d273f190b1df | |
parent | e1df47ff9a7f3e1ed90969109258f2686f74ce0d (diff) | |
download | strace-8073179e985bdf460926cbaa91737d844e201f8c.tar.gz strace-8073179e985bdf460926cbaa91737d844e201f8c.tar.bz2 strace-8073179e985bdf460926cbaa91737d844e201f8c.tar.xz |
2003-01-14 Roland McGrath <roland@redhat.com>
* ipc.c (PRINTCTL): New macro. #ifdef IPC_64, factor out the flag and
print it before using printxval.
(sys_msgctl, sys_semctl, sys_shmctl): Use it.
-rw-r--r-- | ipc.c | 28 |
1 files changed, 19 insertions, 9 deletions
@@ -58,6 +58,10 @@ #define SEM_INFO 19 #endif +#if defined LINUX && !defined IPC_64 +# define IPC_64 0x100 +#endif + static struct xlat msgctl_flags[] = { { IPC_RMID, "IPC_RMID" }, { IPC_SET, "IPC_SET" }, @@ -98,12 +102,12 @@ static struct xlat shmctl_flags[] = { { SHM_STAT, "SHM_STAT" }, { SHM_INFO, "SHM_INFO" }, #endif /* LINUX */ -#ifdef SHM_LOCK +#ifdef SHM_LOCK { SHM_LOCK, "SHM_LOCK" }, #endif -#ifdef SHM_UNLOCK +#ifdef SHM_UNLOCK { SHM_UNLOCK, "SHM_UNLOCK" }, -#endif +#endif { 0, NULL }, }; @@ -148,14 +152,20 @@ struct tcb *tcp; return 0; } +#ifdef IPC_64 +# define PRINTCTL(flagset, arg, dflt) \ + if ((arg) & IPC_64) tprintf("IPC_64|"); \ + printxval((flagset), (arg) &~ IPC_64, dflt) +#else +# define PRINTCTL printxval +#endif + int sys_msgctl(tcp) struct tcb *tcp; { - char *cmd = xlookup(msgctl_flags, tcp->u_arg[1]); - if (entering(tcp)) { - tprintf("%lu", tcp->u_arg[0]); - tprintf(", %s", cmd == NULL ? "MSG_???" : cmd); + tprintf("%lu, ", tcp->u_arg[0]); + PRINTCTL(msgctl_flags, tcp->u_arg[1], "MSG_???"); #ifdef LINUX tprintf(", %#lx", tcp->u_arg[3]); #else /* !LINUX */ @@ -274,7 +284,7 @@ struct tcb *tcp; if (entering(tcp)) { tprintf("%lu", tcp->u_arg[0]); tprintf(", %lu, ", tcp->u_arg[1]); - printxval(semctl_flags, tcp->u_arg[2], "SEM_???"); + PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???"); tprintf(", %#lx", tcp->u_arg[3]); } return 0; @@ -302,7 +312,7 @@ struct tcb *tcp; { if (entering(tcp)) { tprintf("%lu, ", tcp->u_arg[0]); - printxval(shmctl_flags, tcp->u_arg[1], "SHM_???"); + PRINTCTL(shmctl_flags, tcp->u_arg[1], "SHM_???"); #ifdef LINUX tprintf(", %#lx", tcp->u_arg[3]); #else /* !LINUX */ |