0ad/source/lib/sysdep/unix/bsd.cpp
janwas 73683b6109 # SwEng
. the massive renaming undertaking: camelCase functions -> PascalCase.
. add some cppdoc.
. minor additional renaming improvements: e.g. GetIsClosed -> IsClosed
. in entity code, replace constructs like "pvec = new vector; return
pvec; use *pvec; delete pvec" with a simple stack variable passed as
output parameter (avoid unnecessary dynamic allocs)
. timer: simpler handling of raw ticks vs normal timer (less #if)

This was SVN commit r5017.
2007-05-02 12:07:08 +00:00

28 lines
513 B
C++

#include "precompiled.h"
#include "bsd.h"
#if OS_BSD
static int SysctlFromMemType(CpuMemoryIndicators mem_type)
{
switch(mem_type)
{
case MEM_TOTAL:
return HW_PHYSMEM;
case MEM_AVAILABLE:
return HW_USERMEM;
}
UNREACHABLE;
}
size_t bsd_MemorySize(CpuMemoryIndicators mem_type)
{
size_t memory_size = 0;
size_t len = sizeof(memory_size);
const int mib[2] = { CTL_HW, SysctlFromMemType(mem_type) };
sysctl(mib, 2, &memory_size, &len, 0, 0);
return memory_size;
}
#endif