git: 26b36a64be41 - main - sysctl kern.supported_archs: return correct value
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 21 Nov 2023 12:29:08 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=26b36a64be410cacbec1a5cabec091bf7de2b251 commit 26b36a64be410cacbec1a5cabec091bf7de2b251 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-11-16 21:58:45 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-11-21 11:56:06 +0000 sysctl kern.supported_archs: return correct value in case COMPAT_FREEBSD32 was enabled in config but hardware does not support executing 32bit binaries. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D42641 --- 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 b60c3c689449..c54dee21a1e1 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)