Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jan 2012 16:25:29 +0100
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Jilles Tjoelker <jilles@stack.nl>
Cc:        freebsd-rc@FreeBSD.org
Subject:   Re: Making use of set_rcvar.
Message-ID:  <20120106152529.GF1693@garage.freebsd.pl>
In-Reply-To: <20120106151740.GA75037@stack.nl>
References:  <20120106141301.GE1693@garage.freebsd.pl> <20120106151740.GA75037@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help

--3607uds81ZQvwCD0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Jan 06, 2012 at 04:17:40PM +0100, Jilles Tjoelker wrote:
> On Fri, Jan 06, 2012 at 03:13:03PM +0100, Pawel Jakub Dawidek wrote:
> > Any objections?
>=20
> > 	http://people.freebsd.org/~pjd/patches/set_rcvar.patch
>=20
> > This patch only changes scripts where set_rcvar can be used with no
> > arguments.
>=20
> While this makes the scripts cleaner, it will lead to extra forks with
> the current implementation of sh which will slow down boot to some
> extent. The effect is small on x86 but may be large on embedded
> platforms.

That was my concern as well, but I was under impression that using
set_rcvar is preferred. I'm fine either way, but would like it to be
consistent across system startup scripts. I like using set_rcvar as it
eliminates typing name in one more place. Very handy when you create
your own script by changing existing one.

> If I could change history, I would have forbidden calling a function
> from a command substitution like that in the template. Instead, the
> function should be called normally and should set the variable itself.
> However, I think that cannot be changed anymore.
>=20
> I have a fairly small patch to sh to eliminate the fork when expanding
> $(set_rcvar). However, one could object that this does not add true new
> capabilities but only a new notation to the part of the language that
> executes without forks (because the function could write into a variable
> instead of being command-substituted).

Wouldn't it be helpful to define name before loading rc.subr? This would
make the scripts less pretty, though.

--=20
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://yomoli.com

--3607uds81ZQvwCD0
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iEYEARECAAYFAk8HEmQACgkQForvXbEpPzSibQCglOnSuF52h1R17bzWDMSLN+sC
igMAoMaCxMxjb27qH1TROvviCqC5PNFo
=4iZc
-----END PGP SIGNATURE-----

--3607uds81ZQvwCD0--



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