Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Jan 2007 12:35:36 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        erik.udo@gmail.com, dougb@freebsd.org, Oliver Fromme <olli@lurza.secnetix.de>
Subject:   Re: Init.c, making it chroot
Message-ID:  <200701041235.37141.jhb@freebsd.org>
In-Reply-To: <200701041432.l04EWgXA057039@lurza.secnetix.de>
References:  <200701041432.l04EWgXA057039@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 04 January 2007 09:32, Oliver Fromme wrote:
> M. Warner Losh wrote:
>  > In message: <45975B7B.7030002@FreeBSD.org>
>  >             Doug Barton <dougb@freebsd.org> writes:
>  > : Erik Udo wrote:
>  > : > That's nice. But NetBSDs init.c executes /etc/rc before calling
>  > : > chroot(), and that's what i'm looking for
>  > : 
>  > : Sorry if I missed your rationale earlier, but could you perhaps
>  > : explain a bit more about why you want to do this? I ask because I'm
>  > : generally interested in boot-time issues, and this sounds like an
>  > : interesting problem.
>  > 
>  > This allows one to have a 'simple' /etc/rc that arranges things so
>  > that a new '/' is ready to 'boot'.
> 
> I've created (and tested!) a new patch.  I've tested on
> RELENG_6, but I think init(8) isn't very different on
> HEAD, so it should work there, too.
> 
> Any comments are welcome.  I particularly appreciate
> if others test this stuff.

Some things I noticed:

- Why do you have the 'ichroot_name' and 'iscript_name' variables?  I would
  just pass the string literal to the kenv() function, e.g.

	if (kenv(KENV_GET, "init_script", kenv_value, sizeof(kenv_value)) > 0) {

  I think that putting the constant right there is easier for someone who
  is reading the code to see what is going on.

- Rather than abusing a global runcom_script variable that you change to
  get side effects when you invoke runcom(), why not change runcom() to
  take a single 'char *script' as an argument and just pass _PATH_RUNCOM
  or kenv_value as appropriate and get rid of the global runcom_script
  variable?

-- 
John Baldwin



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