util/os_misc: os_get_available_system_memory() for FreeBSD
Based on the OpenBSD variant. The only difference between those two system is the sysctl mib. Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6995>
This commit is contained in:

committed by
Marge Bot

parent
9aa5c7ce72
commit
fe894dc0b3
@@ -58,7 +58,7 @@
|
||||
# include <log/log.h>
|
||||
#elif DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || DETECT_OS_HURD
|
||||
# include <unistd.h>
|
||||
#elif DETECT_OS_OPENBSD
|
||||
#elif DETECT_OS_OPENBSD || DETECT_OS_FREEBSD
|
||||
# include <sys/resource.h>
|
||||
# include <sys/sysctl.h>
|
||||
#elif DETECT_OS_APPLE || DETECT_OS_BSD
|
||||
@@ -213,9 +213,13 @@ os_get_available_system_memory(uint64_t *size)
|
||||
|
||||
free(meminfo);
|
||||
return false;
|
||||
#elif DETECT_OS_OPENBSD
|
||||
#elif DETECT_OS_OPENBSD || DETECT_OS_FREEBSD
|
||||
struct rlimit rl;
|
||||
#if DETECT_OS_OPENBSD
|
||||
int mib[] = { CTL_HW, HW_USERMEM64 };
|
||||
#elif DETECT_OS_FREEBSD
|
||||
int mib[] = { CTL_HW, HW_USERMEM };
|
||||
#endif
|
||||
int64_t mem_available;
|
||||
size_t len = sizeof(mem_available);
|
||||
|
||||
|
Reference in New Issue
Block a user