From owner-freebsd-hackers@FreeBSD.ORG Thu Jan 4 17:45:25 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D6B8F16A40F; Thu, 4 Jan 2007 17:45:25 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.freebsd.org (Postfix) with ESMTP id 649EB13C4AC; Thu, 4 Jan 2007 17:45:25 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id l04HjGsL031320; Thu, 4 Jan 2007 12:45:18 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Thu, 4 Jan 2007 12:35:36 -0500 User-Agent: KMail/1.9.1 References: <200701041432.l04EWgXA057039@lurza.secnetix.de> In-Reply-To: <200701041432.l04EWgXA057039@lurza.secnetix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200701041235.37141.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Thu, 04 Jan 2007 12:45:18 -0500 (EST) X-Virus-Scanned: ClamAV 0.88.3/2413/Thu Jan 4 04:46:27 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: erik.udo@gmail.com, dougb@freebsd.org, Oliver Fromme Subject: Re: Init.c, making it chroot X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Jan 2007 17:45:25 -0000 On Thursday 04 January 2007 09:32, Oliver Fromme wrote: > M. Warner Losh wrote: > > In message: <45975B7B.7030002@FreeBSD.org> > > Doug Barton 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