From 41e22ea8667bb7f27b0b0da83240ab13b7d85d90 Mon Sep 17 00:00:00 2001 From: carterli Date: Mon, 13 Jan 2025 18:29:18 +0800 Subject: [PATCH] Memory (OpenBSD): update formula to be consistant with other systems --- src/detection/memory/memory_obsd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/detection/memory/memory_obsd.c b/src/detection/memory/memory_obsd.c index 3dda7656a..e58bf0d37 100644 --- a/src/detection/memory/memory_obsd.c +++ b/src/detection/memory/memory_obsd.c @@ -2,10 +2,7 @@ #include "common/sysctl.h" #include - -#if __NetBSD__ - #include -#endif +#include const char* ffDetectMemory(FFMemoryResult* ram) { @@ -15,7 +12,7 @@ const char* ffDetectMemory(FFMemoryResult* ram) return "sysctl(CTL_VM, VM_UVMEXP) failed"; ram->bytesTotal = (uint64_t) buf.npages * instance.state.platform.sysinfo.pageSize; - ram->bytesUsed = ram->bytesTotal - (uint64_t) buf.free * instance.state.platform.sysinfo.pageSize; + ram->bytesUsed = ((uint64_t) buf.active + (uint64_t) buf.inactive + (uint64_t) buf.wired) * instance.state.platform.sysinfo.pageSize; return NULL; }