From owner-svn-src-head@freebsd.org Fri Jun 23 18:06:47 2017 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 5A9A1D869B7; Fri, 23 Jun 2017 18:06:47 +0000 (UTC) (envelope-from imp@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 370056E529; Fri, 23 Jun 2017 18:06:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5NI6kdM052295; Fri, 23 Jun 2017 18:06:46 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5NI6kh4052293; Fri, 23 Jun 2017 18:06:46 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201706231806.v5NI6kh4052293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Jun 2017 18:06:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320279 - 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.23 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: Fri, 23 Jun 2017 18:06:47 -0000 Author: imp Date: Fri Jun 23 18:06:46 2017 New Revision: 320279 URL: https://svnweb.freebsd.org/changeset/base/320279 Log: Decode FreeBSD 11 compat stat, fstat and lstat calls. 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 Fri Jun 23 18:06:20 2017 (r320278) +++ head/usr.bin/truss/syscall.h Fri Jun 23 18:06:46 2017 (r320279) @@ -10,6 +10,7 @@ * BinString -- pointer to an array of chars, printed via strvisx(). * Ptr -- pointer to some unspecified structure. Just print as hex for now. * Stat -- a pointer to a stat buffer. Prints a couple fields. + * Stat11 -- a pointer to a freebsd 11 stat buffer. Prints a couple fields. * StatFs -- a pointer to a statfs buffer. Prints a few fields. * Ioctl -- an ioctl command. Woefully limited. * Quad -- a double-word value. e.g., lseek(int, offset_t, int) @@ -38,7 +39,7 @@ * $FreeBSD$ */ -enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHex, Name, Ptr, Stat, Ioctl, +enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHex, Name, Ptr, Stat, Stat11, Ioctl, Quad, Signal, Sockaddr, StringArray, Timespec, Timeval, Itimerval, Pollfd, Fd_set, Sigaction, Fcntl, Mprot, Mmapflags, Whence, Readlinkres, Sigset, Sigprocmask, StatFs, Kevent, Sockdomain, Socktype, Open, Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Fri Jun 23 18:06:20 2017 (r320278) +++ head/usr.bin/truss/syscalls.c Fri Jun 23 18:06:46 2017 (r320279) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#define _WANT_FREEBSD11_STAT #include #include #include @@ -215,6 +216,14 @@ static struct syscall decoded_syscalls[] = { .args = { { Int, 0 }, { Fcntl, 1 }, { Fcntlflag, 2 } } }, { .name = "flock", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Flockop, 1 } } }, + { .name = "compat11.fstat", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { Stat11 | OUT, 1 } } }, + { .name = "compat11.lstat", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Stat11 | OUT, 1 } } }, + { .name = "compat11.stat", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Stat11 | OUT, 1 } } }, + { .name = "compat11.stat", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Stat11 | OUT, 1 } } }, { .name = "fstat", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Stat | OUT, 1 } } }, { .name = "fstatat", .ret_type = 1, .nargs = 4, @@ -1870,6 +1879,23 @@ print_arg(struct syscall_args *sc, unsigned long *args } case Stat: { struct stat st; + + if (get_struct(pid, (void *)args[sc->offset], &st, sizeof(st)) + != -1) { + char mode[12]; + + strmode(st.st_mode, mode); + fprintf(fp, + "{ mode=%s,inode=%ju,size=%jd,blksize=%ld }", mode, + (uintmax_t)st.st_ino, (intmax_t)st.st_size, + (long)st.st_blksize); + } else { + fprintf(fp, "0x%lx", args[sc->offset]); + } + break; + } + case Stat11: { + struct freebsd11_stat st; if (get_struct(pid, (void *)args[sc->offset], &st, sizeof(st)) != -1) {