mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
vm_native: simplify vm.overcommit sysctl
dragonfly$ sysctl vm.overcommit sysctl: unknown oid 'vm.overcommit' freebsd$ rg VM_OVERCOMMIT /usr/include /usr/include/vm/vm_param.h 89:#define VM_OVERCOMMIT 12 /* vm.overcommit */
This commit is contained in:
parent
1a90adfb5e
commit
7a24642c56
@ -15,8 +15,9 @@
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if !defined(__linux__) && !defined(_WIN32)
|
||||
#if defined(__FreeBSD__)
|
||||
#include <sys/sysctl.h>
|
||||
#include <vm/vm_param.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
@ -461,13 +462,10 @@ namespace utils
|
||||
#if defined(__NetBSD__) || defined(__APPLE__)
|
||||
// Always ON
|
||||
vm_overcommit = 0;
|
||||
#elif defined(__FreeBSD__) && defined(VM_OVERCOMMIT)
|
||||
#elif defined(__FreeBSD__)
|
||||
int mib[2]{CTL_VM, VM_OVERCOMMIT};
|
||||
if (::sysctl(mib, 2, &vm_overcommit, &vm_sz, NULL, 0) != 0)
|
||||
vm_overcommit = -1;
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
if (::sysctlbyname("vm.overcommit", &vm_overcommit, &vm_sz, NULL, 0) != 0)
|
||||
vm_overcommit = -1;
|
||||
#else
|
||||
vm_overcommit = -1;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user