Date: Mon, 17 Aug 2015 19:08:49 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286860 - head/usr.bin/truss Message-ID: <201508171908.t7HJ8n3W086183@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Mon Aug 17 19:08:48 2015 New Revision: 286860 URL: https://svnweb.freebsd.org/changeset/base/286860 Log: Use an xlat table and xlookup() instead of a home-rolled version for the sigprocmask operation type. Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Mon Aug 17 19:06:14 2015 (r286859) +++ head/usr.bin/truss/syscalls.c Mon Aug 17 19:08:48 2015 (r286860) @@ -555,6 +555,11 @@ static struct xlat linux_socketcall_ops[ XEND }; +static struct xlat sigprocmask_ops[] = { + X(SIG_BLOCK) X(SIG_UNBLOCK) X(SIG_SETMASK) + XEND +}; + #undef X #undef XEND @@ -1096,15 +1101,7 @@ print_arg(struct syscall_args *sc, unsig break; } case Sigprocmask: { - switch (args[sc->offset]) { -#define S(a) case a: tmp = strdup(#a); break; - S(SIG_BLOCK); - S(SIG_UNBLOCK); - S(SIG_SETMASK); -#undef S - } - if (tmp == NULL) - asprintf(&tmp, "0x%lx", args[sc->offset]); + tmp = strdup(xlookup(sigprocmask_ops, args[sc->offset])); break; } case Fcntlflag: {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508171908.t7HJ8n3W086183>