From owner-freebsd-questions@FreeBSD.ORG Fri Jul 1 08:12:34 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40967106566C; Fri, 1 Jul 2011 08:12:34 +0000 (UTC) (envelope-from perryh@pluto.rain.com) Received: from agora.rdrop.com (agora.rdrop.com [IPv6:2607:f678:1010::34]) by mx1.freebsd.org (Postfix) with ESMTP id 207068FC1A; Fri, 1 Jul 2011 08:12:34 +0000 (UTC) Received: from agora.rdrop.com (66@localhost [127.0.0.1]) by agora.rdrop.com (8.13.1/8.12.7) with ESMTP id p618CVF2016862 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 1 Jul 2011 01:12:32 -0700 (PDT) (envelope-from perryh@pluto.rain.com) Received: (from uucp@localhost) by agora.rdrop.com (8.13.1/8.12.9/Submit) with UUCP id p618CVU9016861; Fri, 1 Jul 2011 01:12:31 -0700 (PDT) Received: from fbsd61 by pluto.rain.com (4.1/SMI-4.1-pluto-M2060407) id AA00188; Fri, 1 Jul 11 01:08:23 PDT Date: Fri, 01 Jul 2011 01:08:27 -0700 From: perryh@pluto.rain.com To: korvus@comcast.net Message-Id: <4e0d807b.wTa9PBvXJSlvUXly%perryh@pluto.rain.com> References: <4E0B540B.3090400@comcast.net> <4e0c0548.eW27hshSLoLhhTu1%perryh@pluto.rain.com> <4E0C7208.2040805@comcast.net> In-Reply-To: <4E0C7208.2040805@comcast.net> User-Agent: nail 11.25 7/29/05 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org, feenberg@nber.org, freebsd-questions@freebsd.org Subject: Re: Question about NIC link state initialization X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2011 08:12:34 -0000 Steve Polyack wrote: > I was able to "fix" the single-user mode behavior (which I agree, > isn't necessarily broken) and get it to bring up the links by > simply patching init(8) to call system("/sbin/ifconfig") before > prompting for the single-user shell. It works, but I feel dirty. I see no particular objection to adding a way of running "something" ahead of the single-user shell, but system(3) is not necessarily the best mechanism to use for the purpose because it invokes a shell. It would be both more efficient and more robust to call fork(2) and exec(3) (or execve(2)) directly. It would be more general to fork/exec "/etc/rc.single" instead of "/sbin/ifconfig", expecting "/etc/rc.single" to be an executable script (with an appropriate shebang line) and ignoring the failure which would occur if it did not exist. (In your case, instead of a script, you could make /etc/rc.single a link to /sbin/ifconfig.)