Index: lib/libsysdecode/Makefile =================================================================== --- lib/libsysdecode/Makefile +++ lib/libsysdecode/Makefile @@ -9,6 +9,7 @@ CFLAGS+= -I${.OBJDIR} CFLAGS+= -I${SRCTOP}/sys +CFLAGS+= -I${SRCTOP}/lib/libsysdecode CFLAGS+= -I${SRCTOP}/libexec/rtld-elf MAN= sysdecode.3 \ @@ -106,7 +107,7 @@ sysdecode_mask.3 sysdecode_wait4_options.3 \ sysdecode_mask.3 sysdecode_wait6_options.3 -CLEANFILES= ioctl.c ioctl.c.tmp tables.h +CLEANFILES= ioctl.c ioctl.c.tmp tables.h ${.OBJDIR}/machine .if defined(COMPAT_32BIT) CPP+= -m32 @@ -122,8 +123,14 @@ CFLAGS.gcc+= ${CFLAGS.gcc.${.IMPSRC}} DEPENDOBJS+= tables.h +DEPENDOBJS+= ${.OBJDIR}/machine + +${.OBJDIR}/machine: + rm -f ${.OBJDIR}/machine; \ + ln -s ${SRCTOP}/sys/${MACHINE}/include ${.OBJDIR}/machine + tables.h: mktables - sh ${.CURDIR}/mktables ${SYSROOT:U${DESTDIR}}${INCLUDEDIR} ${.TARGET} + sh ${.CURDIR}/mktables ${MACHINE} ${SRCTOP}/sys ${.TARGET} # mkioctls runs find(1) for headers so needs to rebuild every time. This used # to be a hack only done in buildworld. @@ -139,7 +146,7 @@ mv -f ${.TARGET}.tmp ${.TARGET}; \ fi -beforedepend: ioctl.c tables.h +beforedepend: ${.OBJDIR}/machine ioctl.c tables.h HAS_TESTS= SUBDIR.${MK_TESTS}+= tests Index: lib/libsysdecode/errno.c =================================================================== --- lib/libsysdecode/errno.c +++ lib/libsysdecode/errno.c @@ -29,8 +29,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include Index: lib/libsysdecode/flags.c =================================================================== --- lib/libsysdecode/flags.c +++ lib/libsysdecode/flags.c @@ -57,9 +57,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include Index: lib/libsysdecode/mktables =================================================================== --- lib/libsysdecode/mktables +++ lib/libsysdecode/mktables @@ -37,12 +37,13 @@ if [ -z "$1" ] then - echo "usage: sh $0 include-dir [output-file]" + echo "usage: sh $0 machine include-dir [output-file]" exit 1 fi -include_dir=$1 -if [ -n "$2" ]; then - output_file="$2" +machine=$1 +include_dir=$2 +if [ -n "$3" ]; then + output_file="$3" output_tmp=$(mktemp -u) exec > "$output_tmp" fi @@ -101,7 +102,7 @@ gen_table "flockops" "LOCK_[A-Z]+[[:space:]]+0x[0-9]+" "sys/fcntl.h" gen_table "kldsymcmd" "KLDSYM_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h" gen_table "kldunloadfflags" "LINKER_UNLOAD_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h" -gen_table "lio_listiomodes" "LIO_(NO)?WAIT[[:space:]]+[0-9]+" "aio.h" +gen_table "lio_listiomodes" "LIO_(NO)?WAIT[[:space:]]+[0-9]+" "sys/aio.h" gen_table "madvisebehav" "_?MADV_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h" gen_table "minheritflags" "INHERIT_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h" gen_table "mlockallflags" "MCL_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h" @@ -162,10 +163,10 @@ gen_table "caprights" "CAP_[A-Z_]+[[:space:]]+((CAPRIGHT\([0-9],[[:space:]]+0x[0-9]{16}ULL\))|(\(CAP_[A-Z_]+[[:space:]]*\|.*\)))" "sys/capsicum.h" gen_table "sctpprpolicy" "SCTP_PR_SCTP_[A-Z_]+[[:space:]]+0x[0-9]+" "netinet/sctp_uio.h" "SCTP_PR_SCTP_ALL" gen_table "cmsgtypesocket" "SCM_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/socket.h" -if [ -e "${include_dir}/x86/sysarch.h" ]; then - gen_table "sysarchnum" "(AMD64|I386)_[A-Z86_]+[[:space:]]+[0-9]+" "x86/sysarch.h" +if [ "$machine" == "amd64" ] || [ "$machine" == "i386" ]; then + gen_table "sysarchnum" "(AMD64|I386)_[A-Z86_]+[[:space:]]+[0-9]+" "x86/include/sysarch.h" else - gen_table "sysarchnum" "[A-Z_]+[[:space:]]+[0-9]+" "machine/sysarch.h" + gen_table "sysarchnum" "[A-Z_]+[[:space:]]+[0-9]+" "${machine}/include/sysarch.h" fi gen_table "shmflags" "SHM_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/mman.h" "SHM_ANON" Index: lib/libsysdecode/signal.c =================================================================== --- lib/libsysdecode/signal.c +++ lib/libsysdecode/signal.c @@ -27,7 +27,7 @@ __FBSDID("$FreeBSD$"); #include -#include +#include #include #include #include