mirror of
https://github.com/git/git.git
synced 2026-02-28 10:47:33 +00:00
chainlint.pl: fix incorrect CPU count on Linux SPARC
On SPARC systems running Linux, individual processors are denoted with "CPUnn:" in /proc/cpuinfo instead of the usual "processor : NN". As a result, the regexp in ncores() matches 0 times. Address this shortcoming by extending the regexp to also match lines with "CPUnn:". Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> [es: simplified regexp; tweaked commit message] Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
037348e99a
commit
45db5ed3b2
@@ -715,7 +715,7 @@ sub ncores {
|
||||
if (open my $fh, '<', '/proc/cpuinfo') {
|
||||
my $cpuinfo = do { local $/; <$fh> };
|
||||
close($fh);
|
||||
my @matches = ($cpuinfo =~ /^processor[\s\d]*:/mg);
|
||||
my @matches = ($cpuinfo =~ /^(processor|CPU)[\s\d]*:/mg);
|
||||
return @matches ? scalar(@matches) : 1;
|
||||
}
|
||||
# macOS & BSD
|
||||
|
||||
Reference in New Issue
Block a user