diff options
| author | Matthew Parlane <parlane@gmail.com> | 2015-06-14 15:18:26 +1000 |
|---|---|---|
| committer | Matthew Parlane <parlane@gmail.com> | 2015-06-14 15:18:26 +1000 |
| commit | b39014eac5a5dbc8cc725cfe8c0b3962bdac075f (patch) | |
| tree | e1852e2d9300cbdacc920aec1dac7cb25a14419b /Source/Core/Common/MemoryUtil.cpp | |
| parent | 252c7195151f6b91b16cf9d42f12c0d431d77e50 (diff) | |
| parent | 1b9f55692bd0a88df745f97674cbe03f9ddfae10 (diff) | |
Merge pull request #2590 from endrift/fix-freebsd-build
Fix FreeBSD
Diffstat (limited to 'Source/Core/Common/MemoryUtil.cpp')
| -rw-r--r-- | Source/Core/Common/MemoryUtil.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/Core/Common/MemoryUtil.cpp b/Source/Core/Common/MemoryUtil.cpp index 510b258b09..c2befe56a6 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> -#ifdef __APPLE__ +#if defined __APPLE__ || defined __FreeBSD__ #include <sys/sysctl.h> #else #include <sys/sysinfo.h> @@ -256,11 +256,15 @@ size_t MemPhysical() memInfo.dwLength = sizeof(MEMORYSTATUSEX); GlobalMemoryStatusEx(&memInfo); return memInfo.ullTotalPhys; -#elif defined(__APPLE__) +#elif defined __APPLE__ || defined __FreeBSD__ int mib[2]; size_t physical_memory; mib[0] = CTL_HW; +#ifdef __APPLE__ mib[1] = HW_MEMSIZE; +#elif defined __FreeBSD__ + mib[1] = HW_REALMEM; +#endif size_t length = sizeof(size_t); sysctl(mib, 2, &physical_memory, &length, NULL, 0); return physical_memory; |
