mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Bernhard Walle <bernhard@bwalle.de>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH] Support reading number of CPUs on Darwin and BSDs
Date: Tue, 24 Jan 2012 20:25:27 +0100	[thread overview]
Message-ID: <1327433127-14523-1-git-send-email-bernhard@bwalle.de> (raw)

Tested on Mac OS 10.7 (Lion).

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
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

                 reply	other threads:[~2012-01-24 19:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1327433127-14523-1-git-send-email-bernhard@bwalle.de \
    --to=bernhard@bwalle.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox