From owner-svn-src-all@freebsd.org Mon Jun 5 05:25:51 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 9CB87BF753E; Mon, 5 Jun 2017 05:25:51 +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 77E5871C0B; Mon, 5 Jun 2017 05:25:51 +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 v555Popn018363; Mon, 5 Jun 2017 05:25:50 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v555PoJ8018361; Mon, 5 Jun 2017 05:25:50 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201706050525.v555PoJ8018361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 5 Jun 2017 05:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319595 - 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: Mon, 05 Jun 2017 05:25:51 -0000 Author: jhb Date: Mon Jun 5 05:25:50 2017 New Revision: 319595 URL: https://svnweb.freebsd.org/changeset/base/319595 Log: Decode arguments to dup, dup2, getdirentries, pread, and pwrite. - dup and dup2 print fd arguments in decimal. - pread and pwrite are similar to read and write with the addition of the file offset. - getdirentries displays the output entries as a string for now and also prints the value returned in *basep. Eventually the buffer for getdirentries should perhaps be decoded as an array of dirent structures. PR: 214885 Submitted by: Jonathan de Boyne Pollard 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 Mon Jun 5 05:17:42 2017 (r319594) +++ head/usr.bin/truss/syscall.h Mon Jun 5 05:25:50 2017 (r319595) @@ -48,7 +48,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHe Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2, CapFcntlRights, Fadvice, FileFlags, Flockop, Getfsstatmode, Kldsymcmd, Kldunloadflags, Sizet, Madvice, Socklent, Sockprotocol, Sockoptlevel, - Sockoptname, Msgflags, CapRights, PUInt, + Sockoptname, Msgflags, CapRights, PUInt, PQuadHex, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Mon Jun 5 05:17:42 2017 (r319594) +++ head/usr.bin/truss/syscalls.c Mon Jun 5 05:25:50 2017 (r319595) @@ -125,6 +125,10 @@ static struct syscall decoded_syscalls[] = { { .name = "connectat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Int, 1 }, { Sockaddr | IN, 2 }, { Int, 3 } } }, + { .name = "dup", .ret_type = 1, .nargs = 1, + .args = { { Int, 0 } } }, + { .name = "dup2", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { Int, 1 } } }, { .name = "eaccess", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Accessmode, 1 } } }, { .name = "execve", .ret_type = 1, .nargs = 3, @@ -165,6 +169,9 @@ static struct syscall decoded_syscalls[] = { .args = { { Int, 0 }, { Timeval2 | IN, 1 } } }, { .name = "futimesat", .ret_type = 1, .nargs = 3, .args = { { Atfd, 0 }, { Name | IN, 1 }, { Timeval2 | IN, 2 } } }, + { .name = "getdirentries", .ret_type = 1, .nargs = 4, + .args = { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 }, + { PQuadHex | OUT, 3 } } }, { .name = "getfsstat", .ret_type = 1, .nargs = 3, .args = { { Ptr, 0 }, { Long, 1 }, { Getfsstatmode, 2 } } }, { .name = "getitimer", .ret_type = 1, .nargs = 2, @@ -275,8 +282,14 @@ static struct syscall decoded_syscalls[] = { { Fadvice, 3 } } }, { .name = "posix_openpt", .ret_type = 1, .nargs = 1, .args = { { Open, 0 } } }, + { .name = "pread", .ret_type = 1, .nargs = 4, + .args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 }, + { QuadHex, 3 } } }, { .name = "procctl", .ret_type = 1, .nargs = 4, .args = { { Idtype, 0 }, { Quad, 1 }, { Procctl, 2 }, { Ptr, 3 } } }, + { .name = "pwrite", .ret_type = 1, .nargs = 4, + .args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 }, + { QuadHex, 3 } } }, { .name = "read", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 } } }, { .name = "readlink", .ret_type = 1, .nargs = 3, @@ -1354,6 +1367,16 @@ print_arg(struct syscall_args *sc, unsigned long *args break; } #endif + case PQuadHex: { + uint64_t val; + + if (get_struct(pid, (void *)args[sc->offset], &val, + sizeof(val)) == 0) + fprintf(fp, "{ 0x%jx }", (uintmax_t)val); + else + fprintf(fp, "0x%lx", args[sc->offset]); + break; + } case Ptr: fprintf(fp, "0x%lx", args[sc->offset]); break;