libobs/util: Fix build on FreeBSD

FreeBSD already implemented os_get_free_size.  Move the new Linux
implementation into the existing not-__FreeBSD__ block.

Fixes: 935613816f ("libobs/util: Update `os_get_free_size()`")
This commit is contained in:
Ed Maste 2025-05-02 13:41:23 -04:00 • committed by Ryan Foster
commit 6204c22853

View file

@ -1087,6 +1087,20 @@ uint64_t os_get_proc_virtual_size(void)
return 0;
return (uint64_t)statm.virtual_size;
}
uint64_t os_get_sys_free_size(void)
{
uint64_t free_memory = 0;
#ifndef __OpenBSD__
struct sysinfo info;
if (sysinfo(&info) < 0)
return 0;
free_memory = ((uint64_t)info.freeram + (uint64_t)info.bufferram) * info.mem_unit;
#endif
return free_memory;
}
#endif
static uint64_t total_memory = 0;
@ -1113,19 +1127,6 @@ uint64_t os_get_sys_total_size(void)
return total_memory;
}
uint64_t os_get_sys_free_size(void)
{
uint64_t free_memory = 0;
#ifndef __OpenBSD__
struct sysinfo info;
if (sysinfo(&info) < 0)
return 0;
free_memory = ((uint64_t)info.freeram + (uint64_t)info.bufferram) * info.mem_unit;
#endif
return free_memory;
}
#endif
#ifndef __APPLE__