summaryrefslogtreecommitdiff
path: root/libs/pbd/cpus.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-06-26 16:43:07 +0200
committerRobin Gareus <robin@gareus.org>2016-06-26 16:43:07 +0200
commit86763cba906dba3fdbc0c99a42a3f7123eaa380d (patch)
tree2d682830df4637d1b75fab880ec0f2ce98af6b13 /libs/pbd/cpus.cc
parente37b250d4d3d483e708db60ac9774342fd4b9700 (diff)
Enable build for FreeBSD (part 1/2)
Adopted from Michael Beer -- GH pull-request #232 with minor changes: * rebased on master, * removed trailing whitespace, * don't explicitly change saved configuration defaults (wscript) * moved sys/wait (WNOHANG) to header include * separate changes in GUI and lib
Diffstat (limited to 'libs/pbd/cpus.cc')
-rw-r--r--libs/pbd/cpus.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/pbd/cpus.cc b/libs/pbd/cpus.cc
index fb94b475de..69421e5e92 100644
--- a/libs/pbd/cpus.cc
+++ b/libs/pbd/cpus.cc
@@ -43,10 +43,14 @@ hardware_concurrency()
{
#if defined(PTW32_VERSION) || defined(__hpux)
return pthread_num_processors_np();
-#elif defined(__APPLE__) || defined(__FreeBSD__)
+#elif defined(__APPLE__)
int count;
size_t size=sizeof(count);
return sysctlbyname("hw.physicalcpu",&count,&size,NULL,0)?0:count;
+#elif defined(__FreeBSD__)
+ int count;
+ size_t size=sizeof(count);
+ return sysctlbyname("hw.ncpu",&count,&size,NULL,0)?0:count;
#elif defined(HAVE_UNISTD) && defined(_SC_NPROCESSORS_ONLN)
int const count=sysconf(_SC_NPROCESSORS_ONLN);
return (count>0)?count:0;