summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-11-02 21:35:55 -0500
committerScott Ullrich <sullrich@pfsense.org>2009-11-02 21:35:55 -0500
commit8217d34d20d736644b973bc0f4d692dd566c0d67 (patch)
treee57d798c70e738e33662ae863ac21a7e62ea83da /etc
parent08b17c6dea43e1c541623368ff23f737495bcc3e (diff)
downloadpfsense-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')
-rw-r--r--etc/inc/util.inc16
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
OpenPOWER on IntegriCloud