summaryrefslogtreecommitdiffstats
path: root/etc/inc/util.inc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2013-01-16 13:21:01 +0000
committerErmal <eri@pfsense.org>2013-01-16 13:21:40 +0000
commit5cd73772aac7b2f487db95668191f43771bcab67 (patch)
treeec1c21f3fe2bbac77d7071df1b3b8ef799140fe3 /etc/inc/util.inc
parent2d6a5d6a5d82ba301655e4966afb22260e12d255 (diff)
downloadpfsense-5cd73772aac7b2f487db95668191f43771bcab67.zip
pfsense-5cd73772aac7b2f487db95668191f43771bcab67.tar.gz
Use sysctl for this since its better rather than going thorugh dmesg
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r--etc/inc/util.inc18
1 files changed, 5 insertions, 13 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index 858d663..ffe635a 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -1453,19 +1453,11 @@ function set_sysctl($values) {
* [0]real and [1]available
*/
function get_memory() {
- $matches = "";
- if(file_exists("/var/log/dmesg.boot"))
- $mem = `cat /var/log/dmesg.boot | grep memory`;
- else
- $mem = `dmesg -a | grep memory`;
- if (preg_match_all("/avail memory.* \((.*)MB\)/", $mem, $matches))
- return array($matches[1][0], $matches[1][0]);
- if(!$real && !$avail) {
- $real = trim(`sysctl hw.physmem | cut -d' ' -f2`);
- $avail = trim(`sysctl hw.realmem | cut -d' ' -f2`);
- /* convert from bytes to megabytes */
- return array(($real/1048576),($avail/1048576));
- }
+
+ $real = trim(`sysctl -n hw.physmem`, " \n");
+ $avail = trim(`sysctl hw.realmem`, " \n");
+ /* convert from bytes to megabytes */
+ return array(($real/1048576),($avail/1048576));
}
function mute_kernel_msgs() {
OpenPOWER on IntegriCloud