summaryrefslogtreecommitdiff
path: root/Source/Core/Common/MemoryUtil.cpp
diff options
context:
space:
mode:
authorMatthew Parlane <parlane@gmail.com>2016-07-18 16:12:06 +1200
committerGitHub <noreply@github.com>2016-07-18 16:12:06 +1200
commita51c992e6168fa7e10e2ada6168d7f1b38aad961 (patch)
treef0e73c953491c9e4aea18d9a2aa3ff679c2cf31f /Source/Core/Common/MemoryUtil.cpp
parent7139b6bae6301f667a9ebff2ec7f7dc1820bbf2c (diff)
parentcdf62dece39634367e9608db635c4f84c7a3b88c (diff)
Merge pull request #4018 from bentley/openbsd-ifdefs
Openbsd ifdefs
Diffstat (limited to 'Source/Core/Common/MemoryUtil.cpp')
-rw-r--r--Source/Core/Common/MemoryUtil.cpp6
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);