Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 08 Jan 2012 15:12:24 -0800
From:      Doug Barton <dougb@FreeBSD.org>
To:        Hiroki Sato <hrs@FreeBSD.org>
Cc:        freebsd-rc@FreeBSD.org
Subject:   Re: Making use of set_rcvar.
Message-ID:  <4F0A22D8.8090206@FreeBSD.org>
In-Reply-To: <20120108.081216.1547061187942402256.hrs@allbsd.org>
References:  <4F079A76.3030306@FreeBSD.org> <20120107112538.GC1696@garage.freebsd.pl> <4F08C95F.6040808@FreeBSD.org> <20120108.081216.1547061187942402256.hrs@allbsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------000209040905030802020303
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On 01/07/2012 15:12, Hiroki Sato wrote:
>  I am always wondering if defining $rcvar as "${name}_enable" at the
>  end of load_rc_config() when $rcvar is undefined is bad idea.
> 
>  Is there any problem with removing rcvar=... in individual rc.d
>  scripts except for non-standard ones (empty or different from
>  ${name}_enable)?  It looks simpler than writing the same line
>  "rcvar=${name}_enable" many times in various places.

This sounds like a great idea in theory, but in practice it doesn't work
out, for 2 reasons. First, we have a lot of scripts in the base (about
1/3) that rely on the lack of any rcvar meaning that it gets run
unconditionally. In order to provide backwards compatibility we'd have
to add code to enable things by default that were previously unset.
That's not hard to do, but ....

The other reason is that for ports, the scripts generally look like this:

load_rc_config foo

: ${foo_enable:=NO}

See the problem?

There are ways around both of these issues, but they involve much more
dramatic changes that I don't think buy us much, if anything. There are
already a large'ish number of things that are repeated in each rc.d
script, so leaving this one in doesn't hurt anything. Whereas removing
the forks caused by calling set_rcvar actually gains us a shorter boot
time.*

Attached is a patch that does what I suggested a long time ago, removes
set_rcvar() entirely and assigns each rcvar statically. I'll commit this
in a few days if no one objects. (Note, it can't be committed yet
because the scripts in ports that call set_rcvar() have to be modified
first.)


Doug

* Yes, I know that we're only gaining a second, maybe two. But each time
we do something to improve the boot time the cumulative effect is what
we're after.

-- 

	You can observe a lot just by watching.	-- Yogi Berra

	Breadth of IT experience, and depth of knowledge in the DNS.
	Yours for the right price.  :)  http://SupersetSolutions.com/


--------------000209040905030802020303
Content-Type: text/plain;
 name="rcd-no-set_rcvar.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="rcd-no-set_rcvar.diff"

Index: rc.d/nscd
===================================================================
--- rc.d/nscd	(revision 229825)
+++ rc.d/nscd	(working copy)
@@ -19,7 +19,7 @@
 . /etc/rc.subr
 
 name="nscd"
-rcvar=`set_rcvar`
+rcvar="nscd_enable"
 
 command=/usr/sbin/nscd
 extra_commands="flush"
Index: rc.d/mountd
===================================================================
--- rc.d/mountd	(revision 229825)
+++ rc.d/mountd	(working copy)
@@ -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"
Index: rc.d/ntpdate
===================================================================
--- rc.d/ntpdate	(revision 229825)
+++ rc.d/ntpdate	(working copy)
@@ -10,7 +10,7 @@
 . /etc/rc.subr
 
 name="ntpdate"
-rcvar=`set_rcvar`
+rcvar="ntpdate_enable"
 stop_cmd=":"
 start_cmd="ntpdate_start"
 
Index: rc.d/powerd
===================================================================
--- rc.d/powerd	(revision 229825)
+++ rc.d/powerd	(working copy)
@@ -11,7 +11,7 @@
 . /etc/rc.subr
 
 name="powerd"
-rcvar=`set_rcvar`
+rcvar="powerd_enable"
 command="/usr/sbin/${name}"
 stop_postcmd=powerd_poststop
 
