Prepare for the removal of set_rcvar() by changing the rcvar=

assignments to the literal values it would have returned.

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.

During the discussion on freebsd-rc@ a preference was expressed for
using ${name}_enable instead of the literal values. However the
code portability concept doesn't really apply since there are so
many other places where the literal name has to be searched for
and replaced. Also, using the literal value is also a tiny bit
faster than dereferencing the variables, and every little bit helps.
This commit is contained in:
Doug Barton 2012-01-14 02:18:41 +00:00
parent 4104e83567
commit 801c438304
66 changed files with 70 additions and 70 deletions

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="accounting"
rcvar=`set_rcvar`
rcvar="accounting_enable"
accounting_command="/usr/sbin/accton"
accounting_file="/var/account/acct"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="amd"
rcvar=`set_rcvar`
rcvar="amd_enable"
command="/usr/sbin/${name}"
start_precmd="amd_precmd"
command_args="&"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="apm"
rcvar=`set_rcvar`
rcvar="apm_enable"
start_precmd="apm_precmd"
command="/usr/sbin/${name}"
start_cmd="${command} -e enable"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="apmd"
rcvar=`set_rcvar`
rcvar="apmd_enable"
command="/usr/sbin/${name}"
start_precmd="apmd_prestart"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="bootparamd"
rcvar=`set_rcvar`
rcvar="bootparamd_enable"
required_files="/etc/bootparams"
command="/usr/sbin/${name}"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="bsnmpd"
rcvar=`set_rcvar`
rcvar="bsnmpd_enable"
command="/usr/sbin/${name}"
pidfile="/var/run/snmpd.pid"

View File

@ -11,9 +11,9 @@
. /etc/rc.subr
name="bthidd"
rcvar="bthidd_enable"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
rcvar=`set_rcvar`
start_precmd="bthidd_prestart"
bthidd_prestart()

View File

@ -9,7 +9,7 @@
. /etc/rc.subr
name="cleanvar"
rcvar=`set_rcvar`
rcvar="cleanvar_enable"
start_precmd="${name}_prestart"
start_cmd="${name}_start"

View File

@ -11,7 +11,7 @@
name="cleartmp"
# Disguise rcvar for the start method to run irrespective of its setting.
rcvar1=`set_rcvar clear_tmp`
rcvar1="clear_tmp_enable"
start_cmd="${name}_start"
stop_cmd=":"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="cron"
rcvar="`set_rcvar`"
rcvar="cron_enable"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="ddb"
rcvar=`set_rcvar`
rcvar="ddb_enable"
command="/sbin/${name}"
start_precmd="ddb_prestart"
stop_cmd=":"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="devd"
rcvar=`set_rcvar`
rcvar="devd_enable"
command="/sbin/${name}"
start_precmd=${name}_prestart

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="dmesg"
rcvar=`set_rcvar`
rcvar="dmesg_enable"
dmesg_file="/var/run/dmesg.boot"
start_cmd="do_dmesg"
stop_cmd=":"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="ftpproxy"
rcvar=`set_rcvar`
rcvar="ftpproxy_enable"
command="/usr/sbin/ftp-proxy"
load_rc_config $name

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="ftpd"
rcvar=`set_rcvar`
rcvar="ftpd_enable"
command="/usr/libexec/${name}"
pidfile="/var/run/${name}.pid"
start_precmd=ftpd_prestart

View File

@ -34,7 +34,7 @@
. /etc/rc.subr
name="gptboot"
rcvar=`set_rcvar`
rcvar="gptboot_enable"
start_cmd="gptboot_report"
gptboot_report()

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="hastd"
rcvar=`set_rcvar`
rcvar="hastd_enable"
pidfile="/var/run/${name}.pid"
command="/sbin/${name}"
hastctl="/sbin/hastctl"

View File

@ -11,9 +11,9 @@
. /etc/rc.subr
name="hcsecd"
rcvar="hcsecd_enable"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
rcvar=`set_rcvar`
required_modules="ng_btsocket"
load_rc_config $name

View File

@ -10,8 +10,8 @@
. /etc/rc.subr
name="hostapd"
rcvar="hostapd_enable"
command="/usr/sbin/${name}"
rcvar=`set_rcvar`
conf_file="/etc/${name}.conf"
pidfile="/var/run/${name}.pid"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="inetd"
rcvar=`set_rcvar`
rcvar="inetd_enable"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/${name}.conf"

View File

