From 242c770fe57d713d67cc56cec313cc276a1f86f9 Mon Sep 17 00:00:00 2001 From: "Anthony J. Bentley" Date: Sun, 17 Jul 2016 04:06:38 -0600 Subject: [PATCH] OpenBSD has a custom sysctl for physical memory. --- Source/Core/Common/MemoryUtil.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Core/Common/MemoryUtil.cpp b/Source/Core/Common/MemoryUtil.cpp index aa284ab091..1941f8e35b 100644 --- a/Source/Core/Common/MemoryUtil.cpp +++ b/Source/Core/Common/MemoryUtil.cpp @@ -20,7 +20,7 @@ #include #include #include -#if defined __APPLE__ || defined __FreeBSD__ +#if defined __APPLE__ || defined __FreeBSD__ || defined __OpenBSD__ #include #else #include @@ -253,7 +253,7 @@ size_t MemPhysical() memInfo.dwLength = sizeof(MEMORYSTATUSEX); GlobalMemoryStatusEx(&memInfo); return memInfo.ullTotalPhys; -#elif defined __APPLE__ || defined __FreeBSD__ +#elif defined __APPLE__ || defined __FreeBSD__ || defined __OpenBSD__ int mib[2]; size_t physical_memory; mib[0] = CTL_HW; @@ -261,6 +261,8 @@ size_t MemPhysical() mib[1] = HW_MEMSIZE; #elif defined __FreeBSD__ mib[1] = HW_REALMEM; +#elif defined __OpenBSD__ + mib[1] = HW_PHYSMEM; #endif size_t length = sizeof(size_t); sysctl(mib, 2, &physical_memory, &length, NULL, 0);