Author: dougb
Date: Sat Mar 12 21:13:08 2011
New Revision: 219578
URL: http://svn.freebsd.org/changeset/base/219578

Log:
  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.

Modified:
  head/etc/rc.subr

Modified: head/etc/rc.subr
==============================================================================
--- head/etc/rc.subr    Sat Mar 12 20:36:52 2011        (r219577)
+++ head/etc/rc.subr    Sat Mar 12 21:13:08 2011        (r219578)
@@ -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}"
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to