From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from smtprelay04.ispgateway.de ([80.67.29.8]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1Rpm0H-0002uL-8k for ptxdist@pengutronix.de; Tue, 24 Jan 2012 20:26:02 +0100 Received: from [88.217.112.198] (helo=galilei.fritz.box) by smtprelay04.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1Rpm0G-0002HC-Nt for ptxdist@pengutronix.de; Tue, 24 Jan 2012 20:26:00 +0100 From: Bernhard Walle Date: Tue, 24 Jan 2012 20:25:27 +0100 Message-Id: <1327433127-14523-1-git-send-email-bernhard@bwalle.de> Subject: [ptxdist] [PATCH] Support reading number of CPUs on Darwin and BSDs Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de Tested on Mac OS 10.7 (Lion). Signed-off-by: Bernhard Walle --- v2: Use /usr/sbin/sysctl instead of relying on the $PATH and don't check for the operating system but just try it out. bin/ptxdist | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/bin/ptxdist b/bin/ptxdist index 74a52ad..52e9c76 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 ))" -- 1.7.7.4 -- ptxdist mailing list ptxdist@pengutronix.de