From owner-svn-src-head@freebsd.org Sat Jun 3 14:22:17 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 C59C9BF2837; Sat, 3 Jun 2017 14:22:17 +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 94B6E715D6; Sat, 3 Jun 2017 14:22:17 +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 v53EMG4E058344; Sat, 3 Jun 2017 14:22:16 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v53EMFGH058336; Sat, 3 Jun 2017 14:22:15 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201706031422.v53EMFGH058336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 3 Jun 2017 14:22:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319520 - in head: lib/libsysdecode usr.bin/kdump 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: Sat, 03 Jun 2017 14:22:17 -0000 Author: jhb Date: Sat Jun 3 14:22:15 2017 New Revision: 319520 URL: https://svnweb.freebsd.org/changeset/base/319520 Log: Decode the 'who' argument passed to getrusage(). Add a new sysdecode_getrusage_who() which decodes the RUSAGE_* constant passed as the first argument to getrusage(). Use this function in both kdump and truss to decode the first argument to getrusage(). PR: 215448 Submitted by: Anton Yuzhaninov MFC after: 1 month Modified: head/lib/libsysdecode/Makefile head/lib/libsysdecode/flags.c head/lib/libsysdecode/mktables head/lib/libsysdecode/sysdecode.h head/lib/libsysdecode/sysdecode_enum.3 head/usr.bin/kdump/kdump.c head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/lib/libsysdecode/Makefile ============================================================================== --- head/lib/libsysdecode/Makefile Sat Jun 3 14:15:14 2017 (r319519) +++ head/lib/libsysdecode/Makefile Sat Jun 3 14:22:15 2017 (r319520) @@ -32,6 +32,7 @@ MLINKS+=sysdecode_enum.3 sysdecode_acltype.3 \ sysdecode_enum.3 sysdecode_fadvice.3 \ sysdecode_enum.3 sysdecode_fcntl_cmd.3 \ sysdecode_enum.3 sysdecode_getfsstat_mode.3 \ + sysdecode_enum.3 sysdecode_getrusage_who.3 \ sysdecode_enum.3 sysdecode_idtype.3 \ sysdecode_enum.3 sysdecode_ipproto.3 \ sysdecode_enum.3 sysdecode_kldsym_cmd.3 \ Modified: head/lib/libsysdecode/flags.c ============================================================================== --- head/lib/libsysdecode/flags.c Sat Jun 3 14:15:14 2017 (r319519) +++ head/lib/libsysdecode/flags.c Sat Jun 3 14:22:15 2017 (r319520) @@ -487,6 +487,13 @@ sysdecode_getfsstat_mode(int mode) } const char * +sysdecode_getrusage_who(int who) +{ + + return (lookup_value(rusage, who)); +} + +const char * sysdecode_kldsym_cmd(int cmd) { Modified: head/lib/libsysdecode/mktables ============================================================================== --- head/lib/libsysdecode/mktables Sat Jun 3 14:15:14 2017 (r319519) +++ head/lib/libsysdecode/mktables Sat Jun 3 14:22:15 2017 (r319520) @@ -114,6 +114,7 @@ gen_table "quotactlcmds" "Q_[A-Z]+[[:space:]]+0x[0- gen_table "rebootopt" "RB_[A-Z]+[[:space:]]+0x[0-9]+" "sys/reboot.h" gen_table "rforkflags" "RF[A-Z]+[[:space:]]+\([0-9]+<<[0-9]+\)" "sys/unistd.h" gen_table "rlimit" "RLIMIT_[A-Z]+[[:space:]]+[0-9]+" "sys/resource.h" +gen_table "rusage" "RUSAGE_[A-Z]+[[:space:]]+[-0-9]+" "sys/resource.h" gen_table "schedpolicy" "SCHED_[A-Z]+[[:space:]]+[0-9]+" "sched.h" gen_table "sendfileflags" "SF_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h" gen_table "shmatflags" "SHM_[A-Z]+[[:space:]]+[0-9]{6}+" "sys/shm.h" Modified: head/lib/libsysdecode/sysdecode.h ============================================================================== --- head/lib/libsysdecode/sysdecode.h Sat Jun 3 14:15:14 2017 (r319519) +++ head/lib/libsysdecode/sysdecode.h Sat Jun 3 14:22:15 2017 (r319520) @@ -55,6 +55,7 @@ bool sysdecode_filemode(FILE *_fp, int _mode, int *_re bool sysdecode_flock_operation(FILE *_fp, int _operation, int *_rem); int sysdecode_freebsd_to_abi_errno(enum sysdecode_abi _abi, int _error); const char *sysdecode_getfsstat_mode(int _mode); +const char *sysdecode_getrusage_who(int _who); const char *sysdecode_idtype(int _idtype); const char *sysdecode_ioctlname(unsigned long _val); const char *sysdecode_ipproto(int _protocol); Modified: head/lib/libsysdecode/sysdecode_enum.3 ============================================================================== --- head/lib/libsysdecode/sysdecode_enum.3 Sat Jun 3 14:15:14 2017 (r319519) +++ head/lib/libsysdecode/sysdecode_enum.3 Sat Jun 3 14:22:15 2017 (r319520) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 2, 2017 +.Dd June 3, 2017 .Dt sysdecode_enum 3 .Os .Sh NAME @@ -36,6 +36,7 @@ .Nm sysdecode_fadvice , .Nm sysdecode_fcntl_cmd , .Nm sysdecode_getfsstat_mode , +.Nm sysdecode_getrusage_who , .Nm sysdecode_idtype , .Nm sysdecode_ipproto , .Nm sysdecode_kldsym_cmd , @@ -89,6 +90,8 @@ .Ft const char * .Fn sysdecode_getfsstat_mode "int mode" .Ft const char * +.Fn sysdecode_getrusage_who "int who" +.Ft const char * .Fn sysdecode_idtype "int idtype" .Ft const char * .Fn sysdecode_ipproto "int protocol" @@ -188,6 +191,7 @@ Most of these functions decode an argument passed to a .It Fn sysdecode_ptrace_request Ta Xr ptrace 2 Ta Fa request .It Fn sysdecode_rlimit Ta Xr getrlimit 2 Ta Fa resource .It Fn sysdecode_rtprio_function Ta Xr rtprio 2 Ta Fa function +.It Fn sysdecode_getrusage_who Ta Xr getrusage 2 Ta Fa who .It Fn sysdecode_scheduler_policy Ta Xr sched_setscheduler 2 Ta Fa policy .It Fn sysdecode_semctl_cmd Ta Xr semctl 2 Ta Fa cmd .It Fn sysdecode_shmctl_cmd Ta Xr shmctl 2 Ta Fa cmd Modified: head/usr.bin/kdump/kdump.c ============================================================================== --- head/usr.bin/kdump/kdump.c Sat Jun 3 14:15:14 2017 (r319519) +++ head/usr.bin/kdump/kdump.c Sat Jun 3 14:22:15 2017 (r319520) @@ -1190,6 +1190,13 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags) narg--; c = ','; break; + case SYS_getrusage: + putchar('('); + print_integer_arg(sysdecode_getrusage_who, *ip); + ip++; + narg--; + c = ','; + break; case SYS_quotactl: print_number(ip, narg, c); putchar(','); Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Sat Jun 3 14:15:14 2017 (r319519) +++ head/usr.bin/truss/syscall.h Sat Jun 3 14:22:15 2017 (r319520) @@ -42,8 +42,8 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHe Quad, Signal, Sockaddr, StringArray, Timespec, Timeval, Itimerval, Pollfd, Fd_set, Sigaction, Fcntl, Mprot, Mmapflags, Whence, Readlinkres, Sigset, Sigprocmask, StatFs, Kevent, Sockdomain, Socktype, Open, - Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2, - Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl, + Fcntlflag, Rusage, RusageWho, BinString, Shutdown, Resource, Rlimit, + Timeval2, Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl, LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long, Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2, CapFcntlRights, Fadvice, FileFlags, Flockop, Getfsstatmode, Kldsymcmd, Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Sat Jun 3 14:15:14 2017 (r319519) +++ head/usr.bin/truss/syscalls.c Sat Jun 3 14:22:15 2017 (r319520) @@ -176,7 +176,7 @@ static struct syscall decoded_syscalls[] = { { .name = "getrlimit", .ret_type = 1, .nargs = 2, .args = { { Resource, 0 }, { Rlimit | OUT, 1 } } }, { .name = "getrusage", .ret_type = 1, .nargs = 2, - .args = { { Int, 0 }, { Rusage | OUT, 1 } } }, + .args = { { RusageWho, 0 }, { Rusage | OUT, 1 } } }, { .name = "getsid", .ret_type = 1, .nargs = 1, .args = { { Int, 0 } } }, { .name = "getsockname", .ret_type = 1, .nargs = 3, @@ -1595,6 +1595,9 @@ print_arg(struct syscall_args *sc, unsigned long *args break; case Resource: print_integer_arg(sysdecode_rlimit, fp, args[sc->offset]); + break; + case RusageWho: + print_integer_arg(sysdecode_getrusage_who, fp, args[sc->offset]); break; case Pathconf: fputs(xlookup(pathconf_arg, args[sc->offset]), fp);