From nobody Tue Nov 21 12:29:08 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SZNwP29JRz51Wdh; Tue, 21 Nov 2023 12:29:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SZNwP1QHRz3TV8; Tue, 21 Nov 2023 12:29:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700569749; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2NEXep5DtTyX++dKLqNGPY/+WeQVD5VbMJ0seXQHbBo=; b=GG3+CrXK9Rg56PlViq8rb24NLox1J+VIUWH//xdXKJgVx6bi2qKDS3y3ywUPeweGqlj9VQ lexKMtPGOlFK9wB9criZQYxtpx0pep+MFlkti7AI2++vpxPswiEmM9xFOn78lypjeMFY+n RH8pM/SVdms2z4EVR11Yqa68jWCpx4NcCs8T5zQmSBTLQzV6BOwQZAJysbuIF+oK9oANXF TTBBppQuL8Aj+PNMka0Lz8Y9eeo4iYGa2UwscI/FurKCKov9qgBc/lluGxk38GKv4Io/Xg XYwmPFQ1ipJmZn5fIBbHEwgnFwctaiqJSYRMRYZuoWJ8kcybtIUaiJf2K2zLCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700569749; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2NEXep5DtTyX++dKLqNGPY/+WeQVD5VbMJ0seXQHbBo=; b=KgFnq7o4qfM4JAeJPWbbm7Ti1A9yjg6tXYj+vSKmJojMqt+llhsYM0lKO7IkRKnYkIyrDL bhjLpQRQy+WcXwN+qkJNlXTXPnK10I5v9hiGEvLS80SK62X6vws4nNJcbpXHmZbE5Cd1Df 5lQJfx3GGQdgD0aW+yGHbRiZ5vNOIjb/nd9Zqpq4QSuBGrHuM4iIrvrWezCXacdeh7Uhet mIjFLN/H4h+UOQRWG1NchbwbGACgHTj3dQ63MjBlIGsLZ9+PyL8jZb8fElWCpf5nuT1TLh s+DPY5SvIxkZPilRO/OLWM3KevNX92S7kKRl2EBWadKmG3gqwRfn0dLiLeK2vw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700569749; a=rsa-sha256; cv=none; b=LTG/S+RXi2RGKKki3BpzcNxW/kG0Lwaz21FhrkzcbqfGL2J3rbQhOblC54Lj8lY/g8CXMw 8I9wuNdtOotgE2rT5MHsFY+9RJkTFTWBSiphaFVlM726n0YVBmoEHTs3WU+0eDJRlPKbdG MG14OuSIj3yT9DFV/oslYEvgUC6NEGN88huVd3RcnPLYan2YPyYytiUnthZK4GrIl01CrZ oRF36XzJYFONvxmNsiEXX1yjDyMXhpdWVfGOhDfDs+1qDZDu6swbaeNEhU5V1eE2AdCLeO JDfpfcrq3D8UOFZ4DXDKOdrE9fZznNrkPLHDa10Y0EgdMsu0rKmZRjglVybdxw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SZNwP0VN6zbRj; Tue, 21 Nov 2023 12:29:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3ALCT8SN026684; Tue, 21 Nov 2023 12:29:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3ALCT8Eq026681; Tue, 21 Nov 2023 12:29:08 GMT (envelope-from git) Date: Tue, 21 Nov 2023 12:29:08 GMT Message-Id: <202311211229.3ALCT8Eq026681@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 26b36a64be41 - main - sysctl kern.supported_archs: return correct value List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 26b36a64be410cacbec1a5cabec091bf7de2b251 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=26b36a64be410cacbec1a5cabec091bf7de2b251 commit 26b36a64be410cacbec1a5cabec091bf7de2b251 Author: Konstantin Belousov AuthorDate: 2023-11-16 21:58:45 +0000 Commit: Konstantin Belousov 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 #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)