NetBSD: Add support for retrieving the number of available CPUs
authorKamil Rytarowski <n54@gmx.com>
Thu, 21 Jan 2016 19:03:31 +0000 (20:03 +0100)
committerKamil Rytarowski <n54@gmx.com>
Thu, 21 Jan 2016 19:43:59 +0000 (20:43 +0100)
$ uname
NetBSD
$ getconf NPROCESSORS_ONLN
2
$ getconf _NPROCESSORS_ONLN
getconf: _NPROCESSORS_ONLN: unknown variable

build.sh
run-cppcheck.sh

index 67bc2c5..807a57a 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -129,6 +129,8 @@ build_coreclr()
     # processors available to a single process.
     if [ `uname` = "FreeBSD" ]; then
         NumProc=`sysctl hw.ncpu | awk '{ print $2+1 }'`
+    elif [ `uname` = "NetBSD" ]; then
+        NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
     else
         NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
     fi
index 6888468..c505fd1 100755 (executable)
@@ -41,6 +41,8 @@ SloccountOutput="sloccount.sc"
 # processors available to a single process.
 if [ `uname` = "FreeBSD" ]; then
 NumProc=`sysctl hw.ncpu | awk '{ print $2+1 }'`
+elif [ `uname` = "NetBSD" ]; then
+NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
 else
 NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
 fi
@@ -114,4 +116,4 @@ then
 fi
 
 echo Check finished.  Results can be found in: $CppCheckOutputs $SlocCountOutputs
-exit 0
\ No newline at end of file
+exit 0