Page MenuHomeFreeBSD

D4823.id12726.diff
No OneTemporary

D4823.id12726.diff

Index: lib/libsysdecode/Makefile
===================================================================
--- lib/libsysdecode/Makefile
+++ lib/libsysdecode/Makefile
@@ -4,11 +4,14 @@
LIB= sysdecode
-SRCS= ioctl.c utrace.c
+SRCS= ioctl.c syscallnames.c utrace.c
INCS= sysdecode.h
+CFLAGS+= -I${.CURDIR}/../../sys
+
MAN+= sysdecode.3 \
sysdecode_ioctlname.3 \
+ sysdecode_syscallnames.3 \
sysdecode_utrace.3
CLEANFILES= ioctl.c
@@ -23,6 +26,10 @@
# Workaround duplicate declarations in <netinet/ip_compat.h>
CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls
+
+# Workaround warning for unused ssi_cables[] in <dev/lmc/if_lmc.h>
+CFLAGS.gcc.ioctl.c+= -Wno-unused
+
CFLAGS.gcc+= ${CFLAGS.gcc.${.IMPSRC}}
ioctl.c: mkioctls
Index: lib/libsysdecode/syscallnames.c
===================================================================
--- /dev/null
+++ lib/libsysdecode/syscallnames.c
@@ -0,0 +1,105 @@
+/*-
+ * Copyright (c) 2015 John H. Baldwin <jhb@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Map system call codes to names for the supported ABIs on each
+ * platform. Rather than regnerating system call name tables locally
+ * during the build, use the generated tables in the kernel source
+ * tree.
+ */
+
+#include <sys/param.h>
+#include <stdio.h>
+#include <sysdecode.h>
+
+static
+#include <kern/syscalls.c>
+
+#if defined(__amd64__) || defined(__powerpc64__)
+static
+#include <compat/freebsd32/freebsd32_syscalls.c>
+#endif
+
+#if defined(__amd64__) || defined(__i386__)
+static
+#ifdef __amd64__
+#include <amd64/linux/linux_syscalls.c>
+#else
+#include <i386/linux/linux_syscalls.c>
+#endif
+#endif
+
+#ifdef __amd64__
+static
+#include <amd64/linux32/linux32_syscalls.c>
+#endif
+
+#if defined(__amd64__) || defined(__aarch64__)
+static
+#include <compat/cloudabi64/cloudabi64_syscalls.c>
+#endif
+
+const char *
+sysdecode_syscallname(enum sysdecode_abi abi, unsigned int code)
+{
+
+ switch (abi) {
+ case FREEBSD:
+ if (code < nitems(syscallnames))
+ return (syscallnames[code]);
+ break;
+#if defined(__amd64__) || defined(__powerpc64__)
+ case FREEBSD32:
+ if (code < nitems(freebsd32_syscallnames))
+ return (freebsd32_syscallnames[code]);
+ break;
+#endif
+#if defined(__amd64__) || defined(__i386__)
+ case LINUX:
+ if (code < nitems(linux_syscallnames))
+ return (linux_syscallnames[code]);
+ break;
+#endif
+#ifdef __amd64__
+ case LINUX32:
+ if (code < nitems(linux32_syscallnames))
+ return (linux32_syscallnames[code]);
+ break;
+#endif
+#if defined(__amd64__) || defined(__aarch64__)
+ case CLOUDABI64:
+ if (code < nitems(cloudabi64_syscallnames))
+ return (cloudabi64_syscallnames[code]);
+ break;
+#endif
+ default:
+ break;
+ }
+ return (NULL);
+}
Index: lib/libsysdecode/sysdecode.h
===================================================================
--- lib/libsysdecode/sysdecode.h
+++ lib/libsysdecode/sysdecode.h
@@ -29,7 +29,17 @@
#ifndef __SYSDECODE_H__
#define __SYSDECODE_H__
+enum sysdecode_abi {
+ UNKNOWN_ABI = 0,
+ FREEBSD,
+ FREEBSD32,
+ LINUX,
+ LINUX32,
+ CLOUDABI64
+};
+
const char *sysdecode_ioctlname(unsigned long _val);
+const char *sysdecode_syscallname(enum sysdecode_abi _abi, unsigned int _code);
int sysdecode_utrace(FILE *_fp, void *_buf, size_t _len);
#endif /* !__SYSDECODE_H__ */
Index: lib/libsysdecode/sysdecode.3
===================================================================
--- lib/libsysdecode/sysdecode.3
+++ lib/libsysdecode/sysdecode.3
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 10, 2015
+.Dd January 24, 2016
.Dt SYSDECODE 3
.Os
.Sh NAME
@@ -38,8 +38,34 @@
.Nm
library includes several functions that provide descriptive names of
values associated with system calls.
+.Ss Supported ABIs
+Some functions in this library provide ABI-specific descriptions.
+The supported ABIs are named by the
+.Vt enum sysdecode_abi
+enumeration.
+.Pp
+.Bl -tag -width "Li UNKNOWN_ABI" -compact
+.It Li FREEBSD
+Native FreeBSD binaries.
+Supported on all platforms.
+.It Li FREEBSD32
+32-bit FreeBSD binaries.
+Supported on amd64 and powerpc64.
+.It Li LINUX
+Linux binaries of the same platform.
+Supported on amd64 and i386.
+.It Li LINUX32
+32-bit Linux binaries.
+Supported on amd64.
+.It Li CLOUDABI64
+64-bit CloudABI binaries.
+Supported on aarch64 and amd64.
+.It Li UNKNOWN_ABI
+A placeholder for use when the ABI is not known.
+.El
.Sh SEE ALSO
.Xr sysdecode_ioctlname 3 ,
+.Xr sysdecode_syscallnames 3 ,
.Xr sysdecode_utrace 3
.Sh HISTORY
The
Index: lib/libsysdecode/sysdecode_syscallnames.3
===================================================================
--- lib/libsysdecode/sysdecode_syscallnames.3
+++ lib/libsysdecode/sysdecode_syscallnames.3
@@ -1,5 +1,5 @@
.\"
-.\" Copyright (c) 2015 John Baldwin <jhb@FreeBSD.org>
+.\" Copyright (c) 2016 John Baldwin <jhb@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -25,24 +25,43 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 10, 2015
-.Dt SYSDECODE 3
+.Dd January 24, 2016
+.Dt sysdecode_syscallnames 3
.Os
.Sh NAME
-.Nm sysdecode
-.Nd system argument decoding library
+.Nm sysdecode_syscallnames
+.Nd lookup name of system calls
.Sh LIBRARY
.Lb libsysdecode
+.Sh SYNOPSIS
+.Ft const char *
+.Fn sysdecode_syscallnames "enum sysdecode_abi abi" "unsigned int code"
.Sh DESCRIPTION
-The
+This function returns a pointer to the name of a system call identified by
+.Fa code
+for the process ABI
+.Fa abi .
+If
+.Fa code
+specifies an unknown system call or
+.Fa abi
+is an unsupported ABI,
.Nm
-library includes several functions that provide descriptive names of
-values associated with system calls.
-.Sh SEE ALSO
-.Xr sysdecode_ioctlname 3 ,
-.Xr sysdecode_utrace 3
-.Sh HISTORY
+returns
+.Dv NULL .
+.Pp
+For the list of supported ABIs,
+see
+.Xr sysdecode 3 .
+.Sh RETURN VALUES
The
.Nm
-library first appeared in
-.Fx 11.0 .
+function returns a pointer to a string on success or
+.Dv NULL
+if either
+.Fa code
+or
+.Fa ABI
+is invalid .
+.Sh SEE ALSO
+.Xr sysdecode 3
Index: usr.bin/kdump/Makefile
===================================================================
--- usr.bin/kdump/Makefile
+++ usr.bin/kdump/Makefile
@@ -19,25 +19,6 @@
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}
Index: usr.bin/kdump/kdump.c
===================================================================
--- usr.bin/kdump/kdump.c
+++ usr.bin/kdump/kdump.c
@@ -122,8 +122,7 @@
#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 @@
#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 @@
};
#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 @@
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 @@
}
#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 @@
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 @@
}
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 @@
}
#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) {
Index: usr.bin/truss/Makefile
===================================================================
--- usr.bin/truss/Makefile
+++ usr.bin/truss/Makefile
@@ -8,13 +8,6 @@
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_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>
Index: usr.bin/truss/aarch64-cloudabi64.c
===================================================================
--- usr.bin/truss/aarch64-cloudabi64.c
+++ usr.bin/truss/aarch64-cloudabi64.c
@@ -33,9 +33,9 @@
#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 @@
static struct procabi aarch64_cloudabi64 = {
"CloudABI ELF64",
- syscallnames,
- nitems(syscallnames),
+ CLOUDABI64,
aarch64_cloudabi64_fetch_args,
aarch64_cloudabi64_fetch_retval
};
Index: usr.bin/truss/aarch64-freebsd.c
===================================================================
--- usr.bin/truss/aarch64-freebsd.c
+++ usr.bin/truss/aarch64-freebsd.c
@@ -39,11 +39,10 @@
#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 @@
static struct procabi aarch64_freebsd = {
"FreeBSD ELF64",
- syscallnames,
- nitems(syscallnames),
+ FREEBSD,
aarch64_fetch_args,
aarch64_fetch_retval
};
Index: usr.bin/truss/amd64-cloudabi64.c
===================================================================
--- usr.bin/truss/amd64-cloudabi64.c
+++ usr.bin/truss/amd64-cloudabi64.c
@@ -33,9 +33,9 @@
#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 @@
static struct procabi amd64_cloudabi64 = {
"CloudABI ELF64",
- syscallnames,
- nitems(syscallnames),
+ CLOUDABI64,
amd64_cloudabi64_fetch_args,
amd64_cloudabi64_fetch_retval
};
Index: usr.bin/truss/amd64-freebsd.c
===================================================================
--- usr.bin/truss/amd64-freebsd.c
+++ usr.bin/truss/amd64-freebsd.c
@@ -41,11 +41,10 @@
#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 @@
static struct procabi amd64_freebsd = {
"FreeBSD ELF64",
- syscallnames,
- nitems(syscallnames),
+ FREEBSD,
amd64_fetch_args,
amd64_fetch_retval
};
Index: usr.bin/truss/amd64-freebsd32.c
===================================================================
--- usr.bin/truss/amd64-freebsd32.c
+++ usr.bin/truss/amd64-freebsd32.c
@@ -42,11 +42,10 @@
#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 @@
static struct procabi amd64_freebsd32 = {
"FreeBSD ELF32",
- syscallnames,
- nitems(syscallnames),
+ FREEBSD32,
amd64_freebsd32_fetch_args,
amd64_freebsd32_fetch_retval
};
@@ -128,8 +126,7 @@
static struct procabi amd64_freebsd32_aout = {
"FreeBSD a.out",
- syscallnames,
- nitems(syscallnames),
+ FREEBSD32,
amd64_freebsd32_fetch_args,
amd64_freebsd32_fetch_retval
};
Index: usr.bin/truss/amd64-linux32.c
===================================================================
--- usr.bin/truss/amd64-linux32.c
+++ usr.bin/truss/amd64-linux32.c
@@ -40,11 +40,10 @@
#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 @@
static struct procabi amd64_linux32 = {
"Linux ELF32",
- syscallnames,
- nitems(syscallnames),
+ LINUX32,
amd64_linux32_fetch_args,
amd64_linux32_fetch_retval
};
Index: usr.bin/truss/arm-freebsd.c
===================================================================
--- usr.bin/truss/arm-freebsd.c
+++ usr.bin/truss/arm-freebsd.c
@@ -42,11 +42,10 @@
#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 @@
static struct procabi arm_freebsd = {
"FreeBSD ELF32",
- syscallnames,
- nitems(syscallnames),
+ FREEBSD,
arm_fetch_args,
arm_fetch_retval
};
Index: usr.bin/truss/i386-freebsd.c
===================================================================
--- usr.bin/truss/i386-freebsd.c
+++ usr.bin/truss/i386-freebsd.c
@@ -41,11 +41,10 @@
#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 @@
static struct procabi i386_freebsd = {
"FreeBSD ELF32",
- syscallnames,
- nitems(syscallnames),
+ FREEBSD,
i386_fetch_args,
i386_fetch_retval
};
@@ -121,8 +119,7 @@
static struct procabi i386_freebsd_aout = {
"FreeBSD a.out",
- syscallnames,
- nitems(syscallnames),
+ FREEBSD,
i386_fetch_args,
i386_fetch_retval
};
Index: usr.bin/truss/i386-linux.c
===================================================================
--- usr.bin/truss/i386-linux.c
+++ usr.bin/truss/i386-linux.c
@@ -40,11 +40,10 @@
#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 @@
static struct procabi i386_linux = {
"Linux ELF32",
- syscallnames,
- nitems(syscallnames),
+ LINUX,
i386_linux_fetch_args,
i386_linux_fetch_retval
};
Index: usr.bin/truss/main.c
===================================================================
--- usr.bin/truss/main.c
+++ usr.bin/truss/main.c
@@ -44,6 +44,7 @@
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sysdecode.h>
#include <time.h>
#include <unistd.h>
Index: usr.bin/truss/mips-freebsd.c
===================================================================
--- usr.bin/truss/mips-freebsd.c
+++ usr.bin/truss/mips-freebsd.c
@@ -41,11 +41,10 @@
#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 @@
#else
"FreeBSD ELF32",
#endif
- syscallnames,
- nitems(syscallnames),
+ FREEBSD,
mips_fetch_args,
mips_fetch_retval
};
Index: usr.bin/truss/powerpc-freebsd.c
===================================================================
--- usr.bin/truss/powerpc-freebsd.c
+++ usr.bin/truss/powerpc-freebsd.c
@@ -37,11 +37,10 @@
#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 @@
static struct procabi powerpc_freebsd = {
"FreeBSD ELF32",
- syscallnames,
- nitems(syscallnames),
+ FREEBSD,
powerpc_fetch_args,
powerpc_fetch_retval
};
Index: usr.bin/truss/powerpc64-freebsd.c
===================================================================
--- usr.bin/truss/powerpc64-freebsd.c
+++ usr.bin/truss/powerpc64-freebsd.c
@@ -37,11 +37,10 @@
#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 @@
static struct procabi powerpc64_freebsd = {
"FreeBSD ELF64",
- syscallnames,
- nitems(syscallnames),
+ FREEBSD,
powerpc64_fetch_args,
powerpc64_fetch_retval
};
Index: usr.bin/truss/powerpc64-freebsd32.c
===================================================================
--- usr.bin/truss/powerpc64-freebsd32.c
+++ usr.bin/truss/powerpc64-freebsd32.c
@@ -37,11 +37,10 @@
#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 @@
static struct procabi powerpc64_freebsd32 = {
"FreeBSD ELF32",
- syscallnames,
- nitems(syscallnames),
+ FREEBSD32,
powerpc64_freebsd32_fetch_args,
powerpc64_freebsd32_fetch_retval
};
Index: usr.bin/truss/setup.c
===================================================================
--- usr.bin/truss/setup.c
+++ usr.bin/truss/setup.c
@@ -49,6 +49,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sysdecode.h>
#include <time.h>
#include <unistd.h>
@@ -335,8 +336,7 @@
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);
Index: usr.bin/truss/sparc64-freebsd.c
===================================================================
--- usr.bin/truss/sparc64-freebsd.c
+++ usr.bin/truss/sparc64-freebsd.c
@@ -43,11 +43,10 @@
#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 @@
static struct procabi sparc64_freebsd = {
"FreeBSD ELF64",
- syscallnames,
- nitems(syscallnames),
+ FREEBSD,
sparc64_fetch_args,
sparc64_fetch_retval
};
Index: usr.bin/truss/truss.h
===================================================================
--- usr.bin/truss/truss.h
+++ usr.bin/truss/truss.h
@@ -41,8 +41,7 @@
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 *);
};

File Metadata

Mime Type
text/plain
Expires
Mon, Feb 9, 4:18 PM (8 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28596839
Default Alt Text
D4823.id12726.diff (24 KB)

Event Timeline