Index: rc.d/rtsold
===================================================================
--- rc.d/rtsold	(revision 229825)
+++ rc.d/rtsold	(working copy)
@@ -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"
Index: rc.d/ipnat
===================================================================
--- rc.d/ipnat	(revision 229825)
+++ rc.d/ipnat	(working copy)
@@ -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"
Index: rc.d/lpd
===================================================================
--- rc.d/lpd	(revision 229825)
+++ rc.d/lpd	(working copy)
@@ -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"
Index: rc.d/nfscbd
===================================================================
--- rc.d/nfscbd	(revision 229825)
+++ rc.d/nfscbd	(working copy)
@@ -10,7 +10,7 @@
 . /etc/rc.subr
 
 name="nfscbd"
-rcvar=`set_rcvar`
+rcvar="nfscbd_enable"
 command="/usr/sbin/${name}"
 sig_stop="USR1"
 
Index: rc.d/ip6addrctl
===================================================================
--- rc.d/ip6addrctl	(revision 229825)
+++ rc.d/ip6addrctl	(working copy)
@@ -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"
Index: rc.d/dmesg
===================================================================
--- rc.d/dmesg	(revision 229825)
+++ rc.d/dmesg	(working copy)
@@ -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=":"
Index: rc.d/sshd
===================================================================
--- rc.d/sshd	(revision 229825)
+++ rc.d/sshd	(working copy)
@@ -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"
Index: rc.d/watchdogd
===================================================================
--- rc.d/watchdogd	(revision 229825)
+++ rc.d/watchdogd	(working copy)
@@ -34,7 +34,7 @@
 . /etc/rc.subr
 
 name="watchdogd"
-rcvar="`set_rcvar`"
+rcvar="watchdogd_enable"
 command="/usr/sbin/${name}"
 pidfile="/var/run/${name}.pid"
 
Index: rc.d/netwait
===================================================================
--- rc.d/netwait	(revision 229825)
+++ rc.d/netwait	(working copy)
@@ -14,7 +14,7 @@
 . /etc/rc.subr
 
 name="netwait"
-rcvar=`set_rcvar`
+rcvar="netwait_enable"
 
 start_cmd="${name}_start"
 stop_cmd=":"
Index: rc.d/gptboot
===================================================================
--- rc.d/gptboot	(revision 229825)
+++ rc.d/gptboot	(working copy)
@@ -34,7 +34,7 @@
 . /etc/rc.subr
 
 name="gptboot"
-rcvar=`set_rcvar`
+rcvar="gptboot_enable"
 start_cmd="gptboot_report"
 
 gptboot_report()
Index: rc.d/rpcbind
===================================================================
--- rc.d/rpcbind	(revision 229825)
+++ rc.d/rpcbind	(working copy)
@@ -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.*'
Index: rc.d/ddb
===================================================================
--- rc.d/ddb	(revision 229825)
+++ rc.d/ddb	(working copy)
@@ -11,7 +11,7 @@
 . /etc/rc.subr
 
 name="ddb"
-rcvar=`set_rcvar`
+rcvar="ddb_enable"
 command="/sbin/${name}"
 start_precmd="ddb_prestart"
 stop_cmd=":"
Index: rc.d/sendmail
===================================================================
--- rc.d/sendmail	(revision 229825)
+++ rc.d/sendmail	(working copy)
@@ -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 @@
 
 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
Index: rc.d/pfsync
===================================================================
--- rc.d/pfsync	(revision 229825)
+++ rc.d/pfsync	(working copy)
@@ -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"
Index: rc.d/bootparams
===================================================================
--- rc.d/bootparams	(revision 229825)
+++ rc.d/bootparams	(working copy)
@@ -11,7 +11,7 @@
 . /etc/rc.subr
 
 name="bootparamd"
-rcvar=`set_rcvar`
+rcvar="bootparamd_enable"
 required_files="/etc/bootparams"
 command="/usr/sbin/${name}"
 
