From 7a24642c56f10292f435698ed769c9ca7a42959c Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Mon, 11 Oct 2021 22:37:10 +0000 Subject: [PATCH] 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 */ --- rpcs3/util/vm_native.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/rpcs3/util/vm_native.cpp b/rpcs3/util/vm_native.cpp index 36c6d08944..7bc7526e0b 100644 --- a/rpcs3/util/vm_native.cpp +++ b/rpcs3/util/vm_native.cpp @@ -15,8 +15,9 @@ #include #endif -#if !defined(__linux__) && !defined(_WIN32) +#if defined(__FreeBSD__) #include +#include #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