mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-11 09:18:40 +12: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
1 changed files with 3 additions and 5 deletions
|
@ -15,8 +15,9 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__linux__) && !defined(_WIN32)
|
#if defined(__FreeBSD__)
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
#include <vm/vm_param.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
@ -461,13 +462,10 @@ namespace utils
|
||||||
#if defined(__NetBSD__) || defined(__APPLE__)
|
#if defined(__NetBSD__) || defined(__APPLE__)
|
||||||
// Always ON
|
// Always ON
|
||||||
vm_overcommit = 0;
|
vm_overcommit = 0;
|
||||||
#elif defined(__FreeBSD__) && defined(VM_OVERCOMMIT)
|
#elif defined(__FreeBSD__)
|
||||||
int mib[2]{CTL_VM, VM_OVERCOMMIT};
|
int mib[2]{CTL_VM, VM_OVERCOMMIT};
|
||||||
if (::sysctl(mib, 2, &vm_overcommit, &vm_sz, NULL, 0) != 0)
|
if (::sysctl(mib, 2, &vm_overcommit, &vm_sz, NULL, 0) != 0)
|
||||||
vm_overcommit = -1;
|
vm_overcommit = -1;
|
||||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
|
||||||
if (::sysctlbyname("vm.overcommit", &vm_overcommit, &vm_sz, NULL, 0) != 0)
|
|
||||||
vm_overcommit = -1;
|
|
||||||
#else
|
#else
|
||||||
vm_overcommit = -1;
|
vm_overcommit = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue