From owner-svn-src-head@freebsd.org Mon Aug 17 19:08:49 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B0239BC05A; Mon, 17 Aug 2015 19:08:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89A2019E5; Mon, 17 Aug 2015 19:08:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7HJ8n3P086184; Mon, 17 Aug 2015 19:08:49 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7HJ8n3W086183; Mon, 17 Aug 2015 19:08:49 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201508171908.t7HJ8n3W086183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 17 Aug 2015 19:08:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286860 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2015 19:08:49 -0000 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: {