From a251e14c23770f32238a0af46ac32fcdddd68914 Mon Sep 17 00:00:00 2001 From: nwhitehorn Date: Tue, 17 Dec 2013 14:55:23 +0000 Subject: [PATCH] MF10 259465: Add new sysctl, kern.supported_archs, containing the list of FreeBSD MACHINE_ARCH values whose binaries this kernel can run. This patch provides a feature requested for implementing pkgng ABI identifiers in a robust way. The list is designed to indicate whether, say, an i386 package can be run on the current system. If kern.supported_abis contains "i386", then the answer is yes. Otherwise, the answer is no. At the moment, this only supports MACHINE_ARCH and MACHINE_ARCH32. As we gain support for more interesting combinations, this needs to become more flexible, possibily through the sysent framework, along with the hw.machine_arch emulation immediately preceding this code in kern_mib.c. Reviewed by: imp Approved by: re (glebius) git-svn-id: svn://svn.freebsd.org/base/releng/10.0@259515 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/kern/kern_mib.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index c84d4b28..ac6196c5 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -261,6 +261,13 @@ sysctl_hw_machine_arch(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_hw, HW_MACHINE_ARCH, machine_arch, CTLTYPE_STRING | CTLFLAG_RD, NULL, 0, sysctl_hw_machine_arch, "A", "System architecture"); +SYSCTL_STRING(_kern, OID_AUTO, supported_archs, CTLFLAG_RD | CTLFLAG_MPSAFE, +#ifdef COMPAT_FREEBSD32 + MACHINE_ARCH " " MACHINE_ARCH32, 0, "Supported architectures for binaries"); +#else + MACHINE_ARCH, 0, "Supported architectures for binaries"); +#endif + static int sysctl_hostname(SYSCTL_HANDLER_ARGS) { -- 2.42.0