diff --git a/proc/CHANGELOG b/proc/CHANGELOG index e42233ff5..b8bc58630 100644 --- a/proc/CHANGELOG +++ b/proc/CHANGELOG @@ -10,3 +10,5 @@ When running a command, you can now select which Unix user it will be run as. The CPU type and speed is displayed on the processed by CPU usage page, on Linux systems. ---- Changes since 1.330 ---- On Virtuozzo systems, the free and used memory shown is determined by the VMs limits. +---- Changes since 1.340 ---- +Free and used real and virtual memory is now displayed on Solaris. diff --git a/proc/sysv-lib.pl b/proc/sysv-lib.pl index af17d8629..4353b2b96 100644 --- a/proc/sysv-lib.pl +++ b/proc/sysv-lib.pl @@ -246,6 +246,27 @@ else { } } +# get_memory_info() +# Returns a list containing the real mem, free real mem, swap and free swap +# (In kilobytes). +sub get_memory_info +{ +if (!&has_command("kstat")) { + return ( ); + } +local %stat; +foreach my $s ("physmem", "freemem", "swap_alloc", "swap_avail") { + local $out = &backquote_command("kstat -p -m unix -s $s"); + if ($out =~ /\s+(\d+)/) { + $stat{$s} = $1; + } + } +return ($stat{'physmem'}*8, $stat{'freemem'}*8, + $stat{'swap_alloc'}/1024, $stat{'swap_avail'}/1024); +} + + + foreach $ia (keys %text) { if ($ia =~ /^sysv(_\S+)/) { $info_arg_map{$1} = $text{$ia};