diff options
author | Roland McGrath <roland@redhat.com> | 2004-04-16 21:48:40 +0000 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 2004-04-16 21:48:40 +0000 |
commit | 4df13c169dae7f9fac4719a4d3df7bcd0bf8a2ca (patch) | |
tree | 96fe69c8aed0056b3337bdaa4a1718bad72d2748 /ipc.c | |
parent | 085bae16dbae1396ae29860c0ed1793d745580b7 (diff) | |
download | strace-4df13c169dae7f9fac4719a4d3df7bcd0bf8a2ca.tar.gz strace-4df13c169dae7f9fac4719a4d3df7bcd0bf8a2ca.tar.bz2 strace-4df13c169dae7f9fac4719a4d3df7bcd0bf8a2ca.tar.xz |
2004-04-16 Roland McGrath <roland@redhat.com>
* configure.ac: Check for <mqueue.h>.
* ipc.c (sys_mq_open, printmqattr) [! HAVE_MQUEUE_H]: Don't try to
decode struct mq_attr.
* linux/syscall.h: Support new mq_* syscalls on Linux.
* linux/syscallent.h: Likewise.
* linux/dummy.h: Likewise.
* ipc.c: Likewise.
* time.c (printsigevent): Handle SIGEV_THREAD.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#120701.
Diffstat (limited to 'ipc.c')
-rw-r--r-- | ipc.c | 106 |
1 files changed, 106 insertions, 0 deletions
@@ -34,6 +34,11 @@ #if defined(LINUX) || defined(SUNOS4) || defined(FREEBSD) +# ifdef HAVE_MQUEUE_H +# include <mqueue.h> +# endif + +#include <fcntl.h> #include <sys/ipc.h> #include <sys/sem.h> #include <sys/msg.h> @@ -62,6 +67,9 @@ # define IPC_64 0x100 #endif +extern struct xlat openmodes[]; +extern void printsigevent(struct tcb *tcp, long arg); + static struct xlat msgctl_flags[] = { { IPC_RMID, "IPC_RMID" }, { IPC_SET, "IPC_SET" }, @@ -384,3 +392,101 @@ struct tcb *tcp; } #endif /* defined(LINUX) || defined(SUNOS4) || defined(FREEBSD) */ + +#ifdef LINUX +int sys_mq_open(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + tprintf(", "); + /* flags */ + printflags(openmodes, tcp->u_arg[1] + 1); + if (tcp->u_arg[1] & O_CREAT) { +# ifndef HAVE_MQUEUE_H + tprintf(", %lx", tcp->u_arg[2]); +# else + struct mq_attr attr; + /* mode */ + tprintf(", %#lo, ", tcp->u_arg[2]); + if (umove(tcp, tcp->u_arg[3], &attr) < 0) + tprintf("{ ??? }"); + else + tprintf("{mq_maxmsg=%ld, mq_msgsize=%ld}", + attr.mq_maxmsg, attr.mq_msgsize); +# endif + } + } + return 0; +} + +int sys_mq_timedsend(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + tprintf("%ld, ", tcp->u_arg[0]); + printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); + tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]); + printtv(tcp, tcp->u_arg[4]); + } + return 0; +} + +int sys_mq_timedreceive(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) + tprintf("%ld, ", tcp->u_arg[0]); + else { + printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); + tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]); + printtv(tcp, tcp->u_arg[4]); + } + return 0; +} + +int sys_mq_notify(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + tprintf("%ld, ", tcp->u_arg[0]); + printsigevent(tcp, tcp->u_arg[1]); + } + return 0; +} + +static void printmqattr(tcp, addr) +struct tcb *tcp; +long addr; +{ + if (addr == 0) + tprintf("NULL"); + else { +# ifndef HAVE_MQUEUE_H + tprintf("%#lx", addr); +# else + struct mq_attr attr; + if (umove(tcp, addr, &attr) < 0) { + tprintf("{...}"); + return; + } + tprintf("{mq_flags="); + printflags(openmodes, attr.mq_flags + 1); + tprintf(", mq_maxmsg=%ld, mq_msgsize=%ld, mq_curmsg=%ld}", + attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs); +# endif + } +} + +int sys_mq_getsetattr(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + tprintf("%ld, ", tcp->u_arg[0]); + printmqattr(tcp, tcp->u_arg[1]); + tprintf(", "); + } else + printmqattr(tcp, tcp->u_arg[2]); + return 0; +} +#endif |