From b9b86b6742ad589e5ad1077c000bfdb2ce9ac198 Mon Sep 17 00:00:00 2001 From: Dmitry Chagin Date: Wed, 22 Jun 2022 14:19:31 +0300 Subject: [PATCH] kdump: Decode getitimer, setitimer which argument Reviewed by: jhb (previous version, without truss) Differential revision: https://reviews.freebsd.org/D35231 MFC after: 2 weeks --- usr.bin/kdump/kdump.c | 8 ++++++++ usr.bin/kdump/linux.c | 16 ++++++++++++++++ usr.bin/truss/syscall.h | 1 + usr.bin/truss/syscalls.c | 13 +++++++++++-- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 5c05a82b53ba..22ac539793fa 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -1529,6 +1529,14 @@ ktrsyscall_freebsd(struct ktr_syscall *ktr, register_t **resip, narg--; c = ','; break; + case SYS_getitimer: + case SYS_setitimer: + putchar('('); + print_integer_arg(sysdecode_itimer, *ip); + ip++; + narg--; + c = ','; + break; } switch (ktr->ktr_code) { case SYS_chflagsat: diff --git a/usr.bin/kdump/linux.c b/usr.bin/kdump/linux.c index ed057a6b8ef6..55b3df912898 100644 --- a/usr.bin/kdump/linux.c +++ b/usr.bin/kdump/linux.c @@ -117,6 +117,14 @@ ktrsyscall_linux(struct ktr_syscall *ktr, register_t **resip, print_number(ip, narg, c); print_number64(first, ip, narg, c); break; + case LINUX_SYS_linux_getitimer: + case LINUX_SYS_linux_setitimer: + putchar('('); + print_integer_arg(sysdecode_itimer, *ip); + ip++; + narg--; + c = ','; + break; } *resc = c; *resip = ip; @@ -183,6 +191,14 @@ ktrsyscall_linux32(struct ktr_syscall *ktr, register_t **resip, print_number(ip, narg, c); print_number64(first, ip, narg, c); break; + case LINUX32_SYS_linux_getitimer: + case LINUX32_SYS_linux_setitimer: + putchar('('); + print_integer_arg(sysdecode_itimer, *ip); + ip++; + narg--; + c = ','; + break; } *resc = c; *resip = ip; diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h index c16aed732230..d30857e8a17b 100644 --- a/usr.bin/truss/syscall.h +++ b/usr.bin/truss/syscall.h @@ -101,6 +101,7 @@ enum Argtype { Getfsstatmode, Idtype, Ioctl, + Itimerwhich, Kldsymcmd, Kldunloadflags, LioMode, diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 0a3f616294af..46a0c5ecc44b 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -296,7 +296,7 @@ static const struct syscall_decode decoded_syscalls[] = { { .name = "getfsstat", .ret_type = 1, .nargs = 3, .args = { { Ptr, 0 }, { Long, 1 }, { Getfsstatmode, 2 } } }, { .name = "getitimer", .ret_type = 1, .nargs = 2, - .args = { { Int, 0 }, { Itimerval | OUT, 2 } } }, + .args = { { Itimerwhich, 0 }, { Itimerval | OUT, 2 } } }, { .name = "getpeername", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } }, { .name = "getpgid", .ret_type = 1, .nargs = 1, @@ -506,7 +506,8 @@ static const struct syscall_decode decoded_syscalls[] = { { Msgflags, 3 }, { Sockaddr | IN, 4 }, { Socklent | IN, 5 } } }, { .name = "setitimer", .ret_type = 1, .nargs = 3, - .args = { { Int, 0 }, { Itimerval, 1 }, { Itimerval | OUT, 2 } } }, + .args = { { Itimerwhich, 0 }, { Itimerval, 1 }, + { Itimerval | OUT, 2 } } }, { .name = "setpriority", .ret_type = 1, .nargs = 3, .args = { { Priowhich, 0 }, { Int, 1 }, { Int, 2 } } }, { .name = "setrlimit", .ret_type = 1, .nargs = 2, @@ -607,6 +608,8 @@ static const struct syscall_decode decoded_syscalls[] = { { .name = "linux_execve", .ret_type = 1, .nargs = 3, .args = { { Name | IN, 0 }, { ExecArgs | IN, 1 }, { ExecEnv | IN, 2 } } }, + { .name = "linux_getitimer", .ret_type = 1, .nargs = 2, + .args = { { Itimerwhich, 0 }, { Itimerval | OUT, 2 } } }, { .name = "linux_lseek", .ret_type = 2, .nargs = 3, .args = { { Int, 0 }, { Int, 1 }, { Whence, 2 } } }, { .name = "linux_mkdir", .ret_type = 1, .nargs = 2, @@ -619,6 +622,9 @@ static const struct syscall_decode decoded_syscalls[] = { .args = { { Name, 0 }, { Hex, 1 }, { Octal, 2 } } }, { .name = "linux_readlink", .ret_type = 1, .nargs = 3, .args = { { Name, 0 }, { Name | OUT, 1 }, { Sizet, 2 } } }, + { .name = "linux_setitimer", .ret_type = 1, .nargs = 3, + .args = { { Itimerwhich, 0 }, { Itimerval, 1 }, + { Itimerval | OUT, 2 } } }, { .name = "linux_socketcall", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { LinuxSockArgs, 1 } } }, { .name = "linux_stat64", .ret_type = 1, .nargs = 2, @@ -2445,6 +2451,9 @@ print_arg(struct syscall_arg *sc, syscallarg_t *args, syscallarg_t *retval, print_integer_arg(sysdecode_getfsstat_mode, fp, args[sc->offset]); break; + case Itimerwhich: + print_integer_arg(sysdecode_itimer, fp, args[sc->offset]); + break; case Kldsymcmd: print_integer_arg(sysdecode_kldsym_cmd, fp, args[sc->offset]); break;