From b17f41d17f881a7bde0c94af3ff65adbded6d5a0 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Wed, 6 Apr 2016 00:35:45 +0200 Subject: [PATCH] parallel: Better CPU detection on OpenIndiana. --- src/parallel | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/parallel b/src/parallel index fd54d2cb..0051083b 100755 --- a/src/parallel +++ b/src/parallel @@ -5307,7 +5307,7 @@ sub no_of_cpus { } elsif ($^O eq 'darwin') { $no_of_cpus = no_of_cpus_darwin(); } elsif ($^O eq 'solaris') { - $no_of_cpus = no_of_cpus_solaris(); + $no_of_cpus = no_of_cpus_solaris() || nproc(); } elsif ($^O eq 'aix') { $no_of_cpus = no_of_cpus_aix(); } elsif ($^O eq 'hpux') { @@ -5365,7 +5365,7 @@ sub no_of_cores { } elsif ($^O eq 'darwin') { $no_of_cores = no_of_cores_darwin(); } elsif ($^O eq 'solaris') { - $no_of_cores = no_of_cores_solaris(); + $no_of_cores = no_of_cores_solaris() || nproc(); } elsif ($^O eq 'aix') { $no_of_cores = no_of_cores_aix(); } elsif ($^O eq 'hpux') { @@ -5594,6 +5594,12 @@ sub no_of_cpus_solaris { return $#prtconf +1; } } + if(-x "/usr/sbin/prtconf") { + my @prtconf = ::qqx("/usr/sbin/prtconf | grep cpu..instance"); + if($#prtconf >= 0) { + return $#prtconf +1; + } + } return undef; }