From 06f1fb09a830b89da5854eb6f5b1b5d4c8a7f41c Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 7 Aug 2025 03:17:03 -0400 Subject: kernel: sysctl: Add 'hw.machine' variable Introduce the 'hw.machine' sysctl variable to represent the current machine architecture. Signed-off-by: Ian Moffett --- sys/include/sys/sysctl.h | 1 + sys/kern/kern_sysctl.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'sys') diff --git a/sys/include/sys/sysctl.h b/sys/include/sys/sysctl.h index 0086847..3b8d3c7 100644 --- a/sys/include/sys/sysctl.h +++ b/sys/include/sys/sysctl.h @@ -53,6 +53,7 @@ */ #define HW_PAGESIZE 5 #define HW_NCPU 6 +#define HW_MACHINE 7 /* * Option types (i.e., int, string, etc) for diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 9b3d301..a4c16bb 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -41,6 +41,7 @@ HYRA_BUILDDATE static uint32_t pagesize = DEFAULT_PAGESIZE; +static char machine[] = HYRA_ARCH; static char hyra[] = "Hyra"; static char hyra_version[] = HYRA_VERSION; static char osrelease[] = HYRA_RELEASE; @@ -60,7 +61,8 @@ static struct sysctl_entry common_optab[] = { /* 'hw.*' */ [HW_PAGESIZE] = { HW_PAGESIZE, SYSCTL_OPTYPE_INT_RO, &pagesize }, - [HW_NCPU] = { HW_NCPU, SYSCTL_OPTYPE_INT, NULL } + [HW_NCPU] = { HW_NCPU, SYSCTL_OPTYPE_INT, NULL }, + [HW_MACHINE] = {HW_MACHINE, SYSCTL_OPTYPE_STR_RO, &machine } }; static int -- cgit v1.2.3