mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] Support reading number of CPUs on Mac OS X
@ 2012-01-22 20:47 Bernhard Walle
  2012-01-24  9:19 ` Michael Olbrich
  0 siblings, 1 reply; 3+ messages in thread
From: Bernhard Walle @ 2012-01-22 20:47 UTC (permalink / raw)
  To: ptxdist

Tested on 10.7 (Lion).

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
 bin/ptxdist |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/bin/ptxdist b/bin/ptxdist
index 74a52ad..4edbac3 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -2093,6 +2093,8 @@ setup_config() {
 		if [ ${cpus} -eq 0 ]; then
 			cpus=1
 		fi
+	elif [ "$(uname -s)" = Darwin ] ; then
+		cpus=$(sysctl -n hw.ncpu)
 	else
 		cpus=1
 	fi
-- 
1.7.7.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ptxdist] [PATCH] Support reading number of CPUs on Mac OS X
  2012-01-22 20:47 [ptxdist] [PATCH] Support reading number of CPUs on Mac OS X Bernhard Walle
@ 2012-01-24  9:19 ` Michael Olbrich
  2012-01-24 18:04   ` Bernhard Walle
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Olbrich @ 2012-01-24  9:19 UTC (permalink / raw)
  To: ptxdist

On Sun, Jan 22, 2012 at 09:47:47PM +0100, Bernhard Walle wrote:
> Tested on 10.7 (Lion).
> 
> Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
> ---
>  bin/ptxdist |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/bin/ptxdist b/bin/ptxdist
> index 74a52ad..4edbac3 100755
> --- a/bin/ptxdist
> +++ b/bin/ptxdist
> @@ -2093,6 +2093,8 @@ setup_config() {
>  		if [ ${cpus} -eq 0 ]; then
>  			cpus=1
>  		fi
> +	elif [ "$(uname -s)" = Darwin ] ; then
> +		cpus=$(sysctl -n hw.ncpu)

- Is sysctl alwyas in $PATH? On Linux it's in sbin.
- the value should be quoted.
- Does this _always_ and _only_ work on Mac OS X?

Maybe something like this:

	elfi ! cpus="$(sysctl -n hw.ncpu)" 2> /dev/null; then
		cpus=1
	fi

Michael

>  	else
>  		cpus=1
>  	fi
> -- 
> 1.7.7.4
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ptxdist] [PATCH] Support reading number of CPUs on Mac OS X
  2012-01-24  9:19 ` Michael Olbrich
@ 2012-01-24 18:04   ` Bernhard Walle
  0 siblings, 0 replies; 3+ messages in thread
From: Bernhard Walle @ 2012-01-24 18:04 UTC (permalink / raw)
  To: ptxdist

Hi Michael,

Am 24.01.12 10:19, schrieb Michael Olbrich:
> 
> - Is sysctl alwyas in $PATH? On Linux it's in sbin.

I think so, but it's in /usr/sbin, so I can use /usr/sbin/syctl to be
more safe.

> - the value should be quoted.

ok.

> - Does this _always_ and _only_ work on Mac OS X?

Good point. I have no other system than Linux and Mac OS here, but
according to http://systhread.net/texts/200008sysctl.php it should work
on all BSDs, so yes, your solution is better.

Will create a new version of the patch later in the evening.


Regards,
Bernhard

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-24 18:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-22 20:47 [ptxdist] [PATCH] Support reading number of CPUs on Mac OS X Bernhard Walle
2012-01-24  9:19 ` Michael Olbrich
2012-01-24 18:04   ` Bernhard Walle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox