summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-07-07 11:05:28 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-07-07 11:05:28 -0300
commit82f758154f900c880dc88ad8ee6397a4e2093aee (patch)
treea23d17ccc07b9b0264fca3c0da52780f66f2a381 /etc
parentff23363dc688b8e9cb96d229121d74943bda4e97 (diff)
downloadpfsense-82f758154f900c880dc88ad8ee6397a4e2093aee.zip
pfsense-82f758154f900c880dc88ad8ee6397a4e2093aee.tar.gz
Add set_single_sysctl(), a wrapper to set_sysctl() to make it simple to set value of a single sysctl
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/util.inc17
1 files changed, 17 insertions, 0 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index cf624f6..99de655 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -1614,6 +1614,23 @@ function set_sysctl($values) {
}
/*
+ * set_single_sysctl($name, $value)
+ * Wrapper to set_sysctl() to make it simple to set only one sysctl
+ * returns boolean meaning if it suceed
+ */
+function set_single_sysctl($name, $value) {
+ if (empty($name))
+ return false;
+
+ $result = set_sysctl(array($name => $value));
+
+ if (!isset($result[$name]) || $result[$name] != $value)
+ return false;
+
+ return true;
+}
+
+/*
* get_memory()
* returns an array listing the amount of
* memory installed in the hardware
OpenPOWER on IntegriCloud