diff options
author | Ian Moffett <ian@osmora.org> | 2025-08-11 05:10:42 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-08-11 05:10:42 -0400 |
commit | 90861a9b3594074ac7d21d8fe8752b2df01587d6 (patch) | |
tree | 48cf3b4a270796c73ad298af1ad5875b422bb29f | |
parent | 601cec0d230f4abfb7fed008e18e03c192ff2750 (diff) |
kernel: sysctl: Add 'proc.count' entry
Introduce the 'proc.count' sysctl variable which contains the number of
running processes in the system.
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | sys/include/sys/sysctl.h | 5 | ||||
-rw-r--r-- | sys/kern/kern_sysctl.c | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/sys/include/sys/sysctl.h b/sys/include/sys/sysctl.h index 3b8d3c7..ce7510d 100644 --- a/sys/include/sys/sysctl.h +++ b/sys/include/sys/sysctl.h @@ -56,6 +56,11 @@ #define HW_MACHINE 7 /* + * List of 'proc.*' identifiers + */ +#define PROC_COUNT 8 + +/* * Option types (i.e., int, string, etc) for * sysctl entries. * diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index a4c16bb..1f5e578 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -40,6 +40,7 @@ HYRA_VERSION " " \ HYRA_BUILDDATE +extern size_t g_nthreads; static uint32_t pagesize = DEFAULT_PAGESIZE; static char machine[] = HYRA_ARCH; static char hyra[] = "Hyra"; @@ -62,7 +63,10 @@ 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_MACHINE] = {HW_MACHINE, SYSCTL_OPTYPE_STR_RO, &machine } + [HW_MACHINE] = {HW_MACHINE, SYSCTL_OPTYPE_STR_RO, &machine }, + + /* 'proc.*' */ + [PROC_COUNT] = { PROC_COUNT, SYSCTL_OPTYPE_INT_RO, &g_nthreads } }; static int |