diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2009-11-02 21:35:55 -0500 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2009-11-02 21:35:55 -0500 |
commit | 8217d34d20d736644b973bc0f4d692dd566c0d67 (patch) | |
tree | e57d798c70e738e33662ae863ac21a7e62ea83da /etc/inc/util.inc | |
parent | 08b17c6dea43e1c541623368ff23f737495bcc3e (diff) | |
download | pfsense-8217d34d20d736644b973bc0f4d692dd566c0d67.zip pfsense-8217d34d20d736644b973bc0f4d692dd566c0d67.tar.gz |
Fallback to using hw.realmem and hw.physmem sysctl's when we cannot probe the available memory from bootup log file. RouterStationPRO is an example
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index e507926..247a41a 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -894,6 +894,13 @@ function get_memory() { $real = $matches[1]; if (preg_match_all("/avail memory = .* \((.*) MB/", $mem, $matches)) $avail = $matches[1]; + if(!$real && !$avail) { + $real = trim(`sysctl hw.physmem | cut -d' ' -f2`); + $avail = trim(`sysctl hw.realmem | cut -d' ' -f2`); + $real_mem = $real / 1024; + $avail_mem = $avail / 1024; + return($real_mem,$avail_mem); + } return array($real[0],$avail[0]); } else { $mem = `dmesg -a`; @@ -902,6 +909,13 @@ function get_memory() { $real = $matches[1]; if (preg_match_all("/avail memory = .* \((.*) MB/", $mem, $matches)) $avail = $matches[1]; + if(!$real && !$avail) { + $real = trim(`sysctl hw.physmem | cut -d' ' -f2`); + $avail = trim(`sysctl hw.realmem | cut -d' ' -f2`); + $real_mem = $real / 1024; + $avail_mem = $avail / 1024; + return($real_mem,$avail_mem); + } return array($real[0],$avail[0]); } } @@ -1027,4 +1041,4 @@ function msort($array, $id="id", $sort_ascending=true) { } } -?> +?>
\ No newline at end of file |