diff options
| author | Anthony J. Bentley <anthony@anjbe.name> | 2016-07-17 04:06:38 -0600 |
|---|---|---|
| committer | Anthony J. Bentley <anthony@anjbe.name> | 2016-07-17 04:06:38 -0600 |
| commit | 242c770fe57d713d67cc56cec313cc276a1f86f9 (patch) | |
| tree | bc83c83cd7e958a93cb4b9b16fde99cc9bb346e5 /Source/Core/Common/MemoryUtil.cpp | |
| parent | 92594e08d44c2a2da8acec4394829e2e3695e236 (diff) | |
OpenBSD has a custom sysctl for physical memory.
Diffstat (limited to 'Source/Core/Common/MemoryUtil.cpp')
| -rw-r--r-- | Source/Core/Common/MemoryUtil.cpp | 6 |
1 files 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 <stdio.h> #include <sys/mman.h> #include <sys/types.h> -#if defined __APPLE__ || defined __FreeBSD__ +#if defined __APPLE__ || defined __FreeBSD__ || defined __OpenBSD__ #include <sys/sysctl.h> #else #include <sys/sysinfo.h> @@ -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); |
