diff --git a/lib/libsysdecode/Makefile b/lib/libsysdecode/Makefile index ddd7c72ade98..c094a668219f 100644 --- a/lib/libsysdecode/Makefile +++ b/lib/libsysdecode/Makefile @@ -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 \ diff --git a/lib/libsysdecode/flags.c b/lib/libsysdecode/flags.c index ea477b0e239c..bf0319f5dcaf 100644 --- a/lib/libsysdecode/flags.c +++ b/lib/libsysdecode/flags.c @@ -486,6 +486,13 @@ sysdecode_getfsstat_mode(int mode) return (lookup_value(getfsstatmode, mode)); } +const char * +sysdecode_getrusage_who(int who) +{ + + return (lookup_value(rusage, who)); +} + const char * sysdecode_kldsym_cmd(int cmd) { diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables index 317bf341e151..8074d184b7bf 100644 --- a/lib/libsysdecode/mktables +++ b/lib/libsysdecode/mktables @@ -114,6 +114,7 @@ gen_table "quotactlcmds" "Q_[A-Z]+[[:space:]]+0x[0-9]+" "ufs/ 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" diff --git a/lib/libsysdecode/sysdecode.h b/lib/libsysdecode/sysdecode.h index 03c12a5a7f8b..7619fa51736a 100644 --- a/lib/libsysdecode/sysdecode.h +++ b/lib/libsysdecode/sysdecode.h @@ -55,6 +55,7 @@ bool sysdecode_filemode(FILE *_fp, int _mode, int *_rem); 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); diff --git a/lib/libsysdecode/sysdecode_enum.3 b/lib/libsysdecode/sysdecode_enum.3 index 3e2f3902d82f..a1aa3ba51a91 100644 --- a/lib/libsysdecode/sysdecode_enum.3 +++ b/lib/libsysdecode/sysdecode_enum.3 @@ -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 system call: .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 diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 0432449755bb..262396169d6d 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -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(','); diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h index 6c6babb5b241..51f7f67a4bb1 100644 --- a/usr.bin/truss/syscall.h +++ b/usr.bin/truss/syscall.h @@ -42,8 +42,8 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHex, Name, Ptr, Stat, Ioctl, 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, diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index f4195642276d..7a923198024a 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -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, @@ -1596,6 +1596,9 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval, 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); break;