Init.c, making it chroot
John Baldwin
jhb at freebsd.org
Thu Jan 4 17:45:25 UTC 2007
On Thursday 04 January 2007 09:32, Oliver Fromme wrote:
> M. Warner Losh wrote:
> > In message: <45975B7B.7030002 at FreeBSD.org>
> > Doug Barton <dougb at 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
More information about the freebsd-hackers
mailing list