diff options
author | dim <dim@FreeBSD.org> | 2016-01-27 22:52:20 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2016-01-27 22:52:20 +0000 |
commit | aef1771e36f9842a113b9905d0d5926fe9d694aa (patch) | |
tree | d95f1229e13deff9a13cff3acee802c25b074b1d /usr.bin | |
parent | 2c8b37701007da0b1290d6550bc8cddadbb513fe (diff) | |
parent | 10573611b43e8082c286b3e78d3b4d021883b6e8 (diff) | |
download | FreeBSD-src-aef1771e36f9842a113b9905d0d5926fe9d694aa.zip FreeBSD-src-aef1771e36f9842a113b9905d0d5926fe9d694aa.tar.gz |
Merge ^/head r294777 through r294960.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/dpv/dpv.1 | 9 | ||||
-rw-r--r-- | usr.bin/dpv/dpv.c | 10 | ||||
-rw-r--r-- | usr.bin/kdump/Makefile | 19 | ||||
-rw-r--r-- | usr.bin/kdump/kdump.c | 136 | ||||
-rw-r--r-- | usr.bin/systat/netstat.c | 2 | ||||
-rw-r--r-- | usr.bin/truss/Makefile | 23 | ||||
-rw-r--r-- | usr.bin/truss/aarch64-cloudabi64.c | 5 | ||||
-rw-r--r-- | usr.bin/truss/aarch64-freebsd.c | 6 | ||||
-rw-r--r-- | usr.bin/truss/amd64-cloudabi64.c | 5 | ||||
-rw-r--r-- | usr.bin/truss/amd64-freebsd.c | 6 | ||||
-rw-r--r-- | usr.bin/truss/amd64-freebsd32.c | 9 | ||||
-rw-r--r-- | usr.bin/truss/amd64-linux32.c | 6 | ||||
-rw-r--r-- | usr.bin/truss/arm-freebsd.c | 6 | ||||
-rw-r--r-- | usr.bin/truss/i386-freebsd.c | 9 | ||||
-rw-r--r-- | usr.bin/truss/i386-linux.c | 6 | ||||
-rw-r--r-- | usr.bin/truss/main.c | 1 | ||||
-rw-r--r-- | usr.bin/truss/mips-freebsd.c | 6 | ||||
-rw-r--r-- | usr.bin/truss/powerpc-freebsd.c | 6 | ||||
-rw-r--r-- | usr.bin/truss/powerpc64-freebsd.c | 6 | ||||
-rw-r--r-- | usr.bin/truss/powerpc64-freebsd32.c | 6 | ||||
-rw-r--r-- | usr.bin/truss/setup.c | 4 | ||||
-rw-r--r-- | usr.bin/truss/sparc64-freebsd.c | 6 | ||||
-rw-r--r-- | usr.bin/truss/truss.h | 3 |
23 files changed, 98 insertions, 197 deletions
diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1 index 5a64af9..6af3752 100644 --- a/usr.bin/dpv/dpv.1 +++ b/usr.bin/dpv/dpv.1 @@ -1,4 +1,4 @@ -.\" Copyright (c) 2013-2015 Devin Teske +.\" Copyright (c) 2013-2016 Devin Teske .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Oct 22, 2015 +.Dd Jan 26, 2016 .Dt DPV 1 .Os .Sh NAME @@ -138,6 +138,11 @@ Default value is .Dq Li %'10lli bytes read @ %'9.1f bytes/sec. [%i/%i busy/wait] . This format is used when handling more than one file. +.It Fl k +Keep tite. +Prevent visually distracting initialization/exit routines for scripts running +.Xr dialog 1 +several times. .It Fl l Line mode. Read lines from input instead of bytes. .It Fl L Ar size diff --git a/usr.bin/dpv/dpv.c b/usr.bin/dpv/dpv.c index 4e006f6..440b5ab6 100644 --- a/usr.bin/dpv/dpv.c +++ b/usr.bin/dpv/dpv.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Devin Teske <dteske@FreeBSD.org> + * Copyright (c) 2013-2016 Devin Teske <dteske@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -271,7 +271,7 @@ main(int argc, char *argv[]) * Process command-line options */ while ((ch = getopt(argc, argv, - "a:b:dDhi:I:lL:mn:No:p:P:t:TU:wx:X")) != -1) { + "a:b:dDhi:I:klL:mn:No:p:P:t:TU:wx:X")) != -1) { switch(ch) { case 'a': /* additional message text to append */ if (config->aprompt == NULL) { @@ -307,6 +307,9 @@ main(int argc, char *argv[]) case 'I': /* status line format string for many-files */ config->status_many = optarg; break; + case 'k': /* keep tite */ + config->keep_tite = TRUE; + break; case 'l': /* Line mode */ line_mode = TRUE; break; @@ -467,7 +470,8 @@ main(int argc, char *argv[]) if (dpv(config, file_list) != 0 && debug) warnx("dpv(3) returned error!?"); - end_dialog(); + if (!config->keep_tite) + end_dialog(); dpv_free(); exit(EXIT_SUCCESS); diff --git a/usr.bin/kdump/Makefile b/usr.bin/kdump/Makefile index f149e80..40109f0 100644 --- a/usr.bin/kdump/Makefile +++ b/usr.bin/kdump/Makefile @@ -19,25 +19,6 @@ NO_WERROR?= YES CLEANFILES= kdump_subr.c kdump_subr.h -.if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386") -beforedepend: linux_syscalls.c - -CLEANFILES+= linux_syscalls.c -kdump.o: linux_syscalls.c -linux_syscalls.c: linux_syscalls.conf - sh ${.CURDIR}/../../sys/kern/makesyscalls.sh \ - ${.CURDIR}/../../sys/${MACHINE_ARCH}/linux/syscalls.master ${.CURDIR}/linux_syscalls.conf -.endif -.if (${MACHINE_ARCH} == "amd64") -beforedepend: linux32_syscalls.c - -CLEANFILES+= linux32_syscalls.c -kdump.o: linux32_syscalls.c -linux32_syscalls.c: linux32_syscalls.conf - sh ${.CURDIR}/../../sys/kern/makesyscalls.sh \ - ${.CURDIR}/../../sys/${MACHINE_ARCH}/linux32/syscalls.master ${.CURDIR}/linux32_syscalls.conf -.endif - kdump_subr.h: mksubr sh ${.CURDIR}/mksubr ${DESTDIR}${INCLUDEDIR} | \ sed -n 's/^\([a-z].*)\)$$/void \1;/p' >${.TARGET} diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 7af99fb..d440654 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -122,8 +122,7 @@ void usage(void); #define TIMESTAMP_ELAPSED 0x2 #define TIMESTAMP_RELATIVE 0x4 -extern const char *signames[], *syscallnames[]; -extern int nsyscalls; +extern const char *signames[]; static int timestamp, decimal, fancy = 1, suppressdata, tail, threads, maxdata, resolv = 0, abiflag = 0, syscallno = 0; @@ -145,11 +144,7 @@ static struct ktr_header ktr_header; #if defined(__amd64__) || defined(__i386__) -void linux_ktrsyscall(struct ktr_syscall *, u_int); void linux_ktrsysret(struct ktr_sysret *, u_int); -extern const char *linux_syscallnames[]; - -#include <linux_syscalls.c> /* * from linux.h @@ -169,12 +164,6 @@ static int bsd_to_linux_errno[ELAST + 1] = { }; #endif -#if defined(__amd64__) -extern const char *linux32_syscallnames[]; - -#include <linux32_syscalls.c> -#endif - struct proc_info { TAILQ_ENTRY(proc_info) info; @@ -401,13 +390,7 @@ main(int argc, char *argv[]) drop_logged = 0; switch (ktr_header.ktr_type) { case KTR_SYSCALL: -#if defined(__amd64__) || defined(__i386__) - if ((sv_flags & SV_ABI_MASK) == SV_ABI_LINUX) - linux_ktrsyscall((struct ktr_syscall *)m, - sv_flags); - else -#endif - ktrsyscall((struct ktr_syscall *)m, sv_flags); + ktrsyscall((struct ktr_syscall *)m, sv_flags); break; case KTR_SYSRET: #if defined(__amd64__) || defined(__i386__) @@ -687,10 +670,6 @@ dumpheader(struct ktr_header *kth) } #include <sys/syscall.h> -#define KTRACE -#include <sys/kern/syscalls.c> -#undef KTRACE -int nsyscalls = sizeof (syscallnames) / sizeof (syscallnames[0]); static void ioctlname(unsigned long val) @@ -706,26 +685,57 @@ ioctlname(unsigned long val) printf("%#lx", val); } +static enum sysdecode_abi +syscallabi(u_int sv_flags) +{ + + if (sv_flags == 0) + return (FREEBSD); + switch (sv_flags & SV_ABI_MASK) { + case SV_ABI_FREEBSD: + return (FREEBSD); +#if defined(__amd64__) || defined(__i386__) + case SV_ABI_LINUX: +#ifdef __amd64__ + if (sv_flags & SV_ILP32) + return (LINUX32); +#endif + return (LINUX); +#endif + default: + return (UNKNOWN_ABI); + } +} + +static void +syscallname(u_int code, u_int sv_flags) +{ + const char *name; + + name = sysdecode_syscallname(syscallabi(sv_flags), code); + if (name == NULL) + printf("[%d]", code); + else { + printf("%s", name); + if (syscallno) + printf("[%d]", code); + } +} + void -ktrsyscall(struct ktr_syscall *ktr, u_int flags) +ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags) { int narg = ktr->ktr_narg; register_t *ip; intmax_t arg; - if ((flags != 0 && ((flags & SV_ABI_MASK) != SV_ABI_FREEBSD)) || - (ktr->ktr_code >= nsyscalls || ktr->ktr_code < 0)) - printf("[%d]", ktr->ktr_code); - else { - printf("%s", syscallnames[ktr->ktr_code]); - if (syscallno) - printf("[%d]", ktr->ktr_code); - } + syscallname(ktr->ktr_code, sv_flags); ip = &ktr->ktr_args[0]; if (narg) { char c = '('; if (fancy && - (flags == 0 || (flags & SV_ABI_MASK) == SV_ABI_FREEBSD)) { + (sv_flags == 0 || + (sv_flags & SV_ABI_MASK) == SV_ABI_FREEBSD)) { switch (ktr->ktr_code) { case SYS_bindat: case SYS_connectat: @@ -1332,21 +1342,13 @@ ktrsyscall(struct ktr_syscall *ktr, u_int flags) } void -ktrsysret(struct ktr_sysret *ktr, u_int flags) +ktrsysret(struct ktr_sysret *ktr, u_int sv_flags) { register_t ret = ktr->ktr_retval; int error = ktr->ktr_error; - int code = ktr->ktr_code; - if ((flags != 0 && ((flags & SV_ABI_MASK) != SV_ABI_FREEBSD)) || - (code >= nsyscalls || code < 0)) - printf("[%d] ", code); - else { - printf("%s", syscallnames[code]); - if (syscallno) - printf("[%d]", code); - printf(" "); - } + syscallname(ktr->ktr_code, sv_flags); + printf(" "); if (error == 0) { if (fancy) { @@ -1851,56 +1853,14 @@ ktrfaultend(struct ktr_faultend *ktr) } #if defined(__amd64__) || defined(__i386__) - -#if defined(__amd64__) -#define NLINUX_SYSCALLS(v) ((v) & SV_ILP32 ? \ - nitems(linux32_syscallnames) : nitems(linux_syscallnames)) -#define LINUX_SYSCALLNAMES(v, i) ((v) & SV_ILP32 ? \ - linux32_syscallnames[i] : linux_syscallnames[i]) -#else -#define NLINUX_SYSCALLS(v) (nitems(linux_syscallnames)) -#define LINUX_SYSCALLNAMES(v, i) (linux_syscallnames[i]) -#endif - -void -linux_ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags) -{ - int narg = ktr->ktr_narg; - unsigned code = ktr->ktr_code; - register_t *ip; - - if (ktr->ktr_code < 0 || code >= NLINUX_SYSCALLS(sv_flags)) - printf("[%d]", ktr->ktr_code); - else { - printf("%s", LINUX_SYSCALLNAMES(sv_flags, ktr->ktr_code)); - if (syscallno) - printf("[%d]", ktr->ktr_code); - } - ip = &ktr->ktr_args[0]; - if (narg) { - char c = '('; - while (narg > 0) - print_number(ip, narg, c); - putchar(')'); - } - putchar('\n'); -} - void linux_ktrsysret(struct ktr_sysret *ktr, u_int sv_flags) { register_t ret = ktr->ktr_retval; - unsigned code = ktr->ktr_code; int error = ktr->ktr_error; - if (ktr->ktr_code < 0 || code >= NLINUX_SYSCALLS(sv_flags)) - printf("[%d] ", ktr->ktr_code); - else { - printf("%s ", LINUX_SYSCALLNAMES(sv_flags, code)); - if (syscallno) - printf("[%d]", code); - printf(" "); - } + syscallname(ktr->ktr_code, sv_flags); + printf(" "); if (error == 0) { if (fancy) { diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c index 3f994e8..56bc34e 100644 --- a/usr.bin/systat/netstat.c +++ b/usr.bin/systat/netstat.c @@ -59,10 +59,10 @@ static const char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93"; #include <netinet/tcp.h> #include <netinet/tcpip.h> #include <netinet/tcp_seq.h> -#include <netinet/tcp_var.h> #define TCPSTATES #include <netinet/tcp_fsm.h> #include <netinet/tcp_timer.h> +#include <netinet/tcp_var.h> #include <netinet/tcp_debug.h> #include <netinet/udp.h> #include <netinet/udp_var.h> diff --git a/usr.bin/truss/Makefile b/usr.bin/truss/Makefile index a6e4524..b28098c 100644 --- a/usr.bin/truss/Makefile +++ b/usr.bin/truss/Makefile @@ -8,13 +8,6 @@ LIBADD= sysdecode CFLAGS+= -I${.CURDIR} -I. -I${.CURDIR}/../../sys -# Define where to generate syscalls for each ABI. -ABI_SYSPATH.freebsd= sys/kern -ABI_SYSPATH.freebsd32= sys/compat/freebsd32 -ABI_SYSPATH.cloudabi64= sys/compat/cloudabi64 -ABI_SYSPATH.i386-linux= sys/i386/linux -ABI_SYSPATH.amd64-linux32= sys/amd64/linux32 - ABIS+= freebsd # Each ABI is expected to have an ABI.c, MACHINE_ARCH-ABI.c or # MACHINE_CPUARCH-ABI.c file that will be used to map the syscall arguments. @@ -42,21 +35,7 @@ ABI_SRCS= ${abi}.c ${MACHINE_ARCH}-${abi}.c ${MACHINE_CPUARCH}-${abi}.c abi_src= ${f} .endif .endfor -SRCS:= ${SRCS} ${abi_src} ${abi}_syscalls.h -CLEANFILES+= ${abi}_syscalls.conf ${abi}_syscalls.master ${abi}_syscalls.h -${abi}_syscalls.conf: ${.CURDIR}/makesyscallsconf.sh - /bin/sh ${.CURDIR}/makesyscallsconf.sh ${abi} ${.TARGET} - -${abi}_syscalls.master: ${.CURDIR:H:H}/${ABI_SYSPATH.${abi}}/syscalls.master - cp -f ${.ALLSRC} ${.TARGET} - -${abi}_syscalls.h: ${abi}_syscalls.master ${abi}_syscalls.conf \ - ${.CURDIR:H:H}/sys/kern/makesyscalls.sh - /bin/sh ${.CURDIR:H:H}/sys/kern/makesyscalls.sh \ - ${abi}_syscalls.master ${abi}_syscalls.conf -# Eliminate compiler warning about non-static global. - sed -i '' '/^const char \*/s/^/static /' ${.TARGET}.tmp - mv ${.TARGET}.tmp ${.TARGET} +SRCS:= ${SRCS} ${abi_src} .endfor .include <bsd.prog.mk> diff --git a/usr.bin/truss/aarch64-cloudabi64.c b/usr.bin/truss/aarch64-cloudabi64.c index ad6afc2..099cb1e 100644 --- a/usr.bin/truss/aarch64-cloudabi64.c +++ b/usr.bin/truss/aarch64-cloudabi64.c @@ -33,9 +33,9 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <stdio.h> +#include <sysdecode.h> #include "cloudabi.h" -#include "cloudabi64_syscalls.h" #include "truss.h" static int @@ -81,8 +81,7 @@ aarch64_cloudabi64_fetch_retval(struct trussinfo *trussinfo, long *retval, static struct procabi aarch64_cloudabi64 = { "CloudABI ELF64", - syscallnames, - nitems(syscallnames), + CLOUDABI64, aarch64_cloudabi64_fetch_args, aarch64_cloudabi64_fetch_retval }; diff --git a/usr.bin/truss/aarch64-freebsd.c b/usr.bin/truss/aarch64-freebsd.c index 1ec2b66..454bba7 100644 --- a/usr.bin/truss/aarch64-freebsd.c +++ b/usr.bin/truss/aarch64-freebsd.c @@ -39,11 +39,10 @@ __FBSDID("$FreeBSD$"); #include <machine/ucontext.h> #include <stdio.h> +#include <sysdecode.h> #include "truss.h" -#include "freebsd_syscalls.h" - static int aarch64_fetch_args(struct trussinfo *trussinfo, u_int narg) { @@ -100,8 +99,7 @@ aarch64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) static struct procabi aarch64_freebsd = { "FreeBSD ELF64", - syscallnames, - nitems(syscallnames), + FREEBSD, aarch64_fetch_args, aarch64_fetch_retval }; diff --git a/usr.bin/truss/amd64-cloudabi64.c b/usr.bin/truss/amd64-cloudabi64.c index 5982b66..38768ff 100644 --- a/usr.bin/truss/amd64-cloudabi64.c +++ b/usr.bin/truss/amd64-cloudabi64.c @@ -33,9 +33,9 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <stdio.h> +#include <sysdecode.h> #include "cloudabi.h" -#include "cloudabi64_syscalls.h" #include "truss.h" static int @@ -90,8 +90,7 @@ amd64_cloudabi64_fetch_retval(struct trussinfo *trussinfo, long *retval, static struct procabi amd64_cloudabi64 = { "CloudABI ELF64", - syscallnames, - nitems(syscallnames), + CLOUDABI64, amd64_cloudabi64_fetch_args, amd64_cloudabi64_fetch_retval }; diff --git a/usr.bin/truss/amd64-freebsd.c b/usr.bin/truss/amd64-freebsd.c index 0461616..8a211a0 100644 --- a/usr.bin/truss/amd64-freebsd.c +++ b/usr.bin/truss/amd64-freebsd.c @@ -41,11 +41,10 @@ __FBSDID("$FreeBSD$"); #include <machine/psl.h> #include <stdio.h> +#include <sysdecode.h> #include "truss.h" -#include "freebsd_syscalls.h" - static int amd64_fetch_args(struct trussinfo *trussinfo, u_int narg) { @@ -122,8 +121,7 @@ amd64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) static struct procabi amd64_freebsd = { "FreeBSD ELF64", - syscallnames, - nitems(syscallnames), + FREEBSD, amd64_fetch_args, amd64_fetch_retval }; diff --git a/usr.bin/truss/amd64-freebsd32.c b/usr.bin/truss/amd64-freebsd32.c index 82eb6cd..adce798 100644 --- a/usr.bin/truss/amd64-freebsd32.c +++ b/usr.bin/truss/amd64-freebsd32.c @@ -42,11 +42,10 @@ __FBSDID("$FreeBSD$"); #include <stdio.h> #include <stdlib.h> +#include <sysdecode.h> #include "truss.h" -#include "freebsd32_syscalls.h" - static int amd64_freebsd32_fetch_args(struct trussinfo *trussinfo, u_int narg) { @@ -118,8 +117,7 @@ amd64_freebsd32_fetch_retval(struct trussinfo *trussinfo, long *retval, static struct procabi amd64_freebsd32 = { "FreeBSD ELF32", - syscallnames, - nitems(syscallnames), + FREEBSD32, amd64_freebsd32_fetch_args, amd64_freebsd32_fetch_retval }; @@ -128,8 +126,7 @@ PROCABI(amd64_freebsd32); static struct procabi amd64_freebsd32_aout = { "FreeBSD a.out", - syscallnames, - nitems(syscallnames), + FREEBSD32, amd64_freebsd32_fetch_args, amd64_freebsd32_fetch_retval }; diff --git a/usr.bin/truss/amd64-linux32.c b/usr.bin/truss/amd64-linux32.c index 17e5fdc..dd1d833 100644 --- a/usr.bin/truss/amd64-linux32.c +++ b/usr.bin/truss/amd64-linux32.c @@ -40,11 +40,10 @@ __FBSDID("$FreeBSD$"); #include <machine/psl.h> #include <stdio.h> +#include <sysdecode.h> #include "truss.h" -#include "amd64-linux32_syscalls.h" - static int amd64_linux32_fetch_args(struct trussinfo *trussinfo, u_int narg) { @@ -132,8 +131,7 @@ amd64_linux32_fetch_retval(struct trussinfo *trussinfo, long *retval, static struct procabi amd64_linux32 = { "Linux ELF32", - syscallnames, - nitems(syscallnames), + LINUX32, amd64_linux32_fetch_args, amd64_linux32_fetch_retval }; diff --git a/usr.bin/truss/arm-freebsd.c b/usr.bin/truss/arm-freebsd.c index aa7bccc..5722c91 100644 --- a/usr.bin/truss/arm-freebsd.c +++ b/usr.bin/truss/arm-freebsd.c @@ -42,11 +42,10 @@ __FBSDID("$FreeBSD$"); #include <machine/ucontext.h> #include <stdio.h> +#include <sysdecode.h> #include "truss.h" -#include "freebsd_syscalls.h" - static int arm_fetch_args(struct trussinfo *trussinfo, u_int narg) { @@ -129,8 +128,7 @@ arm_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) static struct procabi arm_freebsd = { "FreeBSD ELF32", - syscallnames, - nitems(syscallnames), + FREEBSD, arm_fetch_args, arm_fetch_retval }; diff --git a/usr.bin/truss/i386-freebsd.c b/usr.bin/truss/i386-freebsd.c index d9d72aa..c166596 100644 --- a/usr.bin/truss/i386-freebsd.c +++ b/usr.bin/truss/i386-freebsd.c @@ -41,11 +41,10 @@ __FBSDID("$FreeBSD$"); #include <machine/psl.h> #include <stdio.h> +#include <sysdecode.h> #include "truss.h" -#include "freebsd_syscalls.h" - static int i386_fetch_args(struct trussinfo *trussinfo, u_int narg) { @@ -111,8 +110,7 @@ i386_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) static struct procabi i386_freebsd = { "FreeBSD ELF32", - syscallnames, - nitems(syscallnames), + FREEBSD, i386_fetch_args, i386_fetch_retval }; @@ -121,8 +119,7 @@ PROCABI(i386_freebsd); static struct procabi i386_freebsd_aout = { "FreeBSD a.out", - syscallnames, - nitems(syscallnames), + FREEBSD, i386_fetch_args, i386_fetch_retval }; diff --git a/usr.bin/truss/i386-linux.c b/usr.bin/truss/i386-linux.c index 9166271..5fdae8e 100644 --- a/usr.bin/truss/i386-linux.c +++ b/usr.bin/truss/i386-linux.c @@ -40,11 +40,10 @@ __FBSDID("$FreeBSD$"); #include <machine/psl.h> #include <stdio.h> +#include <sysdecode.h> #include "truss.h" -#include "i386-linux_syscalls.h" - static int i386_linux_fetch_args(struct trussinfo *trussinfo, u_int narg) { @@ -131,8 +130,7 @@ i386_linux_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) static struct procabi i386_linux = { "Linux ELF32", - syscallnames, - nitems(syscallnames), + LINUX, i386_linux_fetch_args, i386_linux_fetch_retval }; diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c index 5eec953..531d7db 100644 --- a/usr.bin/truss/main.c +++ b/usr.bin/truss/main.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include <signal.h> #include <stdio.h> #include <stdlib.h> +#include <sysdecode.h> #include <time.h> #include <unistd.h> diff --git a/usr.bin/truss/mips-freebsd.c b/usr.bin/truss/mips-freebsd.c index 0c504b8..f4b5a7e 100644 --- a/usr.bin/truss/mips-freebsd.c +++ b/usr.bin/truss/mips-freebsd.c @@ -41,11 +41,10 @@ __FBSDID("$FreeBSD$"); #include <machine/reg.h> #include <stdio.h> +#include <sysdecode.h> #include "truss.h" -#include "freebsd_syscalls.h" - static int mips_fetch_args(struct trussinfo *trussinfo, u_int narg) { @@ -132,8 +131,7 @@ static struct procabi mips_freebsd = { #else "FreeBSD ELF32", #endif - syscallnames, - nitems(syscallnames), + FREEBSD, mips_fetch_args, mips_fetch_retval }; diff --git a/usr.bin/truss/powerpc-freebsd.c b/usr.bin/truss/powerpc-freebsd.c index 90c3663..6a245df 100644 --- a/usr.bin/truss/powerpc-freebsd.c +++ b/usr.bin/truss/powerpc-freebsd.c @@ -37,11 +37,10 @@ __FBSDID("$FreeBSD$"); #include <machine/frame.h> #include <stdio.h> +#include <sysdecode.h> #include "truss.h" -#include "freebsd_syscalls.h" - static int powerpc_fetch_args(struct trussinfo *trussinfo, u_int narg) { @@ -113,8 +112,7 @@ powerpc_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) static struct procabi powerpc_freebsd = { "FreeBSD ELF32", - syscallnames, - nitems(syscallnames), + FREEBSD, powerpc_fetch_args, powerpc_fetch_retval }; diff --git a/usr.bin/truss/powerpc64-freebsd.c b/usr.bin/truss/powerpc64-freebsd.c index fafaa1b..68a0b5d 100644 --- a/usr.bin/truss/powerpc64-freebsd.c +++ b/usr.bin/truss/powerpc64-freebsd.c @@ -37,11 +37,10 @@ __FBSDID("$FreeBSD$"); #include <machine/frame.h> #include <stdio.h> +#include <sysdecode.h> #include "truss.h" -#include "freebsd_syscalls.h" - static int powerpc64_fetch_args(struct trussinfo *trussinfo, u_int narg) { @@ -109,8 +108,7 @@ powerpc64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) static struct procabi powerpc64_freebsd = { "FreeBSD ELF64", - syscallnames, - nitems(syscallnames), + FREEBSD, powerpc64_fetch_args, powerpc64_fetch_retval }; diff --git a/usr.bin/truss/powerpc64-freebsd32.c b/usr.bin/truss/powerpc64-freebsd32.c index fc0ffb8..ee37ead 100644 --- a/usr.bin/truss/powerpc64-freebsd32.c +++ b/usr.bin/truss/powerpc64-freebsd32.c @@ -37,11 +37,10 @@ __FBSDID("$FreeBSD$"); #include <machine/frame.h> #include <stdio.h> +#include <sysdecode.h> #include "truss.h" -#include "freebsd32_syscalls.h" - static int powerpc64_freebsd32_fetch_args(struct trussinfo *trussinfo, u_int narg) { @@ -118,8 +117,7 @@ powerpc64_freebsd32_fetch_retval(struct trussinfo *trussinfo, long *retval, int static struct procabi powerpc64_freebsd32 = { "FreeBSD ELF32", - syscallnames, - nitems(syscallnames), + FREEBSD32, powerpc64_freebsd32_fetch_args, powerpc64_freebsd32_fetch_retval }; diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c index 74678e6..c0c15f0 100644 --- a/usr.bin/truss/setup.c +++ b/usr.bin/truss/setup.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sysdecode.h> #include <time.h> #include <unistd.h> @@ -335,8 +336,7 @@ enter_syscall(struct trussinfo *info, struct ptrace_lwpinfo *pl) return; } - if (t->cs.number >= 0 && t->cs.number < t->proc->abi->nsyscalls) - t->cs.name = t->proc->abi->syscallnames[t->cs.number]; + t->cs.name = sysdecode_syscallname(t->proc->abi->abi, t->cs.number); if (t->cs.name == NULL) fprintf(info->outfile, "-- UNKNOWN %s SYSCALL %d --\n", t->proc->abi->type, t->cs.number); diff --git a/usr.bin/truss/sparc64-freebsd.c b/usr.bin/truss/sparc64-freebsd.c index a4dba92..23486d7 100644 --- a/usr.bin/truss/sparc64-freebsd.c +++ b/usr.bin/truss/sparc64-freebsd.c @@ -43,11 +43,10 @@ __FBSDID("$FreeBSD$"); #include <stddef.h> #include <stdio.h> +#include <sysdecode.h> #include "truss.h" -#include "freebsd_syscalls.h" - static int sparc64_fetch_args(struct trussinfo *trussinfo, u_int narg) { @@ -116,8 +115,7 @@ sparc64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) static struct procabi sparc64_freebsd = { "FreeBSD ELF64", - syscallnames, - nitems(syscallnames), + FREEBSD, sparc64_fetch_args, sparc64_fetch_retval }; diff --git a/usr.bin/truss/truss.h b/usr.bin/truss/truss.h index 5a57de7..5ef2444 100644 --- a/usr.bin/truss/truss.h +++ b/usr.bin/truss/truss.h @@ -41,8 +41,7 @@ struct trussinfo; struct procabi { const char *type; - const char **syscallnames; - int nsyscalls; + enum sysdecode_abi abi; int (*fetch_args)(struct trussinfo *, u_int); int (*fetch_retval)(struct trussinfo *, long *, int *); }; |