Index: rc.d/jail
===================================================================
--- rc.d/jail	(revision 229825)
+++ rc.d/jail	(working copy)
@@ -17,7 +17,7 @@
 . /etc/rc.subr
 
 name="jail"
-rcvar=`set_rcvar`
+rcvar="jail_enable"
 
 start_precmd="jail_prestart"
 start_cmd="jail_start"
Index: rc.d/quota
===================================================================
--- rc.d/quota	(revision 229825)
+++ rc.d/quota	(working copy)
@@ -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}"
Index: rc.d/nfsd
===================================================================
--- rc.d/nfsd	(revision 229825)
+++ rc.d/nfsd	(working copy)
@@ -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
Index: rc.d/routed
===================================================================
--- rc.d/routed	(revision 229825)
+++ rc.d/routed	(working copy)
@@ -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
Index: rc.d/ubthidhci
===================================================================
--- rc.d/ubthidhci	(revision 229825)
+++ rc.d/ubthidhci	(working copy)
@@ -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()
Index: rc.d/pf
===================================================================
--- rc.d/pf	(revision 229825)
+++ rc.d/pf	(working copy)
@@ -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"
Index: rc.d/ftp-proxy
===================================================================
--- rc.d/ftp-proxy	(revision 229825)
+++ rc.d/ftp-proxy	(working copy)
@@ -10,7 +10,7 @@
 . /etc/rc.subr
 
 name="ftpproxy"
-rcvar=`set_rcvar`
+rcvar="ftpproxy_enable"
 command="/usr/sbin/ftp-proxy"
 
 load_rc_config $name
Index: rc.d/pppoed
===================================================================
--- rc.d/pppoed	(revision 229825)
+++ rc.d/pppoed	(working copy)
@@ -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=":"
Index: rc.d/rfcomm_pppd_server
===================================================================
--- rc.d/rfcomm_pppd_server	(revision 229825)
+++ rc.d/rfcomm_pppd_server	(working copy)
@@ -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"
Index: rc.d/ftpd
===================================================================
--- rc.d/ftpd	(revision 229825)
+++ rc.d/ftpd	(working copy)
@@ -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
Index: rc.d/mrouted
===================================================================
--- rc.d/mrouted	(revision 229825)
+++ rc.d/mrouted	(working copy)
@@ -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"
Index: rc.d/amd
===================================================================
--- rc.d/amd	(revision 229825)
+++ rc.d/amd	(working copy)
@@ -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="&"
Index: rc.d/devd
===================================================================
--- rc.d/devd	(revision 229825)
+++ rc.d/devd	(working copy)
@@ -11,7 +11,7 @@
 . /etc/rc.subr
 
 name="devd"
-rcvar=`set_rcvar`
+rcvar="devd_enable"
 command="/sbin/${name}"
 
 start_precmd=${name}_prestart
Index: rc.d/ipxrouted
===================================================================
--- rc.d/ipxrouted	(revision 229825)
+++ rc.d/ipxrouted	(working copy)
@@ -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"
 
Index: rc.d/nfsuserd
===================================================================
--- rc.d/nfsuserd	(revision 229825)
+++ rc.d/nfsuserd	(working copy)
@@ -10,7 +10,7 @@
 . /etc/rc.subr
 
 name="nfsuserd"
-rcvar=`set_rcvar`
+rcvar="nfsuserd_enable"
 command="/usr/sbin/${name}"
 sig_stop="USR1"
 
Index: rc.d/cron
===================================================================
--- rc.d/cron	(revision 229825)
+++ rc.d/cron	(working copy)
@@ -11,7 +11,7 @@
 . /etc/rc.subr
 
 name="cron"
-rcvar="`set_rcvar`"
+rcvar="cron_enable"
 command="/usr/sbin/${name}"
 pidfile="/var/run/${name}.pid"
 
