From owner-svn-src-all@freebsd.org Sat Mar 18 18:10:03 2017 Return-Path: Delivered-To: svn-src-all@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 E5FA6D126D5; Sat, 18 Mar 2017 18:10:03 +0000 (UTC) (envelope-from jhb@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 mx1.freebsd.org (Postfix) with ESMTPS id 9B32412C6; Sat, 18 Mar 2017 18:10:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2IIA2FW062433; Sat, 18 Mar 2017 18:10:02 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2IIA2ph062431; Sat, 18 Mar 2017 18:10:02 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201703181810.v2IIA2ph062431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 18 Mar 2017 18:10:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315496 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 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: Sat, 18 Mar 2017 18:10:04 -0000 Author: jhb Date: Sat Mar 18 18:10:02 2017 New Revision: 315496 URL: https://svnweb.freebsd.org/changeset/base/315496 Log: Decode the arguments passed to cap_fcntls_get() and cap_fcntls_limit(). 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 Sat Mar 18 18:05:39 2017 (r315495) +++ head/usr.bin/truss/syscall.h Sat Mar 18 18:10:02 2017 (r315496) @@ -45,6 +45,7 @@ enum Argtype { None = 1, Hex, Octal, Int Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl, LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long, Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2, + CapFcntlRights, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Sat Mar 18 18:05:39 2017 (r315495) +++ head/usr.bin/truss/syscalls.c Sat Mar 18 18:10:02 2017 (r315496) @@ -92,6 +92,10 @@ static struct syscall decoded_syscalls[] { Int, 3 } } }, { .name = "break", .ret_type = 1, .nargs = 1, .args = { { Ptr, 0 } } }, + { .name = "cap_fcntls_get", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { CapFcntlRights | OUT, 1 } } }, + { .name = "cap_fcntls_limit", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { CapFcntlRights, 1 } } }, { .name = "chdir", .ret_type = 1, .nargs = 1, .args = { { Name, 0 } } }, { .name = "chflags", .ret_type = 1, .nargs = 2, @@ -791,6 +795,18 @@ print_mask_arg(bool (*decoder)(FILE *, i fprintf(fp, "|0x%x", rem); } +static void +print_mask_arg32(bool (*decoder)(FILE *, uint32_t, uint32_t *), FILE *fp, + uint32_t value) +{ + uint32_t rem; + + if (!decoder(fp, value, &rem)) + fprintf(fp, "0x%x", rem); + else if (rem != 0) + fprintf(fp, "|0x%x", rem); +} + #ifndef __LP64__ /* * Add argument padding to subsequent system calls afater a Quad @@ -1832,6 +1848,20 @@ print_arg(struct syscall_args *sc, unsig case Pipe2: print_mask_arg(sysdecode_pipe2_flags, fp, args[sc->offset]); break; + case CapFcntlRights: { + uint32_t rights; + + if (sc->type & OUT) { + if (get_struct(pid, (void *)args[sc->offset], &rights, + sizeof(rights)) == -1) { + fprintf(fp, "0x%lx", args[sc->offset]); + break; + } + } else + rights = args[sc->offset]; + print_mask_arg32(sysdecode_cap_fcntlrights, fp, rights); + break; + } case CloudABIAdvice: fputs(xlookup(cloudabi_advice, args[sc->offset]), fp);