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 <citrin+pr@citrin.ru> MFC after: 1 month
This commit is contained in:
parent
4cbc378c61
commit
ee8aa41dca
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=319520
@ -32,6 +32,7 @@ MLINKS+=sysdecode_enum.3 sysdecode_acltype.3 \
|
|||||||
sysdecode_enum.3 sysdecode_fadvice.3 \
|
sysdecode_enum.3 sysdecode_fadvice.3 \
|
||||||
sysdecode_enum.3 sysdecode_fcntl_cmd.3 \
|
sysdecode_enum.3 sysdecode_fcntl_cmd.3 \
|
||||||
sysdecode_enum.3 sysdecode_getfsstat_mode.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_idtype.3 \
|
||||||
sysdecode_enum.3 sysdecode_ipproto.3 \
|
sysdecode_enum.3 sysdecode_ipproto.3 \
|
||||||
sysdecode_enum.3 sysdecode_kldsym_cmd.3 \
|
sysdecode_enum.3 sysdecode_kldsym_cmd.3 \
|
||||||
|
@ -486,6 +486,13 @@ sysdecode_getfsstat_mode(int mode)
|
|||||||
return (lookup_value(getfsstatmode, mode));
|
return (lookup_value(getfsstatmode, mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
sysdecode_getrusage_who(int who)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (lookup_value(rusage, who));
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
sysdecode_kldsym_cmd(int cmd)
|
sysdecode_kldsym_cmd(int cmd)
|
||||||
{
|
{
|
||||||
|
@ -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 "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 "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 "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 "schedpolicy" "SCHED_[A-Z]+[[:space:]]+[0-9]+" "sched.h"
|
||||||
gen_table "sendfileflags" "SF_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.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"
|
gen_table "shmatflags" "SHM_[A-Z]+[[:space:]]+[0-9]{6}+" "sys/shm.h"
|
||||||
|
@ -55,6 +55,7 @@ bool sysdecode_filemode(FILE *_fp, int _mode, int *_rem);
|
|||||||
bool sysdecode_flock_operation(FILE *_fp, int _operation, int *_rem);
|
bool sysdecode_flock_operation(FILE *_fp, int _operation, int *_rem);
|
||||||
int sysdecode_freebsd_to_abi_errno(enum sysdecode_abi _abi, int _error);
|
int sysdecode_freebsd_to_abi_errno(enum sysdecode_abi _abi, int _error);
|
||||||
const char *sysdecode_getfsstat_mode(int _mode);
|
const char *sysdecode_getfsstat_mode(int _mode);
|
||||||
|
const char *sysdecode_getrusage_who(int _who);
|
||||||
const char *sysdecode_idtype(int _idtype);
|
const char *sysdecode_idtype(int _idtype);
|
||||||
const char *sysdecode_ioctlname(unsigned long _val);
|
const char *sysdecode_ioctlname(unsigned long _val);
|
||||||
const char *sysdecode_ipproto(int _protocol);
|
const char *sysdecode_ipproto(int _protocol);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd January 2, 2017
|
.Dd June 3, 2017
|
||||||
.Dt sysdecode_enum 3
|
.Dt sysdecode_enum 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -36,6 +36,7 @@
|
|||||||
.Nm sysdecode_fadvice ,
|
.Nm sysdecode_fadvice ,
|
||||||
.Nm sysdecode_fcntl_cmd ,
|
.Nm sysdecode_fcntl_cmd ,
|
||||||
.Nm sysdecode_getfsstat_mode ,
|
.Nm sysdecode_getfsstat_mode ,
|
||||||
|
.Nm sysdecode_getrusage_who ,
|
||||||
.Nm sysdecode_idtype ,
|
.Nm sysdecode_idtype ,
|
||||||
.Nm sysdecode_ipproto ,
|
.Nm sysdecode_ipproto ,
|
||||||
.Nm sysdecode_kldsym_cmd ,
|
.Nm sysdecode_kldsym_cmd ,
|
||||||
@ -89,6 +90,8 @@
|
|||||||
.Ft const char *
|
.Ft const char *
|
||||||
.Fn sysdecode_getfsstat_mode "int mode"
|
.Fn sysdecode_getfsstat_mode "int mode"
|
||||||
.Ft const char *
|
.Ft const char *
|
||||||
|
.Fn sysdecode_getrusage_who "int who"
|
||||||
|
.Ft const char *
|
||||||
.Fn sysdecode_idtype "int idtype"
|
.Fn sysdecode_idtype "int idtype"
|
||||||
.Ft const char *
|
.Ft const char *
|
||||||
.Fn sysdecode_ipproto "int protocol"
|
.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_ptrace_request Ta Xr ptrace 2 Ta Fa request
|
||||||
.It Fn sysdecode_rlimit Ta Xr getrlimit 2 Ta Fa resource
|
.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_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_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_semctl_cmd Ta Xr semctl 2 Ta Fa cmd
|
||||||
.It Fn sysdecode_shmctl_cmd Ta Xr shmctl 2 Ta Fa cmd
|
.It Fn sysdecode_shmctl_cmd Ta Xr shmctl 2 Ta Fa cmd
|
||||||
|
@ -1190,6 +1190,13 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags)
|
|||||||
narg--;
|
narg--;
|
||||||
c = ',';
|
c = ',';
|
||||||
break;
|
break;
|
||||||
|
case SYS_getrusage:
|
||||||
|
putchar('(');
|
||||||
|
print_integer_arg(sysdecode_getrusage_who, *ip);
|
||||||
|
ip++;
|
||||||
|
narg--;
|
||||||
|
c = ',';
|
||||||
|
break;
|
||||||
case SYS_quotactl:
|
case SYS_quotactl:
|
||||||
print_number(ip, narg, c);
|
print_number(ip, narg, c);
|
||||||
putchar(',');
|
putchar(',');
|
||||||
|
@ -42,8 +42,8 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHex, Name, Ptr, Stat, Ioctl,
|
|||||||
Quad, Signal, Sockaddr, StringArray, Timespec, Timeval, Itimerval,
|
Quad, Signal, Sockaddr, StringArray, Timespec, Timeval, Itimerval,
|
||||||
Pollfd, Fd_set, Sigaction, Fcntl, Mprot, Mmapflags, Whence, Readlinkres,
|
Pollfd, Fd_set, Sigaction, Fcntl, Mprot, Mmapflags, Whence, Readlinkres,
|
||||||
Sigset, Sigprocmask, StatFs, Kevent, Sockdomain, Socktype, Open,
|
Sigset, Sigprocmask, StatFs, Kevent, Sockdomain, Socktype, Open,
|
||||||
Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2,
|
Fcntlflag, Rusage, RusageWho, BinString, Shutdown, Resource, Rlimit,
|
||||||
Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl,
|
Timeval2, Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl,
|
||||||
LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long,
|
LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long,
|
||||||
Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2,
|
Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2,
|
||||||
CapFcntlRights, Fadvice, FileFlags, Flockop, Getfsstatmode, Kldsymcmd,
|
CapFcntlRights, Fadvice, FileFlags, Flockop, Getfsstatmode, Kldsymcmd,
|
||||||
|
@ -176,7 +176,7 @@ static struct syscall decoded_syscalls[] = {
|
|||||||
{ .name = "getrlimit", .ret_type = 1, .nargs = 2,
|
{ .name = "getrlimit", .ret_type = 1, .nargs = 2,
|
||||||
.args = { { Resource, 0 }, { Rlimit | OUT, 1 } } },
|
.args = { { Resource, 0 }, { Rlimit | OUT, 1 } } },
|
||||||
{ .name = "getrusage", .ret_type = 1, .nargs = 2,
|
{ .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,
|
{ .name = "getsid", .ret_type = 1, .nargs = 1,
|
||||||
.args = { { Int, 0 } } },
|
.args = { { Int, 0 } } },
|
||||||
{ .name = "getsockname", .ret_type = 1, .nargs = 3,
|
{ .name = "getsockname", .ret_type = 1, .nargs = 3,
|
||||||
@ -1596,6 +1596,9 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval,
|
|||||||
case Resource:
|
case Resource:
|
||||||
print_integer_arg(sysdecode_rlimit, fp, args[sc->offset]);
|
print_integer_arg(sysdecode_rlimit, fp, args[sc->offset]);
|
||||||
break;
|
break;
|
||||||
|
case RusageWho:
|
||||||
|
print_integer_arg(sysdecode_getrusage_who, fp, args[sc->offset]);
|
||||||
|
break;
|
||||||
case Pathconf:
|
case Pathconf:
|
||||||
fputs(xlookup(pathconf_arg, args[sc->offset]), fp);
|
fputs(xlookup(pathconf_arg, args[sc->offset]), fp);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user