freebsd-skq/lib/libsysdecode/Makefile
John Baldwin 287b96dd25 Add handling for non-native error values to libsysdecode.
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
2016-02-23 20:00:55 +00:00

44 lines
878 B
Makefile

# $FreeBSD$
.include <src.opts.mk>
LIB= sysdecode
SRCS= errno.c ioctl.c syscallnames.c utrace.c
INCS= sysdecode.h
CFLAGS+= -I${.CURDIR}/../../sys
MAN+= sysdecode.3 \
sysdecode_abi_to_freebsd_errno.3 \
sysdecode_ioctlname.3 \
sysdecode_syscallnames.3 \
sysdecode_utrace.3
MLINKS+= sysdecode_abi_to_freebsd_errno.3 sysdecode_freebsd_to_abi_errno.3
CLEANFILES= ioctl.c
.if defined(COMPAT_32BIT)
CPP+= -m32
.endif
.if ${MK_PF} != "no"
CFLAGS+=-DPF
.endif
# 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
env MACHINE=${MACHINE} CPP="${CPP}" \
/bin/sh ${.CURDIR}/mkioctls ${DESTDIR}${INCLUDEDIR} > ${.TARGET}
beforedepend: ioctl.c
.include <bsd.lib.mk>