From owner-svn-src-all@FreeBSD.ORG Sat Mar 12 21:13:08 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 636D8106564A; Sat, 12 Mar 2011 21:13:08 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 513368FC0A; Sat, 12 Mar 2011 21:13:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2CLD8ea030207; Sat, 12 Mar 2011 21:13:08 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2CLD8LO030205; Sat, 12 Mar 2011 21:13:08 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201103122113.p2CLD8LO030205@svn.freebsd.org> From: Doug Barton Date: Sat, 12 Mar 2011 21:13:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219578 - head/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Mar 2011 21:13:08 -0000 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}"