diff options
author | Bernhard Walle <bernhard@bwalle.de> | 2012-01-24 20:25:27 +0100 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2012-01-25 14:11:13 +0100 |
commit | a7bc7edd14b8a1a499b6a43343385df8f225d16b (patch) | |
tree | 37ec0a688a342f5b1d1bdb047a5ab403fb7b65d7 | |
parent | 139afcac830e7c26401a47faf8b2d20400eedcb0 (diff) | |
download | ptxdist-a7bc7edd14b8a1a499b6a43343385df8f225d16b.tar.gz ptxdist-a7bc7edd14b8a1a499b6a43343385df8f225d16b.tar.xz |
Support reading number of CPUs on Darwin and BSDs
Tested on Mac OS 10.7 (Lion).
Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rwxr-xr-x | bin/ptxdist | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/ptxdist b/bin/ptxdist index 74a52adac..52e9c766a 100755 --- a/bin/ptxdist +++ b/bin/ptxdist @@ -2088,12 +2088,14 @@ setup_config() { local pmf_extern="-j1" local cpus + # this one is for Linux if [ -r /proc/cpuinfo ]; then cpus="$(egrep '^(processor|cpu )' /proc/cpuinfo | wc -l)" if [ ${cpus} -eq 0 ]; then cpus=1 fi - else + # and this one is tested on Darwin and should work on BSDs + elif ! cpus="$(/usr/sbin/sysctl -n hw.ncpu)" 2> /dev/null; then cpus=1 fi local pmf_intern="-j$(( ${cpus} * 2 ))" |