Index: rc.d/pflog
===================================================================
--- rc.d/pflog	(revision 229825)
+++ rc.d/pflog	(working copy)
@@ -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"
Index: rc.d/rwho
===================================================================
--- rc.d/rwho	(revision 229825)
+++ rc.d/rwho	(working copy)
@@ -11,7 +11,7 @@
 . /etc/rc.subr
 
 name="rwhod"
-rcvar="`set_rcvar`"
+rcvar="rwhod_enable"
 command="/usr/sbin/${name}"
 
 load_rc_config $name
Index: rc.d/ppp
===================================================================
--- rc.d/ppp	(revision 229825)
+++ rc.d/ppp	(working copy)
@@ -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"
Index: rc.d/timed
===================================================================
--- rc.d/timed	(revision 229825)
+++ rc.d/timed	(working copy)
@@ -11,7 +11,7 @@
 . /etc/rc.subr
 
 name="timed"
-rcvar=`set_rcvar`
+rcvar="timed_enable"
 command="/usr/sbin/${name}"
 
 load_rc_config $name
Index: rc.d/cleanvar
===================================================================
--- rc.d/cleanvar	(revision 229825)
+++ rc.d/cleanvar	(working copy)
@@ -9,7 +9,7 @@
 . /etc/rc.subr
 
 name="cleanvar"
-rcvar=`set_rcvar`
+rcvar="cleanvar_enable"
 
 start_precmd="${name}_prestart"
 start_cmd="${name}_start"
Index: rc.d/moused
===================================================================
--- rc.d/moused	(revision 229825)
+++ rc.d/moused	(working copy)
@@ -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 @@
 #
 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
Index: rc.d/bthidd
===================================================================
--- rc.d/bthidd	(revision 229825)
+++ rc.d/bthidd	(working copy)
@@ -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()
Index: rc.d/mroute6d
===================================================================
--- rc.d/mroute6d	(revision 229825)
+++ rc.d/mroute6d	(working copy)
@@ -11,7 +11,7 @@
 . /etc/rc.subr
 
 name="mroute6d"
-rcvar=`set_rcvar`
+rcvar="mroute6d_enable"
 command="/usr/local/sbin/pim6dd"
 
 load_rc_config $name
Index: rc.d/apm
===================================================================
--- rc.d/apm	(revision 229825)
+++ rc.d/apm	(working copy)
@@ -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"
Index: rc.d/syslogd
===================================================================
--- rc.d/syslogd	(revision 229825)
+++ rc.d/syslogd	(working copy)
@@ -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 @@
 	#
 	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
Index: rc.d/keyserv
===================================================================
--- rc.d/keyserv	(revision 229825)
+++ rc.d/keyserv	(working copy)
@@ -13,7 +13,7 @@
 . /etc/rc.subr
 
 name="keyserv"
-rcvar=`set_rcvar`
+rcvar="keyserv_enable"
 command="/usr/sbin/${name}"
 start_precmd="keyserv_prestart"
 
Index: rc.d/hostapd
===================================================================
--- rc.d/hostapd	(revision 229825)
+++ rc.d/hostapd	(working copy)
@@ -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"
Index: rc.d/inetd
===================================================================
--- rc.d/inetd	(revision 229825)
+++ rc.d/inetd	(working copy)
@@ -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"
Index: rc.d/virecover
===================================================================
--- rc.d/virecover	(revision 229825)
+++ rc.d/virecover	(working copy)
@@ -12,7 +12,7 @@
 . /etc/rc.subr
 
 name="virecover"
-rcvar="`set_rcvar`"
+rcvar="virecover_enable"
 stop_cmd=":"
 start_cmd="virecover_start"
 
Index: rc.d/ipfilter
===================================================================
--- rc.d/ipfilter	(revision 229825)
+++ rc.d/ipfilter	(working copy)
@@ -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}"
 
Index: rc.d/apmd
===================================================================
--- rc.d/apmd	(revision 229825)
+++ rc.d/apmd	(working copy)
@@ -11,7 +11,7 @@
 . /etc/rc.subr
 
 name="apmd"
