From 7085fcc8d66267429fc6734be4ff0c563b9ff50a Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Wed, 10 Jun 2015 22:15:11 -0700 Subject: Fix FreeBSD build --- Source/Core/Common/MemoryUtil.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Source/Core/Common/MemoryUtil.cpp') 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 #include #include -#ifdef __APPLE__ +#if defined __APPLE__ || defined __FreeBSD__ #include #else #include @@ -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; -- cgit v1.2.3