Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 Jul 2011 01:08:27 -0700
From:      perryh@pluto.rain.com
To:        korvus@comcast.net
Cc:        freebsd-net@freebsd.org, feenberg@nber.org, freebsd-questions@freebsd.org
Subject:   Re: Question about NIC link state initialization
Message-ID:  <4e0d807b.wTa9PBvXJSlvUXly%perryh@pluto.rain.com>
In-Reply-To: <4E0C7208.2040805@comcast.net>
References:  <4E0B540B.3090400@comcast.net> <4e0c0548.eW27hshSLoLhhTu1%perryh@pluto.rain.com> <alpine.LFD.2.00.1106300644320.21262@nber9.nber.org> <4E0C7208.2040805@comcast.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Steve Polyack <korvus@comcast.net> 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.)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4e0d807b.wTa9PBvXJSlvUXly%perryh>