287b96dd25
Add two new functions, sysdecode_abi_to_freebsd_errno() and sysdecode_freebsd_to_abi_errno(), which convert errno values between the native FreeBSD ABI and other supported ABIs. Note that the mappings are not necessarily perfect meaning in some cases multiple errors in one ABI might map to a single error in another ABI. In that case, the reverse mapping will return one of the errors that maps, but which error is non-deterministic. Change truss to always report the raw error value to the user but use libsysdecode to map it to a native errno value that can be used with strerror() to generate a description. Previously truss reported the "converted" error value. Now the user will always see the exact error value that the application sees. Change kdump to report the truly raw error value to the user. Previously kdump would report the absolute value of the raw error value (so for Linux binaries it didn't output the FreeBSD error value, but the positive value of the Linux error). Now it reports the real (i.e. negative) error value for Linux binaries. Also, use libsysdecode to convert the native FreeBSD error reported in the ktrace record to the raw error used by the ABI. This means that the Linux ABI can now be handled directly in ktrsysret() and removes the need for linux_ktrsysret(). Reviewed by: bdrewery, kib Helpful notes: wblock (manpage) Differential Revision: https://reviews.freebsd.org/D5314
42 lines
872 B
Makefile
42 lines
872 B
Makefile
# $FreeBSD$
|
|
|
|
NO_WERROR=
|
|
PROG= truss
|
|
SRCS= main.c setup.c syscalls.c
|
|
|
|
LIBADD= sysdecode
|
|
|
|
CFLAGS+= -I${.CURDIR} -I. -I${.CURDIR}/../../sys
|
|
|
|
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.
|
|
.if ${MACHINE_ARCH} == "aarch64"
|
|
ABIS+= cloudabi64
|
|
.endif
|
|
.if ${MACHINE_CPUARCH} == "i386"
|
|
ABIS+= i386-linux
|
|
.endif
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
|
ABIS+= amd64-linux32
|
|
ABIS+= freebsd32
|
|
ABIS+= cloudabi64
|
|
.endif
|
|
.if ${MACHINE_ARCH} == "powerpc64"
|
|
ABIS+= freebsd32
|
|
.endif
|
|
|
|
.for abi in ${ABIS}
|
|
# Find the right file to handle this ABI.
|
|
abi_src=
|
|
ABI_SRCS= ${abi}.c ${MACHINE_ARCH}-${abi}.c ${MACHINE_CPUARCH}-${abi}.c
|
|
.for f in ${ABI_SRCS}
|
|
.if exists(${.CURDIR}/${f}) && empty(abi_src)
|
|
abi_src= ${f}
|
|
.endif
|
|
.endfor
|
|
SRCS:= ${SRCS} ${abi_src}
|
|
.endfor
|
|
|
|
.include <bsd.prog.mk>
|