From 287b96dd253d69d2a3ff2033fb2eb19aec44605f Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Tue, 23 Feb 2016 20:00:55 +0000 Subject: 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 --- lib/libsysdecode/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/libsysdecode/Makefile') diff --git a/lib/libsysdecode/Makefile b/lib/libsysdecode/Makefile index e1e69fef64e8..405cab8c7847 100644 --- a/lib/libsysdecode/Makefile +++ b/lib/libsysdecode/Makefile @@ -4,15 +4,17 @@ LIB= sysdecode -SRCS= ioctl.c syscallnames.c utrace.c +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 -- cgit v1.3