-rcvar=`set_rcvar`
+rcvar="apmd_enable"
 command="/usr/sbin/${name}"
 start_precmd="apmd_prestart"
 
Index: rc.d/natd
===================================================================
--- rc.d/natd	(revision 229825)
+++ rc.d/natd	(working copy)
@@ -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"
Index: rc.d/route6d
===================================================================
--- rc.d/route6d	(revision 229825)
+++ rc.d/route6d	(working copy)
@@ -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
Index: rc.d/hcsecd
===================================================================
--- rc.d/hcsecd	(revision 229825)
+++ rc.d/hcsecd	(working copy)
@@ -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
Index: rc.d/hastd
===================================================================
--- rc.d/hastd	(revision 229825)
+++ rc.d/hastd	(working copy)
@@ -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"
Index: rc.d/ipmon
===================================================================
--- rc.d/ipmon	(revision 229825)
+++ rc.d/ipmon	(working copy)
@@ -11,7 +11,7 @@
 . /etc/rc.subr
 
 name="ipmon"
-rcvar=`set_rcvar`
+rcvar="ipmon_enable"
 command="/sbin/${name}"
 start_precmd="ipmon_precmd"
 
Index: rc.d/bsnmpd
===================================================================
--- rc.d/bsnmpd	(revision 229825)
+++ rc.d/bsnmpd	(working copy)
@@ -10,7 +10,7 @@
 . /etc/rc.subr
 
 name="bsnmpd"
-rcvar=`set_rcvar`
+rcvar="bsnmpd_enable"
 command="/usr/sbin/${name}"
 pidfile="/var/run/snmpd.pid"
 
Index: rc.d/accounting
===================================================================
--- rc.d/accounting	(revision 229825)
+++ rc.d/accounting	(working copy)
@@ -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"
 
Index: rc.d/sdpd
===================================================================
--- rc.d/sdpd	(revision 229825)
+++ rc.d/sdpd	(working copy)
@@ -12,7 +12,7 @@
 
 name="sdpd"
 command="/usr/sbin/${name}"
-rcvar=`set_rcvar`
+rcvar="sdpd_enable"
 required_modules="ng_btsocket"
 
 load_rc_config $name
Index: rc.d/ipfs
===================================================================
--- rc.d/ipfs	(revision 229825)
+++ rc.d/ipfs	(working copy)
@@ -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"
Index: rc.d/rtadvd
===================================================================
--- rc.d/rtadvd	(revision 229825)
+++ rc.d/rtadvd	(working copy)
@@ -12,7 +12,7 @@
 . /etc/network.subr
 
 name="rtadvd"
-rcvar=`set_rcvar`
+rcvar="rtadvd_enable"
 command="/usr/sbin/${name}"
 start_precmd="rtadvd_precmd"
 
Index: rc.d/newsyslog
===================================================================
--- rc.d/newsyslog	(revision 229825)
+++ rc.d/newsyslog	(working copy)
@@ -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"
Index: rc.d/ipsec
===================================================================
--- rc.d/ipsec	(revision 229825)
+++ rc.d/ipsec	(working copy)
@@ -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"
Index: rc.d/ntpd
===================================================================
--- rc.d/ntpd	(revision 229825)
+++ rc.d/ntpd	(working copy)
@@ -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"
Index: rc.d/cleartmp
===================================================================
--- rc.d/cleartmp	(revision 229825)
+++ rc.d/cleartmp	(working copy)
@@ -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=":"
 
Index: rc.d/rarpd
===================================================================
--- rc.d/rarpd	(revision 229825)
+++ rc.d/rarpd	(working copy)
@@ -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"
Index: rc.subr
===================================================================
--- rc.subr	(revision 229822)
+++ rc.subr	(working copy)
@@ -54,47 +54,6 @@
 #	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 @@
 				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 @@
 
 	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 @@
 #
 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 @@
 	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}

--------------000209040905030802020303--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F0A22D8.8090206>