diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-07-07 11:05:28 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-07-07 11:05:28 -0300 |
commit | 82f758154f900c880dc88ad8ee6397a4e2093aee (patch) | |
tree | a23d17ccc07b9b0264fca3c0da52780f66f2a381 /etc/inc/util.inc | |
parent | ff23363dc688b8e9cb96d229121d74943bda4e97 (diff) | |
download | pfsense-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/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 17 |
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 |