On Wed, 14 Dec 2016 12:32:41 -0600 Nathan Zachary wrote: > On 14/12/16 12:29, Fabian Groffen wrote: > > On 14-12-2016 13:01:16 -0500, Doug Freed wrote: > >> On Wed, Dec 14, 2016 at 12:48 PM, Nathan Zachary > >> <nathanzach...@gentoo.org> wrote: > >>> On 14/12/16 10:11, Doug Freed wrote: > >>>>> I somehow doubt that would give me the expected number only, and I lack > >>>>> a BSD install handy to test it. > >>>> $(sysctl -n hw.ncpu) > >>>> > >>> I don't know that the sysctl command works universally: > >>> > >>> # sysctl -n hw.ncpu > >>> sysctl: cannot stat /proc/sys/hw/ncpu: No such file or directory > >>> > >> It's BSD-specific (Darwin may have it too, but I'm not in OS X at the > >> moment, so I can't check), which pretty much describes this branch in > >> the codepath as well. Linux users will have the nproc command from > >> coreutils. > > Yes, Darwin has it too, but the tool lives in /usr/sbin instead: > > > > https://gitweb.gentoo.org/repo/proj/prefix.git/tree/scripts/bootstrap-prefix.sh#n1987 > > > > Fabian > > > > > Ah, yes, I missed the part about it being BSD-specific. > > This one-liner certainly isn't as graceful or elegant, but it works: > > # cat /proc/cpuinfo | grep 'processor' | wc -l Not all BSD systems have procfs enabled.
Best regards, Andrew Savchenko
pgpPcS7wnPUVZ.pgp
Description: PGP signature