From owner-svn-src-all@freebsd.org Sun Oct 28 10:59:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C3F610862AF; Sun, 28 Oct 2018 10:59:50 +0000 (UTC) (envelope-from tmunro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B9D27C51C; Sun, 28 Oct 2018 10:59:50 +0000 (UTC) (envelope-from tmunro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D97571E6B6; Sun, 28 Oct 2018 10:59:49 +0000 (UTC) (envelope-from tmunro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9SAxniU081238; Sun, 28 Oct 2018 10:59:49 GMT (envelope-from tmunro@FreeBSD.org) Received: (from tmunro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9SAxne2081237; Sun, 28 Oct 2018 10:59:49 GMT (envelope-from tmunro@FreeBSD.org) Message-Id: <201810281059.w9SAxne2081237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tmunro set sender to tmunro@FreeBSD.org using -f From: Thomas Munro Date: Sun, 28 Oct 2018 10:59:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339840 - head/usr.bin/truss X-SVN-Group: head X-SVN-Commit-Author: tmunro X-SVN-Commit-Paths: head/usr.bin/truss X-SVN-Commit-Revision: 339840 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Oct 2018 10:59:50 -0000 Author: tmunro Date: Sun Oct 28 10:59:49 2018 New Revision: 339840 URL: https://svnweb.freebsd.org/changeset/base/339840 Log: truss: Fix display of shm_open(SHM_ANON, ...). Currently truss(1) shows shm_open(SHM_ANON, ...) as shm_open("(null)", ...). Detect the special value and display it by name. Reviewed by: jhb, allanjude, tuexen Approved by: mjg (mentor) MFC with: r339224 Differential Revision: https://reviews.freebsd.org/D17461 Modified: head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Sun Oct 28 07:50:15 2018 (r339839) +++ head/usr.bin/truss/syscall.h Sun Oct 28 10:59:49 2018 (r339840) @@ -151,6 +151,7 @@ enum Argtype { PQuadHex, PUInt, Readlinkres, + ShmName, StringArray, /* Pointers to structures. */ Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Sun Oct 28 07:50:15 2018 (r339839) +++ head/usr.bin/truss/syscalls.c Sun Oct 28 10:59:49 2018 (r339840) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #define _WANT_FREEBSD11_KEVENT #include #include +#include #include #include #include @@ -462,7 +463,7 @@ static struct syscall decoded_syscalls[] = { .args = { { Int, 0 }, { Sockoptlevel, 1 }, { Sockoptname, 2 }, { Ptr | IN, 3 }, { Socklent, 4 } } }, { .name = "shm_open", .ret_type = 1, .nargs = 3, - .args = { { Name | IN, 0 }, { Open, 1 }, { Octal, 2 } } }, + .args = { { ShmName | IN, 0 }, { Open, 1 }, { Octal, 2 } } }, { .name = "shm_unlink", .ret_type = 1, .nargs = 1, .args = { { Name | IN, 0 } } }, { .name = "shutdown", .ret_type = 1, .nargs = 2, @@ -1593,6 +1594,13 @@ print_arg(struct syscall_args *sc, unsigned long *args case Sizet: fprintf(fp, "%zu", (size_t)args[sc->offset]); break; + case ShmName: + /* Handle special SHM_ANON value. */ + if ((char *)args[sc->offset] == SHM_ANON) { + fprintf(fp, "SHM_ANON"); + break; + } + /* FALLTHROUGH */ case Name: { /* NULL-terminated string. */ char *tmp2;