summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libsysdecode/Makefile4
-rw-r--r--lib/libsysdecode/flags.c42
-rw-r--r--lib/libsysdecode/mktables8
-rw-r--r--lib/libsysdecode/sysdecode.h4
-rw-r--r--lib/libsysdecode/sysdecode_enum.314
-rw-r--r--lib/libsysdecode/sysdecode_mask.36
-rw-r--r--usr.bin/kdump/kdump.c57
-rw-r--r--usr.bin/truss/extern.h2
-rw-r--r--usr.bin/truss/setup.c64
-rw-r--r--usr.bin/truss/syscall.h10
-rw-r--r--usr.bin/truss/syscalls.c285
11 files changed, 444 insertions, 52 deletions
diff --git a/lib/libsysdecode/Makefile b/lib/libsysdecode/Makefile
index 687482c3a7df4..32b980d18a901 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 \
@@ -41,6 +42,7 @@ MLINKS+=sysdecode_enum.3 sysdecode_acltype.3 \
sysdecode_enum.3 sysdecode_minherit_flags.3 \
sysdecode_enum.3 sysdecode_msgctl_cmd.3 \
sysdecode_enum.3 sysdecode_nfssvc_flags.3 \
+ sysdecode_enum.3 sysdecode_pathconf_name.3 \
sysdecode_enum.3 sysdecode_prio_which.3 \
sysdecode_enum.3 sysdecode_procctl_cmd.3 \
sysdecode_enum.3 sysdecode_ptrace_request.3 \
@@ -62,11 +64,13 @@ MLINKS+=sysdecode_enum.3 sysdecode_acltype.3 \
sysdecode_enum.3 sysdecode_socketdomain.3 \
sysdecode_enum.3 sysdecode_sockettype.3 \
sysdecode_enum.3 sysdecode_sockopt_level.3 \
+ sysdecode_enum.3 sysdecode_sysarch_number.3 \
sysdecode_enum.3 sysdecode_umtx_op.3 \
sysdecode_enum.3 sysdecode_vmresult.3 \
sysdecode_enum.3 sysdecode_whence.3
MLINKS+=sysdecode_fcntl_arg.3 sysdecode_fcntl_arg_p.3
MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \
+ sysdecode_mask.3 sysdecode_atflags.3 \
sysdecode_mask.3 sysdecode_capfcntlrights.3 \
sysdecode_mask.3 sysdecode_fcntl_fileflags.3 \
sysdecode_mask.3 sysdecode_fileflags.3 \
diff --git a/lib/libsysdecode/flags.c b/lib/libsysdecode/flags.c
index 66169601edc26..31ac33a8391ce 100644
--- a/lib/libsysdecode/flags.c
+++ b/lib/libsysdecode/flags.c
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
#include <sys/stat.h>
#include <sys/thr.h>
#include <sys/umtx.h>
+#include <machine/sysarch.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <netinet/tcp.h>
@@ -250,6 +251,13 @@ sysdecode_atfd(int fd)
return (NULL);
}
+bool
+sysdecode_atflags(FILE *fp, int flag, int *rem)
+{
+
+ return (print_mask_int(fp, atflags, flag, rem));
+}
+
static struct name_table semctlops[] = {
X(GETNCNT) X(GETPID) X(GETVAL) X(GETALL) X(GETZCNT) X(SETVAL) X(SETALL)
X(IPC_RMID) X(IPC_SET) X(IPC_STAT) XEND
@@ -487,6 +495,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)
{
@@ -627,8 +642,19 @@ sysdecode_quotactl_cmd(FILE *fp, int cmd)
bool
sysdecode_reboot_howto(FILE *fp, int howto, int *rem)
{
+ bool printed;
- return (print_mask_int(fp, rebootopt, howto, rem));
+ /*
+ * RB_AUTOBOOT is special in that its value is zero, but it is
+ * also an implied argument if a different operation is not
+ * requested via RB_HALT, RB_POWEROFF, or RB_REROOT.
+ */
+ if (howto != 0 && (howto & (RB_HALT | RB_POWEROFF | RB_REROOT)) == 0) {
+ fputs("RB_AUTOBOOT|", fp);
+ printed = true;
+ } else
+ printed = false;
+ return (print_mask_int(fp, rebootopt, howto, rem) || printed);
}
bool
@@ -930,6 +956,13 @@ sysdecode_mmap_flags(FILE *fp, int flags, int *rem)
}
const char *
+sysdecode_pathconf_name(int name)
+{
+
+ return (lookup_value(pathconfname, name));
+}
+
+const char *
sysdecode_rtprio_function(int function)
{
@@ -970,6 +1003,13 @@ sysdecode_sigcode(int sig, int si_code)
}
}
+const char *
+sysdecode_sysarch_number(int number)
+{
+
+ return (lookup_value(sysarchnum, number));
+}
+
bool
sysdecode_umtx_cvwait_flags(FILE *fp, u_long flags, u_long *rem)
{
diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables
index af9b19cf6bfdc..c43bcab1e90ff 100644
--- a/lib/libsysdecode/mktables
+++ b/lib/libsysdecode/mktables
@@ -91,6 +91,7 @@ _EOF_
gen_table "accessmode" "[A-Z]_OK[[:space:]]+0?x?[0-9A-Fa-f]+" "sys/unistd.h"
gen_table "acltype" "ACL_TYPE_[A-Z4_]+[[:space:]]+0x[0-9]+" "sys/acl.h"
+gen_table "atflags" "AT_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/fcntl.h"
gen_table "capfcntl" "CAP_FCNTL_[A-Z]+[[:space:]]+\(1" "sys/capsicum.h"
gen_table "extattrns" "EXTATTR_NAMESPACE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/extattr.h"
gen_table "fadvisebehav" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h"
@@ -109,6 +110,7 @@ gen_table "filemode" "S_[A-Z]+[[:space:]]+[0-6]{7}" "sys/
gen_table "mountflags" "MNT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mount.h"
gen_table "msyncflags" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h"
gen_table "nfssvcflags" "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+" "nfs/nfssvc.h"
+gen_table "pathconfname" "_PC_[A-Z4_]+[[:space:]]+[0-9]+" "sys/unistd.h"
gen_table "prio" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h"
gen_table "procctlcmd" "PROC_[A-Z_]+[[:space:]]+[0-9]" "sys/procctl.h" "PROC_TRACE_CTL_"
gen_table "ptraceop" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h"
@@ -116,6 +118,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"
@@ -152,6 +155,11 @@ gen_table "sigcode" "SI_[A-Z]+[[:space:]]+0(x[0-9abcdef]+)?" "sys/
gen_table "umtxcvwaitflags" "CVWAIT_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/umtx.h"
gen_table "umtxrwlockflags" "URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+" "sys/umtx.h"
gen_table "caprights" "CAP_[A-Z_]+[[:space:]]+CAPRIGHT\([0-9],[[:space:]]+0x[0-9]{16}ULL\)" "sys/capsicum.h"
+if [ -e "${include_dir}/x86/sysarch.h" ]; then
+ gen_table "sysarchnum" "(AMD64|I386)_[A-Z86_]+[[:space:]]+[0-9]+" "x86/sysarch.h"
+else
+ gen_table "sysarchnum" "[A-Z_]+[[:space:]]+[0-9]+" "machine/sysarch.h"
+fi
# Generate a .depend file for our output file
if [ -n "$output_file" ]; then
diff --git a/lib/libsysdecode/sysdecode.h b/lib/libsysdecode/sysdecode.h
index 03c12a5a7f8bf..ea6cd341349d3 100644
--- a/lib/libsysdecode/sysdecode.h
+++ b/lib/libsysdecode/sysdecode.h
@@ -42,6 +42,7 @@ int sysdecode_abi_to_freebsd_errno(enum sysdecode_abi _abi, int _error);
bool sysdecode_access_mode(FILE *_fp, int _mode, int *_rem);
const char *sysdecode_acltype(int _type);
const char *sysdecode_atfd(int _fd);
+bool sysdecode_atflags(FILE *_fp, int _flags, int *_rem);
bool sysdecode_cap_fcntlrights(FILE *_fp, uint32_t _rights, uint32_t *_rem);
void sysdecode_cap_rights(FILE *_fp, cap_rights_t *_rightsp);
const char *sysdecode_extattrnamespace(int _namespace);
@@ -55,6 +56,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);
@@ -72,6 +74,7 @@ bool sysdecode_msg_flags(FILE *_fp, int _flags, int *_rem);
bool sysdecode_msync_flags(FILE *_fp, int _flags, int *_rem);
const char *sysdecode_nfssvc_flags(int _flags);
bool sysdecode_open_flags(FILE *_fp, int _flags, int *_rem);
+const char *sysdecode_pathconf_name(int _name);
bool sysdecode_pipe2_flags(FILE *_fp, int _flags, int *_rem);
const char *sysdecode_prio_which(int _which);
const char *sysdecode_procctl_cmd(int _cmd);
@@ -104,6 +107,7 @@ bool sysdecode_socket_type(FILE *_fp, int _type, int *_rem);
const char *sysdecode_sockopt_level(int _level);
const char *sysdecode_sockopt_name(int _level, int _optname);
const char *sysdecode_syscallname(enum sysdecode_abi _abi, unsigned int _code);
+const char *sysdecode_sysarch_number(int _number);
bool sysdecode_thr_create_flags(FILE *_fp, int _flags, int *_rem);
bool sysdecode_umtx_cvwait_flags(FILE *_fp, u_long _flags, u_long *_rem);
const char *sysdecode_umtx_op(int _op);
diff --git a/lib/libsysdecode/sysdecode_enum.3 b/lib/libsysdecode/sysdecode_enum.3
index 3e2f3902d82fc..be646ed07e3ac 100644
--- a/lib/libsysdecode/sysdecode_enum.3
+++ b/lib/libsysdecode/sysdecode_enum.3
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 2, 2017
+.Dd September 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 ,
@@ -45,6 +46,7 @@
.Nm sysdecode_minherit_flags ,
.Nm sysdecode_msgctl_cmd ,
.Nm sysdecode_nfssvc_flags ,
+.Nm sysdecode_pathconf_name ,
.Nm sysdecode_prio_which ,
.Nm sysdecode_procctl_cmd ,
.Nm sysdecode_ptrace_request ,
@@ -66,6 +68,7 @@
.Nm sysdecode_socketdomain ,
.Nm sysdecode_sockettype ,
.Nm sysdecode_sockopt_level ,
+.Nm sysdecode_sysarch_number ,
.Nm sysdecode_umtx_op ,
.Nm sysdecode_vmresult ,
.Nm sysdecode_whence
@@ -89,6 +92,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"
@@ -107,6 +112,8 @@
.Ft const char *
.Fn sysdecode_nfssvc_flags "int flags"
.Ft const char *
+.Fn sysdecode_pathconf_name "int name"
+.Ft const char *
.Fn sysdecode_prio_which "int which"
.Ft const char *
.Fn sysdecode_procctl_cmd "int cmd"
@@ -149,6 +156,8 @@
.Ft const char *
.Fn sysdecode_sockopt_level "int level"
.Ft const char *
+.Fn sysdecode_sysarch_number "int number"
+.Ft const char *
.Fn sysdecode_umtx_op "int op"
.Ft const char *
.Fn sysdecode_vmresult "int result"
@@ -183,17 +192,20 @@ Most of these functions decode an argument passed to a system call:
.It Fn sysdecode_minherit_inherit Ta Xr minherit 2 Ta Fa inherit
.It Fn sysdecode_msgctl_cmd Ta Xr msgctl 2 Ta Fa cmd
.It Fn sysdecode_nfssvc_flags Ta Xr nfssvc 2 Ta Fa flags
+.It Fn sysdecode_pathconf_name Ta Xr pathconf 2 Ta Fa name
.It Fn sysdecode_prio_which Ta Xr getpriority 2 Ta Fa which
.It Fn sysdecode_procctl_cmd Ta Xr procctl 2 Ta Fa cmd
.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
.It Fn sysdecode_shutdown_how Ta Xr shutdown 2 Ta Fa how
.It Fn sysdecode_sigprocmask_how Ta Xr sigprocmask 2 Ta Fa how
.It Fn sysdecode_sockopt_level Ta Xr getsockopt 2 Ta Fa level
+.It Fn sysdecode_sysarch_number Ta Xr sysarch 2 Ta Fa number
.It Fn sysdecode_umtx_op Ta Xr _umtx_op 2 Ta Fa op
.It Fn sysdecode_whence Ta Xr lseek 2 Ta Fa whence
.El
diff --git a/lib/libsysdecode/sysdecode_mask.3 b/lib/libsysdecode/sysdecode_mask.3
index 5ab007b1568a0..0708938db1637 100644
--- a/lib/libsysdecode/sysdecode_mask.3
+++ b/lib/libsysdecode/sysdecode_mask.3
@@ -25,12 +25,13 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 2, 2017
+.Dd September 3, 2017
.Dt sysdecode_mask 3
.Os
.Sh NAME
.Nm sysdecode_mask ,
.Nm sysdecode_accessmode ,
+.Nm sysdecode_atflags ,
.Nm sysdecode_capfcntlrights ,
.Nm sysdecode_fcntl_fileflags ,
.Nm sysdecode_fileflags ,
@@ -66,6 +67,8 @@
.Ft bool
.Fn sysdecode_access_mode "FILE *fp" "int mode" "int *rem"
.Ft bool
+.Fn sysdecode_atflags "FILE *fp" "int flags" "int *rem"
+.Ft bool
.Fn sysdecode_cap_fcntlrights "FILE *fp" "uint32_t rights" "uint32_t *rem"
.Ft bool
.Fn sysdecode_fcntl_fileflags "FILE *fp" "int flags" "int *rem"
@@ -148,6 +151,7 @@ Most of these functions decode an argument passed to a system call:
.Bl -column "Fn sysdecode_flock_operation" "Xr cap_fcntls_limit 2"
.It Sy Function Ta Sy System Call Ta Sy Argument
.It Fn sysdecode_access_mode Ta Xr access 2 Ta Fa mode
+.It Fn sysdecode_atflags Ta Xr chflagsat 2 , Xr fstatat 2 Ta Fa atflag , Fa flag
.It Fn sysdecode_cap_fcntlrights Ta Xr cap_fcntls_limit 2 Ta Fa fcntlrights
.It Fn sysdecode_fileflags Ta Xr chflags 2 Ta Fa flags
.It Fn sysdecode_filemode Ta Xr chmod 2 , Xr open 2 Ta mode
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index 9c6d2bb91f148..d849d94e7d613 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -1097,11 +1097,20 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags)
ip++;
narg--;
break;
- case SYS_setpriority:
- print_number(ip, narg, c);
+ case SYS_pathconf:
+ case SYS_lpathconf:
+ case SYS_fpathconf:
print_number(ip, narg, c);
putchar(',');
+ print_integer_arg(sysdecode_pathconf_name, *ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_getpriority:
+ case SYS_setpriority:
+ putchar('(');
print_integer_arg(sysdecode_prio_which, *ip);
+ c = ',';
ip++;
narg--;
break;
@@ -1227,6 +1236,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(',');
@@ -1249,6 +1265,7 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags)
c = ',';
break;
case SYS_rtprio:
+ case SYS_rtprio_thread:
putchar('(');
print_integer_arg(sysdecode_rtprio_function,
*ip);
@@ -1448,6 +1465,7 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags)
print_integer_arg_valid(sysdecode_atfd, *ip);
ip++;
narg--;
+ print_number(ip, narg, c);
break;
case SYS_cap_fcntls_limit:
print_number(ip, narg, c);
@@ -1506,6 +1524,41 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags)
print_number(ip, narg, c);
print_number64(first, ip, narg, c);
break;
+ case SYS_fchownat:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ break;
+ case SYS_fstatat:
+ case SYS_utimensat:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ break;
+ case SYS_unlinkat:
+ print_number(ip, narg, c);
+ break;
+ case SYS_sysarch:
+ putchar('(');
+ print_integer_arg(sysdecode_sysarch_number, *ip);
+ ip++;
+ narg--;
+ c = ',';
+ break;
+ }
+ switch (ktr->ktr_code) {
+ case SYS_chflagsat:
+ case SYS_fchownat:
+ case SYS_faccessat:
+ case SYS_fchmodat:
+ case SYS_fstatat:
+ case SYS_linkat:
+ case SYS_unlinkat:
+ case SYS_utimensat:
+ putchar(',');
+ print_mask_arg0(sysdecode_atflags, *ip);
+ ip++;
+ narg--;
+ break;
}
}
while (narg > 0) {
diff --git a/usr.bin/truss/extern.h b/usr.bin/truss/extern.h
index 2cdd9c5f964c8..f19a1cbb7c92b 100644
--- a/usr.bin/truss/extern.h
+++ b/usr.bin/truss/extern.h
@@ -35,5 +35,5 @@ extern int print_line_prefix(struct trussinfo *);
extern void setup_and_wait(struct trussinfo *, char **);
extern void start_tracing(struct trussinfo *, pid_t);
extern void restore_proc(int);
+extern void decode_siginfo(FILE *, siginfo_t *);
extern void eventloop(struct trussinfo *);
-extern const char *ioctlname(unsigned long val);
diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c
index 24e028a981865..97dd9650189bf 100644
--- a/usr.bin/truss/setup.c
+++ b/usr.bin/truss/setup.c
@@ -584,8 +584,62 @@ report_new_child(struct trussinfo *info)
fprintf(info->outfile, "<new process>\n");
}
+void
+decode_siginfo(FILE *fp, siginfo_t *si)
+{
+ const char *str;
+
+ fprintf(fp, " code=");
+ str = sysdecode_sigcode(si->si_signo, si->si_code);
+ if (str == NULL)
+ fprintf(fp, "%d", si->si_code);
+ else
+ fprintf(fp, "%s", str);
+ switch (si->si_code) {
+ case SI_NOINFO:
+ break;
+ case SI_QUEUE:
+ fprintf(fp, " value=%p", si->si_value.sival_ptr);
+ /* FALLTHROUGH */
+ case SI_USER:
+ case SI_LWP:
+ fprintf(fp, " pid=%jd uid=%jd", (intmax_t)si->si_pid,
+ (intmax_t)si->si_uid);
+ break;
+ case SI_TIMER:
+ fprintf(fp, " value=%p", si->si_value.sival_ptr);
+ fprintf(fp, " timerid=%d", si->si_timerid);
+ fprintf(fp, " overrun=%d", si->si_overrun);
+ if (si->si_errno != 0)
+ fprintf(fp, " errno=%d", si->si_errno);
+ break;
+ case SI_ASYNCIO:
+ fprintf(fp, " value=%p", si->si_value.sival_ptr);
+ break;
+ case SI_MESGQ:
+ fprintf(fp, " value=%p", si->si_value.sival_ptr);
+ fprintf(fp, " mqd=%d", si->si_mqd);
+ break;
+ default:
+ switch (si->si_signo) {
+ case SIGILL:
+ case SIGFPE:
+ case SIGSEGV:
+ case SIGBUS:
+ fprintf(fp, " trapno=%d", si->si_trapno);
+ fprintf(fp, " addr=%p", si->si_addr);
+ break;
+ case SIGCHLD:
+ fprintf(fp, " pid=%jd uid=%jd", (intmax_t)si->si_pid,
+ (intmax_t)si->si_uid);
+ fprintf(fp, " status=%d", si->si_status);
+ break;
+ }
+ }
+}
+
static void
-report_signal(struct trussinfo *info, siginfo_t *si)
+report_signal(struct trussinfo *info, siginfo_t *si, struct ptrace_lwpinfo *pl)
{
struct threadinfo *t;
const char *signame;
@@ -596,7 +650,11 @@ report_signal(struct trussinfo *info, siginfo_t *si)
signame = sysdecode_signal(si->si_status);
if (signame == NULL)
signame = "?";
- fprintf(info->outfile, "SIGNAL %u (%s)\n", si->si_status, signame);
+ fprintf(info->outfile, "SIGNAL %u (%s)", si->si_status, signame);
+ if (pl->pl_event == PL_EVENT_SIGNAL && pl->pl_flags & PL_FLAG_SI)
+ decode_siginfo(info->outfile, &pl->pl_siginfo);
+ fprintf(info->outfile, "\n");
+
}
/*
@@ -673,7 +731,7 @@ eventloop(struct trussinfo *info)
pending_signal = 0;
} else {
if ((info->flags & NOSIGS) == 0)
- report_signal(info, &si);
+ report_signal(info, &si, &pl);
pending_signal = si.si_status;
}
ptrace(PT_SYSCALL, si.si_pid, (caddr_t)1,
diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h
index 46bef46b2308a..9a5bdec84fdbd 100644
--- a/usr.bin/truss/syscall.h
+++ b/usr.bin/truss/syscall.h
@@ -28,6 +28,7 @@
* Kevent -- a pointer to an array of struct kevents. Prints all elements.
* Pathconf -- the 2nd argument of pathconf().
* Utrace -- utrace(2) buffer.
+ * CapRights -- a pointer to a cap_rights_t. Prints all set capabilities.
*
* In addition, the pointer types (String, Ptr) may have OUT masked in --
* this means that the data is set on *return* from the system call -- or
@@ -41,13 +42,16 @@ 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,
Kldunloadflags, Sizet, Madvice, Socklent, Sockprotocol, Sockoptlevel,
- Sockoptname, Msgflags,
+ Sockoptname, Msgflags, CapRights, PUInt, PQuadHex, Acltype,
+ Extattrnamespace, Minherit, Mlockall, Mountflags, Msync, Priowhich,
+ Ptraceop, Quotactlcmd, Reboothowto, Rtpriofunc, Schedpolicy, Schedparam,
+ PSig, Siginfo,
CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags,
CloudABIFDStat, CloudABIFileStat, CloudABIFileType,
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index dbe9fca7f1710..c717db12df699 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
* arguments.
*/
+#include <sys/capsicum.h>
#include <sys/types.h>
#include <sys/event.h>
#include <sys/ioccom.h>
@@ -47,7 +48,6 @@ __FBSDID("$FreeBSD$");
#include <sys/stat.h>
#include <sys/un.h>
#include <sys/wait.h>
-#include <machine/sysarch.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <fcntl.h>
#include <poll.h>
+#include <sched.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
@@ -76,6 +77,32 @@ __FBSDID("$FreeBSD$");
*/
static struct syscall decoded_syscalls[] = {
/* Native ABI */
+ { .name = "__acl_aclcheck_fd", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Acltype, 1 }, { Ptr, 2 } } },
+ { .name = "__acl_aclcheck_file", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Acltype, 1 }, { Ptr, 2 } } },
+ { .name = "__acl_aclcheck_link", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Acltype, 1 }, { Ptr, 2 } } },
+ { .name = "__acl_delete_fd", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Acltype, 1 } } },
+ { .name = "__acl_delete_file", .ret_type = 1, .nargs = 2,
+ .args = { { Name, 0 }, { Acltype, 1 } } },
+ { .name = "__acl_delete_link", .ret_type = 1, .nargs = 2,
+ .args = { { Name, 0 }, { Acltype, 1 } } },
+ { .name = "__acl_get_fd", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Acltype, 1 }, { Ptr, 2 } } },
+ { .name = "__acl_get_file", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Acltype, 1 }, { Ptr, 2 } } },
+ { .name = "__acl_get_link", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Acltype, 1 }, { Ptr, 2 } } },
+ { .name = "__acl_set_fd", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Acltype, 1 }, { Ptr, 2 } } },
+ { .name = "__acl_set_file", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Acltype, 1 }, { Ptr, 2 } } },
+ { .name = "__acl_set_link", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Acltype, 1 }, { Ptr, 2 } } },
+ { .name = "__cap_rights_get", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Int, 1 }, { CapRights | OUT, 2 } } },
{ .name = "__getcwd", .ret_type = 1, .nargs = 2,
.args = { { Name | OUT, 0 }, { Int, 1 } } },
{ .name = "_umtx_op", .ret_type = 1, .nargs = 5,
@@ -96,6 +123,10 @@ static struct syscall decoded_syscalls[] = {
.args = { { Int, 0 }, { CapFcntlRights | OUT, 1 } } },
{ .name = "cap_fcntls_limit", .ret_type = 1, .nargs = 2,
.args = { { Int, 0 }, { CapFcntlRights, 1 } } },
+ { .name = "cap_getmode", .ret_type = 1, .nargs = 1,
+ .args = { { PUInt | OUT, 0 } } },
+ { .name = "cap_rights_limit", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { CapRights, 1 } } },
{ .name = "chdir", .ret_type = 1, .nargs = 1,
.args = { { Name, 0 } } },
{ .name = "chflags", .ret_type = 1, .nargs = 2,
@@ -118,6 +149,10 @@ static struct syscall decoded_syscalls[] = {
{ .name = "connectat", .ret_type = 1, .nargs = 4,
.args = { { Atfd, 0 }, { Int, 1 }, { Sockaddr | IN, 2 },
{ Int, 3 } } },
+ { .name = "dup", .ret_type = 1, .nargs = 1,
+ .args = { { Int, 0 } } },
+ { .name = "dup2", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Int, 1 } } },
{ .name = "eaccess", .ret_type = 1, .nargs = 2,
.args = { { Name | IN, 0 }, { Accessmode, 1 } } },
{ .name = "execve", .ret_type = 1, .nargs = 3,
@@ -125,6 +160,42 @@ static struct syscall decoded_syscalls[] = {
{ ExecEnv | IN, 2 } } },
{ .name = "exit", .ret_type = 0, .nargs = 1,
.args = { { Hex, 0 } } },
+ { .name = "extattr_delete_fd", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Extattrnamespace, 1 }, { Name, 2 } } },
+ { .name = "extattr_delete_file", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Extattrnamespace, 1 }, { Name, 2 } } },
+ { .name = "extattr_delete_link", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Extattrnamespace, 1 }, { Name, 2 } } },
+ { .name = "extattr_get_fd", .ret_type = 1, .nargs = 5,
+ .args = { { Int, 0 }, { Extattrnamespace, 1 }, { Name, 2 },
+ { BinString | OUT, 3 }, { Sizet, 4 } } },
+ { .name = "extattr_get_file", .ret_type = 1, .nargs = 5,
+ .args = { { Name, 0 }, { Extattrnamespace, 1 }, { Name, 2 },
+ { BinString | OUT, 3 }, { Sizet, 4 } } },
+ { .name = "extattr_get_link", .ret_type = 1, .nargs = 5,
+ .args = { { Name, 0 }, { Extattrnamespace, 1 }, { Name, 2 },
+ { BinString | OUT, 3 }, { Sizet, 4 } } },
+ { .name = "extattr_list_fd", .ret_type = 1, .nargs = 4,
+ .args = { { Int, 0 }, { Extattrnamespace, 1 }, { BinString | OUT, 2 },
+ { Sizet, 3 } } },
+ { .name = "extattr_list_file", .ret_type = 1, .nargs = 4,
+ .args = { { Name, 0 }, { Extattrnamespace, 1 }, { BinString | OUT, 2 },
+ { Sizet, 3 } } },
+ { .name = "extattr_list_link", .ret_type = 1, .nargs = 4,
+ .args = { { Name, 0 }, { Extattrnamespace, 1 }, { BinString | OUT, 2 },
+ { Sizet, 3 } } },
+ { .name = "extattr_set_fd", .ret_type = 1, .nargs = 5,
+ .args = { { Int, 0 }, { Extattrnamespace, 1 }, { Name, 2 },
+ { BinString | IN, 3 }, { Sizet, 4 } } },
+ { .name = "extattr_set_file", .ret_type = 1, .nargs = 5,
+ .args = { { Name, 0 }, { Extattrnamespace, 1 }, { Name, 2 },
+ { BinString | IN, 3 }, { Sizet, 4 } } },
+ { .name = "extattr_set_link", .ret_type = 1, .nargs = 5,
+ .args = { { Name, 0 }, { Extattrnamespace, 1 }, { Name, 2 },
+ { BinString | IN, 3 }, { Sizet, 4 } } },
+ { .name = "extattrctl", .ret_type = 1, .nargs = 5,
+ .args = { { Name, 0 }, { Hex, 1 }, { Name, 2 },
+ { Extattrnamespace, 3 }, { Name, 4 } } },
{ .name = "faccessat", .ret_type = 1, .nargs = 4,
.args = { { Atfd, 0 }, { Name | IN, 1 }, { Accessmode, 2 },
{ Atflags, 3 } } },
@@ -158,6 +229,9 @@ static struct syscall decoded_syscalls[] = {
.args = { { Int, 0 }, { Timeval2 | IN, 1 } } },
{ .name = "futimesat", .ret_type = 1, .nargs = 3,
.args = { { Atfd, 0 }, { Name | IN, 1 }, { Timeval2 | IN, 2 } } },
+ { .name = "getdirentries", .ret_type = 1, .nargs = 4,
+ .args = { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 },
+ { PQuadHex | OUT, 3 } } },
{ .name = "getfsstat", .ret_type = 1, .nargs = 3,
.args = { { Ptr, 0 }, { Long, 1 }, { Getfsstatmode, 2 } } },
{ .name = "getitimer", .ret_type = 1, .nargs = 2,
@@ -166,10 +240,12 @@ static struct syscall decoded_syscalls[] = {
.args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } },
{ .name = "getpgid", .ret_type = 1, .nargs = 1,
.args = { { Int, 0 } } },
+ { .name = "getpriority", .ret_type = 1, .nargs = 2,
+ .args = { { Priowhich, 0 }, { Int, 1 } } },
{ .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,
@@ -225,6 +301,8 @@ static struct syscall decoded_syscalls[] = {
.args = { { Name | IN, 0 }, { Timeval2 | IN, 1 } } },
{ .name = "madvise", .ret_type = 1, .nargs = 3,
.args = { { Ptr, 0 }, { Sizet, 1 }, { Madvice, 2 } } },
+ { .name = "minherit", .ret_type = 1, .nargs = 3,
+ .args = { { Ptr, 0 }, { Sizet, 1 }, { Minherit, 2 } } },
{ .name = "mkdir", .ret_type = 1, .nargs = 2,
.args = { { Name, 0 }, { Octal, 1 } } },
{ .name = "mkdirat", .ret_type = 1, .nargs = 3,
@@ -237,19 +315,29 @@ static struct syscall decoded_syscalls[] = {
.args = { { Name, 0 }, { Octal, 1 }, { Int, 2 } } },
{ .name = "mknodat", .ret_type = 1, .nargs = 4,
.args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 }, { Int, 3 } } },
+ { .name = "mlock", .ret_type = 1, .nargs = 2,
+ .args = { { Ptr, 0 }, { Sizet, 1 } } },
+ { .name = "mlockall", .ret_type = 1, .nargs = 1,
+ .args = { { Mlockall, 0 } } },
{ .name = "mmap", .ret_type = 1, .nargs = 6,
.args = { { Ptr, 0 }, { Sizet, 1 }, { Mprot, 2 }, { Mmapflags, 3 },
{ Int, 4 }, { QuadHex, 5 } } },
{ .name = "modfind", .ret_type = 1, .nargs = 1,
.args = { { Name | IN, 0 } } },
{ .name = "mount", .ret_type = 1, .nargs = 4,
- .args = { { Name, 0 }, { Name, 1 }, { Int, 2 }, { Ptr, 3 } } },
+ .args = { { Name, 0 }, { Name, 1 }, { Mountflags, 2 }, { Ptr, 3 } } },
{ .name = "mprotect", .ret_type = 1, .nargs = 3,
.args = { { Ptr, 0 }, { Sizet, 1 }, { Mprot, 2 } } },
+ { .name = "msync", .ret_type = 1, .nargs = 3,
+ .args = { { Ptr, 0 }, { Sizet, 1 }, { Msync, 2 } } },
+ { .name = "munlock", .ret_type = 1, .nargs = 2,
+ .args = { { Ptr, 0 }, { Sizet, 1 } } },
{ .name = "munmap", .ret_type = 1, .nargs = 2,
.args = { { Ptr, 0 }, { Sizet, 1 } } },
{ .name = "nanosleep", .ret_type = 1, .nargs = 1,
.args = { { Timespec, 0 } } },
+ { .name = "nmount", .ret_type = 1, .nargs = 3,
+ .args = { { Ptr, 0 }, { UInt, 1 }, { Mountflags, 2 } } },
{ .name = "open", .ret_type = 1, .nargs = 3,
.args = { { Name | IN, 0 }, { Open, 1 }, { Octal, 2 } } },
{ .name = "openat", .ret_type = 1, .nargs = 4,
@@ -268,8 +356,18 @@ static struct syscall decoded_syscalls[] = {
{ Fadvice, 3 } } },
{ .name = "posix_openpt", .ret_type = 1, .nargs = 1,
.args = { { Open, 0 } } },
+ { .name = "pread", .ret_type = 1, .nargs = 4,
+ .args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 },
+ { QuadHex, 3 } } },
{ .name = "procctl", .ret_type = 1, .nargs = 4,
.args = { { Idtype, 0 }, { Quad, 1 }, { Procctl, 2 }, { Ptr, 3 } } },
+ { .name = "ptrace", .ret_type = 1, .nargs = 4,
+ .args = { { Ptraceop, 0 }, { Int, 1 }, { Ptr, 2 }, { Int, 3 } } },
+ { .name = "pwrite", .ret_type = 1, .nargs = 4,
+ .args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 },
+ { QuadHex, 3 } } },
+ { .name = "quotactl", .ret_type = 1, .nargs = 4,
+ .args = { { Name, 0 }, { Quotactlcmd, 1 }, { Int, 2 }, { Ptr, 3 } } },
{ .name = "read", .ret_type = 1, .nargs = 3,
.args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 } } },
{ .name = "readlink", .ret_type = 1, .nargs = 3,
@@ -277,6 +375,8 @@ static struct syscall decoded_syscalls[] = {
{ .name = "readlinkat", .ret_type = 1, .nargs = 4,
.args = { { Atfd, 0 }, { Name, 1 }, { Readlinkres | OUT, 2 },
{ Sizet, 3 } } },
+ { .name = "reboot", .ret_type = 1, .nargs = 1,
+ .args = { { Reboothowto, 0 } } },
{ .name = "recvfrom", .ret_type = 1, .nargs = 6,
.args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 },
{ Msgflags, 3 }, { Sockaddr | OUT, 4 },
@@ -291,6 +391,24 @@ static struct syscall decoded_syscalls[] = {
.args = { { Rforkflags, 0 } } },
{ .name = "rmdir", .ret_type = 1, .nargs = 1,
.args = { { Name, 0 } } },
+ { .name = "rtprio", .ret_type = 1, .nargs = 3,
+ .args = { { Rtpriofunc, 0 }, { Int, 1 }, { Ptr, 2 } } },
+ { .name = "rtprio_thread", .ret_type = 1, .nargs = 3,
+ .args = { { Rtpriofunc, 0 }, { Int, 1 }, { Ptr, 2 } } },
+ { .name = "sched_get_priority_max", .ret_type = 1, .nargs = 1,
+ .args = { { Schedpolicy, 0 } } },
+ { .name = "sched_get_priority_min", .ret_type = 1, .nargs = 1,
+ .args = { { Schedpolicy, 0 } } },
+ { .name = "sched_getparam", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Schedparam | OUT, 1 } } },
+ { .name = "sched_getscheduler", .ret_type = 1, .nargs = 1,
+ .args = { { Int, 0 } } },
+ { .name = "sched_rr_get_interval", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Timespec | OUT, 1 } } },
+ { .name = "sched_setparam", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Schedparam, 1 } } },
+ { .name = "sched_setscheduler", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Schedpolicy, 1 }, { Schedparam, 2 } } },
{ .name = "sctp_generic_recvmsg", .ret_type = 1, .nargs = 7,
.args = { { Int, 0 }, { Ptr | IN, 1 }, { Int, 2 },
{ Sockaddr | OUT, 3 }, { Ptr | OUT, 4 }, { Ptr | OUT, 5 },
@@ -310,6 +428,8 @@ static struct syscall decoded_syscalls[] = {
{ Socklent | IN, 5 } } },
{ .name = "setitimer", .ret_type = 1, .nargs = 3,
.args = { { Int, 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,
.args = { { Resource, 0 }, { Rlimit | IN, 1 } } },
{ .name = "setsockopt", .ret_type = 1, .nargs = 5,
@@ -331,11 +451,12 @@ static struct syscall decoded_syscalls[] = {
{ .name = "sigsuspend", .ret_type = 1, .nargs = 1,
.args = { { Sigset | IN, 0 } } },
{ .name = "sigtimedwait", .ret_type = 1, .nargs = 3,
- .args = { { Sigset | IN, 0 }, { Ptr, 1 }, { Timespec | IN, 2 } } },
+ .args = { { Sigset | IN, 0 }, { Siginfo | OUT, 1 },
+ { Timespec | IN, 2 } } },
{ .name = "sigwait", .ret_type = 1, .nargs = 2,
- .args = { { Sigset | IN, 0 }, { Ptr, 1 } } },
+ .args = { { Sigset | IN, 0 }, { PSig | OUT, 1 } } },
{ .name = "sigwaitinfo", .ret_type = 1, .nargs = 2,
- .args = { { Sigset | IN, 0 }, { Ptr, 1 } } },
+ .args = { { Sigset | IN, 0 }, { Siginfo | OUT, 1 } } },
{ .name = "socket", .ret_type = 1, .nargs = 3,
.args = { { Sockdomain, 0 }, { Socktype, 1 }, { Sockprotocol, 2 } } },
{ .name = "stat", .ret_type = 1, .nargs = 2,
@@ -352,6 +473,8 @@ static struct syscall decoded_syscalls[] = {
.args = { { Long, 0 }, { Signal, 1 } } },
{ .name = "thr_self", .ret_type = 1, .nargs = 1,
.args = { { Ptr, 0 } } },
+ { .name = "thr_set_name", .ret_type = 1, .nargs = 2,
+ .args = { { Long, 0 }, { Name, 1 } } },
{ .name = "truncate", .ret_type = 1, .nargs = 2,
.args = { { Name | IN, 0 }, { QuadHex | IN, 1 } } },
#if 0
@@ -364,7 +487,7 @@ static struct syscall decoded_syscalls[] = {
{ .name = "unlinkat", .ret_type = 1, .nargs = 3,
.args = { { Atfd, 0 }, { Name, 1 }, { Atflags, 2 } } },
{ .name = "unmount", .ret_type = 1, .nargs = 2,
- .args = { { Name, 0 }, { Int, 1 } } },
+ .args = { { Name, 0 }, { Mountflags, 1 } } },
{ .name = "utimensat", .ret_type = 1, .nargs = 4,
.args = { { Atfd, 0 }, { Name | IN, 1 }, { Timespec2 | IN, 2 },
{ Atflags, 3 } } },
@@ -377,7 +500,8 @@ static struct syscall decoded_syscalls[] = {
{ Rusage | OUT, 3 } } },
{ .name = "wait6", .ret_type = 1, .nargs = 6,
.args = { { Idtype, 0 }, { Quad, 1 }, { ExitStatus | OUT, 2 },
- { Waitoptions, 3 }, { Rusage | OUT, 4 }, { Ptr, 5 } } },
+ { Waitoptions, 3 }, { Rusage | OUT, 4 },
+ { Siginfo | OUT, 5 } } },
{ .name = "write", .ret_type = 1, .nargs = 3,
.args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 } } },
@@ -562,35 +686,6 @@ static struct xlat sigaction_flags[] = {
X(SA_NODEFER) X(SA_NOCLDWAIT) X(SA_SIGINFO) XEND
};
-static struct xlat pathconf_arg[] = {
- X(_PC_LINK_MAX) X(_PC_MAX_CANON) X(_PC_MAX_INPUT)
- X(_PC_NAME_MAX) X(_PC_PATH_MAX) X(_PC_PIPE_BUF)
- X(_PC_CHOWN_RESTRICTED) X(_PC_NO_TRUNC) X(_PC_VDISABLE)
- X(_PC_ASYNC_IO) X(_PC_PRIO_IO) X(_PC_SYNC_IO)
- X(_PC_ALLOC_SIZE_MIN) X(_PC_FILESIZEBITS)
- X(_PC_REC_INCR_XFER_SIZE) X(_PC_REC_MAX_XFER_SIZE)
- X(_PC_REC_MIN_XFER_SIZE) X(_PC_REC_XFER_ALIGN)
- X(_PC_SYMLINK_MAX) X(_PC_ACL_EXTENDED) X(_PC_ACL_PATH_MAX)
- X(_PC_CAP_PRESENT) X(_PC_INF_PRESENT) X(_PC_MAC_PRESENT)
- X(_PC_ACL_NFS4) X(_PC_MIN_HOLE_SIZE) XEND
-};
-
-static struct xlat at_flags[] = {
- X(AT_EACCESS) X(AT_SYMLINK_NOFOLLOW) X(AT_SYMLINK_FOLLOW)
- X(AT_REMOVEDIR) XEND
-};
-
-static struct xlat sysarch_ops[] = {
-#if defined(__i386__) || defined(__amd64__)
- X(I386_GET_LDT) X(I386_SET_LDT) X(I386_GET_IOPERM) X(I386_SET_IOPERM)
- X(I386_VM86) X(I386_GET_FSBASE) X(I386_SET_FSBASE) X(I386_GET_GSBASE)
- X(I386_SET_GSBASE) X(I386_GET_XFPUSTATE) X(AMD64_GET_FSBASE)
- X(AMD64_SET_FSBASE) X(AMD64_GET_GSBASE) X(AMD64_SET_GSBASE)
- X(AMD64_GET_XFPUSTATE)
-#endif
- XEND
-};
-
static struct xlat linux_socketcall_ops[] = {
X(LINUX_SOCKET) X(LINUX_BIND) X(LINUX_CONNECT) X(LINUX_LISTEN)
X(LINUX_ACCEPT) X(LINUX_GETSOCKNAME) X(LINUX_GETPEERNAME)
@@ -1135,6 +1230,16 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval,
case UInt:
fprintf(fp, "%u", (unsigned int)args[sc->offset]);
break;
+ case PUInt: {
+ unsigned int val;
+
+ if (get_struct(pid, (void *)args[sc->offset], &val,
+ sizeof(val)) == 0)
+ fprintf(fp, "{ %u }", val);
+ else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
case LongHex:
fprintf(fp, "0x%lx", args[sc->offset]);
break;
@@ -1287,6 +1392,16 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval,
break;
}
#endif
+ case PQuadHex: {
+ uint64_t val;
+
+ if (get_struct(pid, (void *)args[sc->offset], &val,
+ sizeof(val)) == 0)
+ fprintf(fp, "{ 0x%jx }", (uintmax_t)val);
+ else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
case Ptr:
fprintf(fp, "0x%lx", args[sc->offset]);
break;
@@ -1529,8 +1644,11 @@ 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);
+ print_integer_arg(sysdecode_pathconf_name, fp, args[sc->offset]);
break;
case Rforkflags:
print_mask_arg(sysdecode_rfork_flags, fp, args[sc->offset]);
@@ -1779,13 +1897,14 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval,
print_integer_arg(sysdecode_atfd, fp, args[sc->offset]);
break;
case Atflags:
- fputs(xlookup_bits(at_flags, args[sc->offset]), fp);
+ print_mask_arg(sysdecode_atflags, fp, args[sc->offset]);
break;
case Accessmode:
print_mask_arg(sysdecode_access_mode, fp, args[sc->offset]);
break;
case Sysarch:
- fputs(xlookup(sysarch_ops, args[sc->offset]), fp);
+ print_integer_arg(sysdecode_sysarch_number, fp,
+ args[sc->offset]);
break;
case PipeFds:
/*
@@ -1926,6 +2045,92 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval,
case Msgflags:
print_mask_arg(sysdecode_msg_flags, fp, args[sc->offset]);
break;
+ case CapRights: {
+ cap_rights_t rights;
+
+ if (get_struct(pid, (void *)args[sc->offset], &rights,
+ sizeof(rights)) != -1) {
+ fputs("{ ", fp);
+ sysdecode_cap_rights(fp, &rights);
+ fputs(" }", fp);
+ } else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case Acltype:
+ print_integer_arg(sysdecode_acltype, fp, args[sc->offset]);
+ break;
+ case Extattrnamespace:
+ print_integer_arg(sysdecode_extattrnamespace, fp,
+ args[sc->offset]);
+ break;
+ case Minherit:
+ print_integer_arg(sysdecode_minherit_inherit, fp,
+ args[sc->offset]);
+ break;
+ case Mlockall:
+ print_mask_arg(sysdecode_mlockall_flags, fp, args[sc->offset]);
+ break;
+ case Mountflags:
+ print_mask_arg(sysdecode_mount_flags, fp, args[sc->offset]);
+ break;
+ case Msync:
+ print_mask_arg(sysdecode_msync_flags, fp, args[sc->offset]);
+ break;
+ case Priowhich:
+ print_integer_arg(sysdecode_prio_which, fp, args[sc->offset]);
+ break;
+ case Ptraceop:
+ print_integer_arg(sysdecode_ptrace_request, fp,
+ args[sc->offset]);
+ break;
+ case Quotactlcmd:
+ if (!sysdecode_quotactl_cmd(fp, args[sc->offset]))
+ fprintf(fp, "%#x", (int)args[sc->offset]);
+ break;
+ case Reboothowto:
+ print_mask_arg(sysdecode_reboot_howto, fp, args[sc->offset]);
+ break;
+ case Rtpriofunc:
+ print_integer_arg(sysdecode_rtprio_function, fp,
+ args[sc->offset]);
+ break;
+ case Schedpolicy:
+ print_integer_arg(sysdecode_scheduler_policy, fp,
+ args[sc->offset]);
+ break;
+ case Schedparam: {
+ struct sched_param sp;
+
+ if (get_struct(pid, (void *)args[sc->offset], &sp,
+ sizeof(sp)) != -1)
+ fprintf(fp, "{ %d }", sp.sched_priority);
+ else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case PSig: {
+ int sig;
+
+ if (get_struct(pid, (void *)args[sc->offset], &sig,
+ sizeof(sig)) == 0)
+ fprintf(fp, "{ %s }", strsig2(sig));
+ else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case Siginfo: {
+ siginfo_t si;
+
+ if (get_struct(pid, (void *)args[sc->offset], &si,
+ sizeof(si)) != -1) {
+ fprintf(fp, "{ signo=%s", strsig2(si.si_signo));
+ decode_siginfo(fp, &si);
+ fprintf(fp, " }");
+ } else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
case CloudABIAdvice:
fputs(xlookup(cloudabi_advice, args[sc->offset]), fp);