From 9351938b15d154474b6c0f699fcddb8066a40b79 Mon Sep 17 00:00:00 2001 From: "Greg A. Woods" Date: Tue, 2 Jun 2026 12:05:42 -0700 Subject: [PATCH 1/2] hbc_mini.c: make it compile on NetBSD Use the public "struct uvmexp_sysctl" instead of "struct uvmexp". The numbers from the memory_monitor are wonky, but it builds and runs. --- scripts/c/hbc_mini.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/c/hbc_mini.c b/scripts/c/hbc_mini.c index 23b9eb6..92a9926 100644 --- a/scripts/c/hbc_mini.c +++ b/scripts/c/hbc_mini.c @@ -896,7 +896,7 @@ static void plugin_memory_monitor(conn_t *c, const config_t *cfg) { static void plugin_memory_monitor(conn_t *c, const config_t *cfg) { (void)cfg; - struct uvmexp uvm; + struct uvmexp_sysctl uvm; size_t len = sizeof(uvm); int mib[2] = {CTL_VM, VM_UVMEXP}; if (sysctl(mib, 2, &uvm, &len, NULL, 0) != 0) return; From 862a9cdea0c42217130d3bdd49e53ac8a45b2b3c Mon Sep 17 00:00:00 2001 From: "Greg A. Woods" Date: Tue, 2 Jun 2026 13:42:11 -0700 Subject: [PATCH 2/2] hbc_mini.c: make it work on NetBSD This fixes the numbers by using the correct MIB to match the struct. --- scripts/c/hbc_mini.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/c/hbc_mini.c b/scripts/c/hbc_mini.c index 92a9926..155f650 100644 --- a/scripts/c/hbc_mini.c +++ b/scripts/c/hbc_mini.c @@ -789,7 +789,7 @@ static void plugin_cpu_monitor(conn_t *c, const config_t *cfg) { * Plugin: memory_monitor * Linux: /proc/meminfo * FreeBSD: sysctl vm.stats.vm.* - * NetBSD: sysctl vm.uvmexp (struct uvmexp) + * NetBSD: sysctl vm.uvmexp (struct uvmexp_sysctl) * ============================================================ */ /* emit the common kvdict fields and send */ @@ -898,7 +898,7 @@ static void plugin_memory_monitor(conn_t *c, const config_t *cfg) { (void)cfg; struct uvmexp_sysctl uvm; size_t len = sizeof(uvm); - int mib[2] = {CTL_VM, VM_UVMEXP}; + int mib[2] = {CTL_VM, VM_UVMEXP2}; if (sysctl(mib, 2, &uvm, &len, NULL, 0) != 0) return; long long ps = uvm.pagesize;