Add support to libsysdecode for decoding system call names.
authorjhb <jhb@FreeBSD.org>
Tue, 26 Jan 2016 19:07:09 +0000 (19:07 +0000)
committerjhb <jhb@FreeBSD.org>
Tue, 26 Jan 2016 19:07:09 +0000 (19:07 +0000)
commitcd4a0ee266068abaf08833b8d76b0ad8b0cea721
tree817dc34ebf9af56aa355e84eee2cf55753669285
parent1def741dc225d64b4a5b9f6ef7a3fb0b865294f5
Add support to libsysdecode for decoding system call names.

A new sysdecode_syscallname() function accepts a system call code and
returns a string of the corresponding name (or NULL if the code is
unknown).  To support different process ABIs, the new function accepts a
value from a new sysdecode_abi enum as its first argument to select the
ABI in use.  Current ABIs supported include FREEBSD (native binaries),
FREEBSD32, LINUX, LINUX32, and CLOUDABI64.  Note that not all ABIs are
supported by all platforms.  In general, a given ABI is only supported
if a platform can execute binaries for that ABI.

To simplify the implementation, libsysdecode's build reuses the
existing pre-generated files from the kernel source tree rather than
duplicating new copies of said files during the build.

kdump(1) and truss(1) now use these functions to map system call
identifiers to names.  For kdump(1), a new 'syscallname()' function
consolidates duplicated code from ktrsyscall() and ktrsyscallret().
The Linux ABI no longer requires custom handling for ktrsyscall() and
linux_ktrsyscall() has been removed as a result.

Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org/D4823
25 files changed:
lib/libsysdecode/Makefile
lib/libsysdecode/syscallnames.c [new file with mode: 0644]
lib/libsysdecode/sysdecode.3
lib/libsysdecode/sysdecode.h
lib/libsysdecode/sysdecode_syscallnames.3 [copied from lib/libsysdecode/sysdecode.3 with 68% similarity]
usr.bin/kdump/Makefile
usr.bin/kdump/kdump.c
usr.bin/truss/Makefile
usr.bin/truss/aarch64-cloudabi64.c
usr.bin/truss/aarch64-freebsd.c
usr.bin/truss/amd64-cloudabi64.c
usr.bin/truss/amd64-freebsd.c
usr.bin/truss/amd64-freebsd32.c
usr.bin/truss/amd64-linux32.c
usr.bin/truss/arm-freebsd.c
usr.bin/truss/i386-freebsd.c
usr.bin/truss/i386-linux.c
usr.bin/truss/main.c
usr.bin/truss/mips-freebsd.c
usr.bin/truss/powerpc-freebsd.c
usr.bin/truss/powerpc64-freebsd.c
usr.bin/truss/powerpc64-freebsd32.c
usr.bin/truss/setup.c
usr.bin/truss/sparc64-freebsd.c
usr.bin/truss/truss.h