Thread (13 messages) 13 messages, 4 authors, 2024-05-22
STALE786d

[PATCH 2/3] chainlint.pl: fix incorrect CPU count on Linux SPARC

From: Eric Sunshine <hidden>
Date: 2024-05-20 19:03:28
Subsystem: the rest · Maintainer: Linus Torvalds

From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

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 <redacted>
---
 t/chainlint.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/chainlint.pl b/t/chainlint.pl
index d9a2691889..d593cb95e7 100755
--- a/t/chainlint.pl
+++ b/t/chainlint.pl
@@ -724,7 +724,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
-- 
2.45.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help