git: c4a62edfe2a3 - stable/14 - sysctl kern.supported_archs: return correct value
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 28 Nov 2023 11:40:48 UTC
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c4a62edfe2a333d8709efc69cb9921c1a1894bb8 commit c4a62edfe2a333d8709efc69cb9921c1a1894bb8 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-11-16 21:58:45 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-11-28 11:39:38 +0000 sysctl kern.supported_archs: return correct value (cherry picked from commit 26b36a64be410cacbec1a5cabec091bf7de2b251) --- sys/kern/kern_mib.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index 9094d09550ee..6c19deab1d25 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -316,16 +316,25 @@ SYSCTL_PROC(_hw, HW_MACHINE_ARCH, machine_arch, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_CAPRD | CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine_arch, "A", "System architecture"); -#ifndef MACHINE_ARCHES #ifdef COMPAT_FREEBSD32 -#define MACHINE_ARCHES MACHINE_ARCH " " MACHINE_ARCH32 -#else -#define MACHINE_ARCHES MACHINE_ARCH -#endif +#include <compat/freebsd32/freebsd32_util.h> #endif -SYSCTL_STRING(_kern, OID_AUTO, supported_archs, CTLFLAG_RD | CTLFLAG_MPSAFE, - MACHINE_ARCHES, 0, "Supported architectures for binaries"); +static int +sysctl_kern_supported_archs(SYSCTL_HANDLER_ARGS) +{ + const char *supported_archs; + + supported_archs = +#ifdef COMPAT_FREEBSD32 + compat_freebsd_32bit ? MACHINE_ARCH " " MACHINE_ARCH32 : +#endif + MACHINE_ARCH; + return (SYSCTL_OUT(req, supported_archs, strlen(supported_archs) + 1)); +} +SYSCTL_PROC(_kern, OID_AUTO, supported_archs, CTLFLAG_RD | CTLFLAG_MPSAFE | + CTLFLAG_CAPRD | CTLTYPE_STRING, NULL, 0, sysctl_kern_supported_archs, "A", + "Supported architectures for binaries"); static int sysctl_hostname(SYSCTL_HANDLER_ARGS)