Date: Sun, 28 Oct 2018 10:59:49 +0000 (UTC) From: Thomas Munro <tmunro@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339840 - head/usr.bin/truss Message-ID: <201810281059.w9SAxne2081237@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/event.h> #include <sys/ioccom.h> +#include <sys/mman.h> #include <sys/mount.h> #include <sys/ptrace.h> #include <sys/resource.h> @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810281059.w9SAxne2081237>