forked from 0ad/0ad
janwas
9d2acce9d8
- deleted most old libraries/headers in codepit to avoid confusion (they are now in SVN anyway). updated required-libraries-linux.txt accordingly - moved rand() into separate file, out of lib.cpp - removed CGUIScrollBarStyle.cpp to avoid empty-file warning - wxwidgets.h: remove redundant #pragma lib and include wxw PCH - move openal-specific stuff to external_libraries/openal.h - cpu, bsd: macosx is-a bsd, so only test OS_BSD This was SVN commit r5082.
31 lines
604 B
C++
31 lines
604 B
C++
#include "precompiled.h"
|
|
#include "bsd.h"
|
|
|
|
#if OS_BSD
|
|
|
|
#include <sys/sysctl.h>
|
|
|
|
static int SysctlFromMemType(CpuMemoryIndicators mem_type)
|
|
{
|
|
switch(mem_type)
|
|
{
|
|
case CPU_MEM_TOTAL:
|
|
return HW_PHYSMEM;
|
|
case CPU_MEM_AVAILABLE:
|
|
return HW_USERMEM;
|
|
}
|
|
UNREACHABLE;
|
|
}
|
|
|
|
size_t bsd_MemorySize(CpuMemoryIndicators mem_type)
|
|
{
|
|
size_t memory_size = 0;
|
|
size_t len = sizeof(memory_size);
|
|
// Argh, the API doesn't seem to be const-correct
|
|
/*const*/ int mib[2] = { CTL_HW, SysctlFromMemType(mem_type) };
|
|
sysctl(mib, 2, &memory_size, &len, 0, 0);
|
|
return memory_size;
|
|
}
|
|
|
|
#endif
|