Fix build on macos

This commit is contained in:
Linus Dierheimer
2022-09-20 15:21:39 +02:00
parent a9cb178315
commit 01a917982c
+7 -7
View File
@@ -6,7 +6,7 @@
static void detectRam(FFMemoryStorage* ram)
{
memory->ram.bytesTotal = (uint64_t) ffSysctlGetInt64("hw.memsize", 0);
ram->bytesTotal = (uint64_t) ffSysctlGetInt64("hw.memsize", 0);
if(ram->bytesTotal == 0)
{
ffStrbufAppendS(&ram->error, "Failed to read hw.memsize");
@@ -28,21 +28,21 @@ static void detectRam(FFMemoryStorage* ram)
return;
}
memory->ram.bytesUsed = ((uint64_t) vmstat.active_count + vmstat.wire_count) * pagesize;
ram->bytesUsed = ((uint64_t) vmstat.active_count + vmstat.wire_count) * pagesize;
}
static void detectSwap(FFMemoryStorage* swap)
{
struct xsw_usage swap;
size_t size = sizeof(swap);
if(sysctlbyname("vm.swapusage", &swap, &size, 0, 0) != 0)
struct xsw_usage xsw;
size_t size = sizeof(xsw);
if(sysctlbyname("vm.swapusage", &xsw, &size, 0, 0) != 0)
{
ffStrbufAppendS(&swap->error, "Failed to read vm.swapusage");
return;
}
memory->swap.bytesTotal = swap.xsu_total;
memory->swap.bytesUsed = swap.xsu_used;
swap->bytesTotal = xsw.xsu_total;
swap->bytesUsed = xsw.xsu_used;
}
void ffDetectMemoryImpl(FFMemoryResult* memory)