summaryrefslogtreecommitdiffstats
path: root/etc/rc.subr
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2011-03-12 21:13:08 +0000
committerdougb <dougb@FreeBSD.org>2011-03-12 21:13:08 +0000
commit1a54928233f948c8094d9a0856433a960ffd840d (patch)
treecc3fc5b21611f301371c39ce55c49402b97da180 /etc/rc.subr
parent1d7bc8e3149c0f6a745733761ab8c9354b021039 (diff)
downloadFreeBSD-src-1a54928233f948c8094d9a0856433a960ffd840d.zip
FreeBSD-src-1a54928233f948c8094d9a0856433a960ffd840d.tar.gz
Use the allexport option in load_rc_config() in order to avoid having
to repeatedly read the conf files. Depending on what is enabled the files are being read anywhere from 15, 30, or more times currently. By loading the values in the environment this is reduced to 1, with perhaps a couple more, again depending on what is enabled. The speed-up for boot and shutdown is negligible when rc.conf is on local disk, noticable when accessing files over NFS, and dramatic when pulling rc.conf values from a database. This change also includes a minor optimization to the conditional for $_rc_conf_loaded.
Diffstat (limited to 'etc/rc.subr')
-rw-r--r--etc/rc.subr6
1 files changed, 3 insertions, 3 deletions
diff --git a/etc/rc.subr b/etc/rc.subr
index da1b198..8c6a1f5 100644
--- a/etc/rc.subr
+++ b/etc/rc.subr
@@ -998,9 +998,8 @@ load_rc_config()
err 3 'USAGE: load_rc_config name'
fi
- if ${_rc_conf_loaded:-false}; then
- :
- else
+ if [ -z "$_rc_conf_loaded" ]; then
+ set -o allexport
if [ -r /etc/defaults/rc.conf ]; then
debug "Sourcing /etc/defaults/rc.conf"
. /etc/defaults/rc.conf
@@ -1010,6 +1009,7 @@ load_rc_config()
. /etc/rc.conf
fi
_rc_conf_loaded=true
+ set +o allexport
fi
if [ -f /etc/rc.conf.d/"$_name" ]; then
debug "Sourcing /etc/rc.conf.d/${_name}"
OpenPOWER on IntegriCloud