Re: chainlink.pl /proc/cpuinfo regexp fails on s390x
- From
Andreas Schwab <schwab@linux-m68k.org>
- Date
- Nov 23, 2022, 09:27 UTC
- Message-ID
- <mvm1qpu9g2e.fsf@linux-m68k.org>
- In-Reply-To
- <CAPig+cRchF_6t-B-cZHLHAH_E6qNmapTezSfCj9AZ8cfWNzivw@mail.gmail.com>
On Nov 22 2022, Eric Sunshine wrote:
Show 16 quoted lines
> On Tue, Nov 22, 2022 at 6:37 PM Andreas Schwab <schwab@linux-m68k.org> wrote: >> On Nov 22 2022, Andreas Hasenack wrote: >> > /^processor[\s\d]*:/ >> > or something else. >> >> Something else. >> >> $ getconf _NPROCESSORS_ONLN > > Yes, that works too and was (I'm pretty sure) considered during > development. The reason /proc/cpu was chosen over `getconf` was that > opening & reading /proc/cpu should be faster since it doesn't involve > spawning a process. If we did use `getconf`, we'd have to be careful > to degrade gracefully if `getconf` isn't available or if the > configuration parameter (i.e. "_NPROCESSORS_ONLN") isn't known on the > platform.
getconf is surely more portable than poking in /proc, especially /proc/cpuinfo is the antipode of portability.
-- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."