Skip to content

Commit 41e22ea

Browse files
committed
Memory (OpenBSD): update formula to be consistant with other systems
1 parent 0b4a605 commit 41e22ea

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/detection/memory/memory_obsd.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
#include "common/sysctl.h"
33

44
#include <sys/param.h>
5-
6-
#if __NetBSD__
7-
#include <uvm/uvm_extern.h>
8-
#endif
5+
#include <uvm/uvm_extern.h>
96

107
const char* ffDetectMemory(FFMemoryResult* ram)
118
{
@@ -15,7 +12,7 @@ const char* ffDetectMemory(FFMemoryResult* ram)
1512
return "sysctl(CTL_VM, VM_UVMEXP) failed";
1613

1714
ram->bytesTotal = (uint64_t) buf.npages * instance.state.platform.sysinfo.pageSize;
18-
ram->bytesUsed = ram->bytesTotal - (uint64_t) buf.free * instance.state.platform.sysinfo.pageSize;
15+
ram->bytesUsed = ((uint64_t) buf.active + (uint64_t) buf.inactive + (uint64_t) buf.wired) * instance.state.platform.sysinfo.pageSize;
1916

2017
return NULL;
2118
}

0 commit comments

Comments
 (0)