]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - config/cfgroot/general-functions.pl
Merge branch 'next' of ssh://git.ipfire.org/pub/git/ipfire-2.x into next-suricata
[ipfire-2.x.git] / config / cfgroot / general-functions.pl
index 0577afe2809e62b3de113f96b3819ab04a43d917..2d3eb73d7fff55038397918d689d10e47a5d293e 100644 (file)
@@ -149,6 +149,10 @@ sub readhash
        while (<FILE>)
        {
                chop;
+
+               # Skip comments.
+               next if ($_ =~ /\#/);
+
                ($var, $val) = split /=/, $_, 2;
                if ($var)
                {
@@ -1165,5 +1169,12 @@ sub dnssec_status() {
 
        return $status;
 }
+sub number_cpu_cores() {
+       open my $cpuinfo, "/proc/cpuinfo" or die "Can't open cpuinfo: $!\n";
+       my $cores = scalar (map /^processor/, <$cpuinfo>);
+       close $cpuinfo;
+
+       return $cores;
+}
 
 1;