Further FreeBSD compile fixes, thanks tolmaion

This commit is contained in:
Dennis Luxen 2011-09-28 17:11:51 +02:00
parent 816657347f
commit 0c4c1ce878

View File

@ -21,8 +21,9 @@
#ifndef MACHINE_INFO_H
#define MACHINE_INFO_H
#ifdef __APPLE__
#if defined(__APPLE__) || defined(__FreeBSD__)
extern "C" {
#include <sys/types.h>
#include <sys/sysctl.h>
}
#endif
@ -39,6 +40,13 @@ unsigned GetPhysicalmemory(void){
sysctl(mib, 2, &memsize, &len, NULL, 0);
return memsize/1024;
#elif defined(__FreeBSD__)
int mib[2] = {CTL_HW, HW_PHYSMEM};
long long memsize;
size_t len = sizeof(memsize);
sysctl(mib, 2, &memsize, &len, NULL, 0);
return memsize/1024;
#else
std::cout << "[Warning] Compiling on unknown architecture." << std::endl
<< "Please file a ticket at http://project-osrm.org" << std::endl;