mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 16:50:24 +00:00
Use zone_memory_cap as RAM limit if set https://github.com/webmin/webmin/issues/149
This commit is contained in:
@@ -219,12 +219,15 @@ if (!&has_command("kstat")) {
|
||||
return ( );
|
||||
}
|
||||
local %stat;
|
||||
foreach my $s ("physmem", "freemem") {
|
||||
foreach my $s ("physmem", "freemem", "zone_memory_cap") {
|
||||
local $out = &backquote_command("kstat -p -m unix -s $s");
|
||||
if ($out =~ /\s+(\d+)/) {
|
||||
$stat{$s} = $1;
|
||||
}
|
||||
}
|
||||
if ($stat{'zone_memory_cap'} > $stat{'physmem'}) {
|
||||
delete($stat{'zone_memory_cap'});
|
||||
}
|
||||
local ($swaptotal, $swapfree);
|
||||
&open_execute_command(SWAP, "swap -l", 1);
|
||||
while(<SWAP>) {
|
||||
@@ -237,8 +240,10 @@ close(SWAP);
|
||||
local $pagesize = &backquote_command("pagesize 2>/dev/null");
|
||||
$pagesize = int($pagesize)/1024;
|
||||
$pagesize ||= 8; # Fallback
|
||||
return ($stat{'physmem'}*$pagesize, $stat{'freemem'}*$pagesize,
|
||||
$swaptotal/2, $swapfree/2);
|
||||
return (($stat{'zone_memory_cap'} || $stat{'physmem'})*$pagesize,
|
||||
$stat{'freemem'}*$pagesize,
|
||||
$swaptotal/2,
|
||||
$swapfree/2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user