@ -12,7 +12,7 @@
. /etc/network.subr
name="ip6addrctl"
rcvar=`set_rcvar`
rcvar="ip6addrctl_enable"
start_cmd="ip6addrctl_start"
stop_cmd="ip6addrctl_stop"
extra_commands="status prefer_ipv6 prefer_ipv4"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="ipfilter"
rcvar=`set_rcvar`
rcvar="ipfilter_enable"
load_rc_config $name
stop_precmd="test -f ${ipfilter_rules} -o -f ${ipv6_ipfilter_rules}"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="ipfs"
rcvar=`set_rcvar`
rcvar="ipfs_enable"
start_cmd="ipfs_start"
stop_cmd="ipfs_stop"
start_precmd="ipfs_prestart"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="ipmon"
rcvar=`set_rcvar`
rcvar="ipmon_enable"
command="/sbin/${name}"
start_precmd="ipmon_precmd"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="ipnat"
rcvar=`set_rcvar`
rcvar="ipnat_enable"
load_rc_config $name
start_cmd="ipnat_start"
stop_cmd="${ipnat_program} -F -C"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="ipsec"
rcvar=`set_rcvar`
rcvar="ipsec_enable"
start_precmd="ipsec_prestart"
start_cmd="ipsec_start"
stop_precmd="test -f $ipsec_file"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="ipxrouted"
rcvar=`set_rcvar`
rcvar="ipxrouted_enable"
command="/usr/sbin/IPXrouted"
command_args="> /dev/null 2>&1"

View File

@ -17,7 +17,7 @@
. /etc/rc.subr
name="jail"
rcvar=`set_rcvar`
rcvar="jail_enable"
start_precmd="jail_prestart"
start_cmd="jail_start"

View File

@ -13,7 +13,7 @@
. /etc/rc.subr
name="keyserv"
rcvar=`set_rcvar`
rcvar="keyserv_enable"
command="/usr/sbin/${name}"
start_precmd="keyserv_prestart"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="lpd"
rcvar=`set_rcvar`
rcvar="lpd_enable"
command="/usr/sbin/${name}"
required_files="/etc/printcap"
start_precmd="chkprintcap"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="mountd"
rcvar=`set_rcvar`
rcvar="mountd_enable"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/exports"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="moused"
rcvar=`set_rcvar`
rcvar="moused_enable"
command="/usr/sbin/${name}"
start_cmd="moused_start"
pidprefix="/var/run/moused"
@ -23,7 +23,7 @@ load_rc_config $name
#
if [ -n "$2" ]; then
eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}}
rcvar=`set_rcvar moused_$2`
rcvar="moused_${2}_enable"
pidfile="${pidprefix}.$2.pid"
pidarg="-I $pidfile"
fi

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="mroute6d"
rcvar=`set_rcvar`
rcvar="mroute6d_enable"
command="/usr/local/sbin/pim6dd"
load_rc_config $name

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="mrouted"
rcvar=`set_rcvar`
rcvar="mrouted_enable"
command="/usr/local/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/${name}.conf"

View File

@ -10,7 +10,7 @@
. /etc/network.subr
name="natd"
rcvar=`set_rcvar`
rcvar="natd_enable"
command="/sbin/${name}"
pidfile="/var/run/${name}.pid"
start_precmd="natd_precmd"

View File

@ -14,7 +14,7 @@
. /etc/rc.subr
name="netwait"
rcvar=`set_rcvar`
rcvar="netwait_enable"
start_cmd="${name}_start"
stop_cmd=":"

View File

@ -9,7 +9,7 @@
. /etc/rc.subr
name="newsyslog"
rcvar=`set_rcvar`
rcvar="newsyslog_enable"
required_files="/etc/newsyslog.conf"
command="/usr/sbin/${name}"
start_cmd="newsyslog_start"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="nfscbd"
rcvar=`set_rcvar`
rcvar="nfscbd_enable"
command="/usr/sbin/${name}"
sig_stop="USR1"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="nfsd"
rcvar=`set_rcvar nfs_server`
rcvar="nfs_server_enable"
command="/usr/sbin/${name}"
load_rc_config $name

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="nfsuserd"
rcvar=`set_rcvar`
rcvar="nfsuserd_enable"
command="/usr/sbin/${name}"
sig_stop="USR1"

View File

@ -19,7 +19,7 @@
. /etc/rc.subr
name="nscd"
rcvar=`set_rcvar`
rcvar="nscd_enable"
command=/usr/sbin/nscd
extra_commands="flush"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="ntpd"
rcvar=`set_rcvar`
rcvar="ntpd_enable"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
start_precmd="ntpd_precmd"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="ntpdate"
rcvar=`set_rcvar`
rcvar="ntpdate_enable"
stop_cmd=":"
start_cmd="ntpdate_start"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="pf"
rcvar=`set_rcvar`
rcvar="pf_enable"
load_rc_config $name
start_cmd="pf_start"
stop_cmd="pf_stop"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="pflog"
rcvar=`set_rcvar`
rcvar="pflog_enable"
command="/sbin/pflogd"
pidfile="/var/run/pflogd.pid"
start_precmd="pflog_prestart"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="pfsync"
rcvar=`set_rcvar`
rcvar="pfsync_enable"
start_precmd="pfsync_prestart"
start_cmd="pfsync_start"
stop_cmd="pfsync_stop"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="powerd"
rcvar=`set_rcvar`
rcvar="powerd_enable"
command="/usr/sbin/${name}"
stop_postcmd=powerd_poststop

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="ppp"
rcvar=`set_rcvar`
rcvar="ppp_enable"
command="/usr/sbin/${name}"
start_cmd="ppp_start"
stop_cmd="ppp_stop"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="pppoed"
rcvar="`set_rcvar`"
rcvar="pppoed_enable"
start_cmd="pppoed_start"
# XXX stop_cmd will not be straightforward
stop_cmd=":"

