Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (30 sloc) 0.882 kB
###############################################################################
#
# Sub Name: linux_proc_cpuinfo
#
# Description: Read the /proc/cpuinfo on a Linux server and return a
# STRUCT with the information.
#
# Arguments: None.
#
# Returns: hashref
#
###############################################################################
sub linux_proc_sysinfo
{
use strict;
my (%cpuinfo, $line, $key, $value);
local *F;
open(F, '/proc/cpuinfo') or
return RPC::XML::fault->new(501, "Cannot open /proc/cpuinfo: $!");
while (defined($line = <F>))
{
chomp $line;
next if ($line =~ /^\s*$/);
($key, $value) = split(/\s+:\s+/, $line, 2);
$key =~ s/ /_/g;
$cpuinfo{$key} = ($key eq 'flags') ? [ split(/ /, $value) ] : $value;
}
close(F);
\%cpuinfo;
}
Jump to Line
Something went wrong with that request. Please try again.