Created attachment 178884 [details] patch to compile lsof on fbsd/arm On the FreeBSD ARM port port is not working. During compilation i see In file included from /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h:41: In file included from /usr/src/sys/cddl/compat/opensolaris/sys/debug.h:33: In file included from /usr/src/sys/cddl/compat/opensolaris/sys/systm.h:35: In file included from /usr/include/sys/systm.h:41: In file included from /usr/include/machine/atomic.h:48: /usr/include/machine/cpuconf.h:119:2: error: ARM_NARCH is 0 #error ARM_NARCH is 0 ^ /usr/include/machine/cpuconf.h:174:2: error: ARM_NMMUS is 0 #error ARM_NMMUS is 0 and compilation fails. After quick checking of the cpuconf.h i found a workaround for this - it is possible to define KLD_MODULE to avoid this useless check. After this change lsof compiled successfully and works as expected.
testing patch.
test builds are fine, waiting on my mentor to commit it.
lsof is not a kernel module though. Something else probably needs to be included before machine/cpuconf.h that sets up the defines that are being added to get those ARM_NARCH and ARM_NMMUS #defines.
Arm folks?
Its not a kernel module but it is emulates kernel source in a hacky way to get some structures normally available for the kernel source only and not exported to the userland. So this patch is correct, because this structures are still there but ARM CPU type is not tested.
Fair enough. That works for me. Thanks for the explanation.
A commit references this bug: Author: ler Date: Sat Jan 14 19:36:59 UTC 2017 New revision: 431492 URL: https://svnweb.freebsd.org/changeset/ports/431492 Log: Fix sysutils/lsof on arm. This fixes the case where ARM_NARCH and ARM_NMMUS are 0, since the lsof(1) sources get hacky access to kernel structures. PR: 216065 Submitted by: samm os2 kiev ua Approved by: adamw (mentor) Differential Revision: https://reviews.freebsd.org/D9176 Changes: head/sysutils/lsof/Makefile head/sysutils/lsof/files/patch-dialects_freebsd_dlsof.h head/sysutils/lsof/files/patch-dialects_freebsd_dnode2.c
Committed, thanks.
ARM_NARCH and ARM_NMMUS are 0 because clang defines __ARM_ARCH_6KZ__ since clang3.8 iirc. 6ZK is a mispelling of 6KZ: https://gcc.gnu.org/ml/gcc-patches/2015-06/msg01679.html --- machine/cpuconf.h.orig 2016-10-30 08:51:47.573780000 +0100 +++ machine/cpuconf.h 2017-01-15 10:24:16.140092000 +0100 @@ -108,7 +108,7 @@ #define ARM_ARCH_4 1 #define ARM_NARCH 1 #define CPU_ARM9 1 -#elif defined(__ARM_ARCH_6ZK__) +#elif defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6KZ__) #undef ARM_ARCH_6 #undef ARM_NARCH #define ARM_ARCH_6 1
Can you file a bug against the base system for that patch, please?
A commit references this bug: Author: ler Date: Sun Jan 15 15:34:43 UTC 2017 New revision: 431585 URL: https://svnweb.freebsd.org/changeset/ports/431585 Log: MFH: r431492 r431583 Fix sysutils/lsof on arm. This fixes the case where ARM_NARCH and ARM_NMMUS are 0, since the lsof(1) sources get hacky access to kernel structures. PR: 216065 Submitted by: samm os2 kiev ua Obtained from: Vic Abell (author) Approved by: ports-secteam (blanket), adamw (mentor) Changes: _U branches/2017Q1/ branches/2017Q1/sysutils/lsof/Makefile branches/2017Q1/sysutils/lsof/distinfo