View File

@ -13,7 +13,7 @@
. /etc/rc.subr
name="quota"
rcvar=`set_rcvar`
rcvar="quota_enable"
load_rc_config $name
start_cmd="quota_start"
stop_cmd="/usr/sbin/quotaoff ${quotaoff_flags}"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="rarpd"
rcvar=`set_rcvar`
rcvar="rarpd_enable"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/ethers"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="rfcomm_pppd_server"
rcvar=`set_rcvar`
rcvar="rfcomm_pppd_server_enable"
command="/usr/sbin/rfcomm_pppd"
start_cmd="rfcomm_pppd_server_start"
stop_cmd="rfcomm_pppd_server_stop"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="route6d"
rcvar=`set_rcvar`
rcvar="route6d_enable"
set_rcvar_obsolete ipv6_router_enable route6d_enable
set_rcvar_obsolete ipv6_router route6d_program

View File

@ -10,8 +10,8 @@
. /etc/rc.subr
name="routed"
rcvar="routed_enable"
desc="network RIP and router discovery routing daemon"
rcvar=`set_rcvar`
set_rcvar_obsolete router_enable routed_enable
set_rcvar_obsolete router routed_program

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="rpcbind"
rcvar=`set_rcvar`
rcvar="rpcbind_enable"
command="/usr/sbin/${name}"
stop_postcmd='/bin/rm -f /var/run/rpcbind.*'

View File

@ -12,7 +12,7 @@
. /etc/network.subr
name="rtadvd"
rcvar=`set_rcvar`
rcvar="rtadvd_enable"
command="/usr/sbin/${name}"
start_precmd="rtadvd_precmd"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="rtsold"
rcvar=`set_rcvar`
rcvar="rtsold_enable"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
start_postcmd="rtsold_poststart"

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="rwhod"
rcvar="`set_rcvar`"
rcvar="rwhod_enable"
command="/usr/sbin/${name}"
load_rc_config $name

View File

@ -12,7 +12,7 @@
name="sdpd"
command="/usr/sbin/${name}"
rcvar=`set_rcvar`
rcvar="sdpd_enable"
required_modules="ng_btsocket"
load_rc_config $name

View File

@ -15,7 +15,7 @@
. /etc/rc.subr
name="sendmail"
rcvar=`set_rcvar`
rcvar="sendmail_enable"
required_files="/etc/mail/${name}.cf"
start_precmd="sendmail_precmd"
@ -79,14 +79,14 @@ required_files=
if checkyesno sendmail_submit_enable; then
name="sendmail_submit"
rcvar=`set_rcvar`
rcvar="sendmail_submit_enable"
start_cmd="${command} ${sendmail_submit_flags}"
run_rc_command "$1"
fi
if checkyesno sendmail_outbound_enable; then
name="sendmail_outbound"
rcvar=`set_rcvar`
rcvar="sendmail_outbound_enable"
start_cmd="${command} ${sendmail_outbound_flags}"
run_rc_command "$1"
fi

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="sshd"
rcvar=`set_rcvar`
rcvar="sshd_enable"
command="/usr/sbin/${name}"
keygen_cmd="sshd_keygen"
start_precmd="sshd_precmd"

View File

@ -10,7 +10,7 @@
. /etc/rc.subr
name="syslogd"
rcvar=`set_rcvar`
rcvar="syslogd_enable"
pidfile="/var/run/syslog.pid"
command="/usr/sbin/${name}"
required_files="/etc/syslog.conf"
@ -41,7 +41,7 @@ syslogd_precmd()
#
for _l in $altlog_proglist; do
eval _ldir=\$${_l}_chrootdir
if checkyesno `set_rcvar $_l` && [ -n "$_ldir" ]; then
if checkyesno ${_l}_enable && [ -n "$_ldir" ]; then
echo "${_ldir}/var/run/log" >> $sockfile
fi
done

View File

@ -11,7 +11,7 @@
. /etc/rc.subr
name="timed"
rcvar=`set_rcvar`
rcvar="timed_enable"
command="/usr/sbin/${name}"
load_rc_config $name

View File

@ -11,8 +11,8 @@
. /etc/rc.subr
name="ubthidhci"
rcvar="ubthidhci_enable"
command="/usr/sbin/usbconfig"
rcvar=`set_rcvar`
start_precmd="ubthidhci_prestart"
ubthidhci_prestart()

View File

@ -12,7 +12,7 @@
. /etc/rc.subr
name="virecover"
rcvar="`set_rcvar`"
rcvar="virecover_enable"
stop_cmd=":"
start_cmd="virecover_start"

View File

@ -34,7 +34,7 @@
. /etc/rc.subr
name="watchdogd"
rcvar="`set_rcvar`"
rcvar="watchdogd_enable"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"