commit: da3d743b6a0d32e6f9c4dc9e6a5b046241d1e8c1
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jan 11 09:35:03 2026 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sun Jan 11 09:35:03 2026 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=da3d743b
Exclusively use getconf(1P) in get_nprocs()
Presently, the get_nprocs() subroutine tries to execute nproc(1) from
coreutils before falling back to getconf(1P). Simplify the code by
using only the latter utility.
The _SC_NPROCESSORS_ONLN configuration variable was standardised by
POSIX-1.2024 (Issue 8) but glibc has supported it for a very long time.
Indeed, I found it to be supported by a system using glibc 2.15, which
is 14 years old.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/locale-gen b/locale-gen
index d79a60e..81b289c 100644
--- a/locale-gen
+++ b/locale-gen
@@ -664,11 +664,7 @@ sub fopen ($path) {
}
sub get_nprocs () {
- my $nproc = do {
- local $ENV{'LC_ALL'} = 'C';
- qx{ { nproc || getconf _NPROCESSORS_CONF; } 2>/dev/null };
- };
- chomp $nproc;
+ chomp(my $nproc = qx{ getconf _NPROCESSORS_ONLN });
return $nproc;
}