diff --git a/src/parallel b/src/parallel index a6f8d89e..e13bf39d 100755 --- a/src/parallel +++ b/src/parallel @@ -2891,6 +2891,8 @@ sub no_of_cpus { $no_of_cpus = no_of_cpus_gnu_linux() || no_of_cores_gnu_linux(); } elsif ($^O eq 'freebsd') { $no_of_cpus = no_of_cpus_freebsd(); + } elsif ($^O eq 'netbsd') { + $no_of_cpus = no_of_cpus_netbsd(); } elsif ($^O eq 'solaris') { $no_of_cpus = no_of_cpus_solaris(); } elsif ($^O eq 'aix') { @@ -2899,6 +2901,7 @@ sub no_of_cpus { $no_of_cpus = no_of_cpus_darwin(); } else { $no_of_cpus = (no_of_cpus_freebsd() + || no_of_cpus_netbsd() || no_of_cpus_darwin() || no_of_cpus_solaris() || no_of_cpus_aix() @@ -2923,6 +2926,8 @@ sub no_of_cores { $no_of_cores = no_of_cores_gnu_linux(); } elsif ($^O eq 'freebsd') { $no_of_cores = no_of_cores_freebsd(); + } elsif ($^O eq 'netbsd') { + $no_of_cores = no_of_cores_netbsd(); } elsif ($^O eq 'openbsd') { $no_of_cores = no_of_cores_openbsd(); } elsif ($^O eq 'solaris') { @@ -2933,6 +2938,7 @@ sub no_of_cores { $no_of_cores = no_of_cores_darwin(); } else { $no_of_cores = (no_of_cores_freebsd() + || no_of_cores_netbsd() || no_of_cores_openbsd() || no_of_cores_darwin() || no_of_cores_solaris() @@ -3033,6 +3039,24 @@ sub no_of_cores_freebsd { return $no_of_cores; } +sub no_of_cpus_netbsd { + # Returns: + # Number of physical CPUs on NetBSD + # undef if not NetBSD + my $no_of_cpus = `sysctl -n hw.ncpu`; + chomp $no_of_cpus; + return $no_of_cpus; +} + +sub no_of_cores_netbsd { + # Returns: + # Number of CPU cores on NetBSD + # undef if not NetBSD + my $no_of_cores = `sysctl -n hw.ncpu`; + chomp $no_of_cores; + return $no_of_cores; +} + sub no_of_cores_openbsd { # Returns: # Number of CPU cores on OpenBSD