Skip to content

Commit

Permalink
Memory (OpenBSD): update formula to be consistant with other systems
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Jan 13, 2025
1 parent 0b4a605 commit 41e22ea
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/detection/memory/memory_obsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
#include "common/sysctl.h"

#include <sys/param.h>

#if __NetBSD__
#include <uvm/uvm_extern.h>
#endif
#include <uvm/uvm_extern.h>

const char* ffDetectMemory(FFMemoryResult* ram)
{
Expand All @@ -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;
}

0 comments on commit 41e22ea

Please sign in to comment.