summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2012-01-14 08:59:02 +0000
committerdougb <dougb@FreeBSD.org>2012-01-14 08:59:02 +0000
commit9d0dd43b7c0115a36b4d25c6e5059a989aec8b76 (patch)
tree712d21eed298597d21c64d29ab20e9d28ec7e0bb /etc
parent2b88eaa8016ec877d8de071c90161e02625c3678 (diff)
downloadFreeBSD-src-9d0dd43b7c0115a36b4d25c6e5059a989aec8b76.zip
FreeBSD-src-9d0dd43b7c0115a36b4d25c6e5059a989aec8b76.tar.gz
Now that its callers have been udpated, remove set_rcvar().
The concept of set_rcvar() was nice in theory, but the forks it creates are a drag on the startup process, which is especially noticeable on slower systems, such as embedded ones.
Diffstat (limited to 'etc')
-rw-r--r--etc/rc.subr51
1 files changed, 5 insertions, 46 deletions
diff --git a/etc/rc.subr b/etc/rc.subr
index 5ab1a7c..08342a0 100644
--- a/etc/rc.subr
+++ b/etc/rc.subr
@@ -54,47 +54,6 @@ JID=`$PS -p $$ -o jid=`
# functions
# ---------
-# set_rcvar [var] [defval] [desc]
-#
-# Echo or define a rc.conf(5) variable name. Global variable
-# $rcvars is used.
-#
-# If no argument is specified, echo "${name}_enable".
-#
-# If only a var is specified, echo "${var}_enable".
-#
-# If var and defval are specified, the ${var} is defined as
-# rc.conf(5) variable and the default value is ${defvar}. An
-# optional argument $desc can also be specified to add a
-# description for that.
-#
-set_rcvar()
-{
- case $# in
- 0)
- echo ${name}_enable
- ;;
- 1)
- echo ${1}_enable
- ;;
- *)
- debug "rcvar_define: \$$1=$2 is added" \
- " as a rc.conf(5) variable."
-
- local _var
- _var=$1
- rcvars="${rcvars# } $_var"
- eval ${_var}_defval=\"$2\"
- shift 2
- # encode multiple lines of _desc
- for l in "$@"; do
- eval ${_var}_desc=\"\${${_var}_desc#^^}^^$l\"
- done
- eval ${_var}_desc=\"\${${_var}_desc#^^}\"
- ;;
- esac
-}
-
# set_rcvar_obsolete oldvar [newvar] [msg]
# Define obsolete variable.
# Global variable $rcvars_obsolete is used.
@@ -856,8 +815,8 @@ $command $rc_flags $command_args"
echo ""
fi
echo "#"
- # Get unique vars in $rcvar $rcvars
- for _v in $rcvar $rcvars; do
+ # Get unique vars in $rcvar
+ for _v in $rcvar; do
case $v in
$_v\ *|\ *$_v|*\ $_v\ *) ;;
*) v="${v# } $_v" ;;
@@ -1003,7 +962,7 @@ run_rc_script()
unset name command command_args command_interpreter \
extra_commands pidfile procname \
- rcvar rcvars rcvars_obsolete required_dirs required_files \
+ rcvar rcvars_obsolete required_dirs required_files \
required_vars
eval unset ${_arg}_cmd ${_arg}_precmd ${_arg}_postcmd
@@ -1035,7 +994,7 @@ run_rc_script()
#
load_rc_config()
{
- local _name _var _defval _v _msg _new
+ local _name _rcvar_val _var _defval _v _msg _new
_name=$1
if [ -z "$_name" ]; then
err 3 'USAGE: load_rc_config name'
@@ -1060,7 +1019,7 @@ load_rc_config()
fi
# Set defaults if defined.
- for _var in $rcvar $rcvars; do
+ for _var in $rcvar; do
eval _defval=\$${_var}_defval
if [ -n "$_defval" ]; then
eval : \${$_var:=\$${_var}_defval}
OpenPOWER on IntegriCloud