diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2010-03-29 20:45:48 +0400 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2010-04-07 10:19:27 +0000 |
commit | e6591031475ace4ac54bb9995f21dd86fa857b1b (patch) | |
tree | d0d23be7e74292a350c11e7390a8796e53ee2bf5 /net.c | |
parent | 0873f29af4c1b2357e4f13338731665dd1ee2893 (diff) | |
download | strace-e6591031475ace4ac54bb9995f21dd86fa857b1b.tar.gz strace-e6591031475ace4ac54bb9995f21dd86fa857b1b.tar.bz2 strace-e6591031475ace4ac54bb9995f21dd86fa857b1b.tar.xz |
Enhance recvmmsg parser
* net.c (sys_recvmmsg): Decode mmsghdr structure on exit from the
syscall. Decode timespec structure both on entrance and on exit.
Diffstat (limited to 'net.c')
-rw-r--r-- | net.c | 47 |
1 files changed, 39 insertions, 8 deletions
@@ -1532,17 +1532,48 @@ struct tcb *tcp; int sys_recvmmsg(struct tcb *tcp) { + static char str[128]; if (entering(tcp)) { + tprintf("%ld, ", tcp->u_arg[0]); - printmmsghdr(tcp, tcp->u_arg[1]); - tprintf(", %ld, ", tcp->u_arg[2]); - /* flags */ - printflags(msg_flags, tcp->u_arg[3], "MSG_???"); - /* timeout */ - tprintf(", "); - print_timespec(tcp, tcp->u_arg[4]); + if (verbose(tcp)) { + sprint_timespec(str, tcp, tcp->u_arg[4]); + tcp->auxstr = strdup(str); + } else { + tprintf("%#lx, %ld, ", tcp->u_arg[1], tcp->u_arg[2]); + printflags(msg_flags, tcp->u_arg[3], "MSG_???"); + tprintf(", "); + print_timespec(tcp, tcp->u_arg[4]); + } + return 0; + } else { + if (verbose(tcp)) { + if (syserror(tcp)) + tprintf("%#lx", tcp->u_arg[1]); + else + printmmsghdr(tcp, tcp->u_arg[1]); + tprintf(", %ld, ", tcp->u_arg[2]); + /* flags */ + printflags(msg_flags, tcp->u_arg[3], "MSG_???"); + /* timeout on entrance */ + tprintf(", %s", tcp->auxstr ? tcp->auxstr : "{...}"); + free((void *) tcp->auxstr); + tcp->auxstr = NULL; + } + if (syserror(tcp)) + return 0; + if (tcp->u_rval == 0) { + tcp->auxstr = "Timeout"; + return RVAL_STR; + } + if (!verbose(tcp)) + return 0; + /* timeout on exit */ + strcpy(str, "left "); + sprint_timespec(str + strlen(str), tcp, tcp->u_arg[4]); + tcp->auxstr = str; + return RVAL_STR; } - return 0; } #endif |