From 9cd385010ec1e0d22be70ff5163db194f1f22735 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Thu, 3 Mar 2011 01:12:25 +0100 Subject: [PATCH] Print shutdown(2) modes as SHUT_* constants * net.c (shutdown_modes): New xlat structure. (sys_shutdown): Use shutdown_modes to decode 2nd syscall argument. --- net.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/net.c b/net.c index cafa7396..a46cf061 100644 --- a/net.c +++ b/net.c @@ -1796,23 +1796,20 @@ sys_recvmmsg(struct tcb *tcp) #endif /* HAVE_SENDMSG */ +static const struct xlat shutdown_modes[] = { + { 0, "SHUT_RD" }, + { 1, "SHUT_WR" }, + { 2, "SHUT_RDWR" }, + { 0, NULL } +}; + int sys_shutdown(tcp) struct tcb *tcp; { if (entering(tcp)) { - tprintf("%ld, %ld", tcp->u_arg[0], tcp->u_arg[1]); - switch (tcp->u_arg[1]) { - case 0: - tprintf("%s", " /* receive */"); - break; - case 1: - tprintf("%s", " /* send */"); - break; - case 2: - tprintf("%s", " /* send and receive */"); - break; - } + tprintf("%ld, ", tcp->u_arg[0]); + printxval(shutdown_modes, tcp->u_arg[1], "SHUT_???"); } return 0; } -- 2.40.0