summaryrefslogtreecommitdiffstats
path: root/etc/inc/pfsense-utils.inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-09-18 05:16:25 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-09-18 05:16:25 +0000
commit27f586993574ef74e00b2ad71c68938353c744de (patch)
tree4c62c6f58c51c4f6dd8d58b3be8477fe9dbbc9c1 /etc/inc/pfsense-utils.inc
parent92ab056608e0e4785bf53cf33d4539dd719e29fa (diff)
downloadpfsense-27f586993574ef74e00b2ad71c68938353c744de.zip
pfsense-27f586993574ef74e00b2ad71c68938353c744de.tar.gz
* Introduce get_memory() which returns amount of memory in the machine
* Use memory to control how many processes will be running and waiting for captive portal authenticaion
Diffstat (limited to 'etc/inc/pfsense-utils.inc')
-rw-r--r--etc/inc/pfsense-utils.inc20
1 files changed, 18 insertions, 2 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 68b0a3f..dc56236 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -889,8 +889,24 @@ function rmdir_recursive($path,$follow_links=false) {
}
/*
- * safe_mkdir($path, $mode = 0755)
- * create directory if it doesn't already exist and isn't a file!
+ * get_memory()
+ * returns an array listing the amount of
+ * memory installed in the hardware
+ * [0]real and [1]available
+ */
+function get_memory() {
+ $mem = `cat /var/log/dmesg.boot | grep memory`;
+ if (preg_match_all("/real memory = .* \((.*) MB/", $mem, $matches))
+ $real = $matches[1];
+ if (preg_match_all("/avail memory = .* \((.*) MB/", $mem, $matches))
+ $avail = $matches[1];
+ return array($real[0],$avail[0]);
+}
+
+
+/*
+ * safe_mkdir($path, $mode = 0755)
+ * create directory if it doesn't already exist and isn't a file!
*/
function safe_mkdir($path, $mode=0755) {
global $g;
OpenPOWER on IntegriCloud