2016-12-14 19:32 GMT+01:00 Nathan Zachary <nathanzach...@gentoo.org>:
> 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 > # grep -c processor /proc/cpuinfo however Documentation/filesystems/proc.txt is very vague on it's content, just stating it has info on the cpu, better leave this as a backup value IMHO