Subject: Re: PR 7170 -- init and /dev/console
To: NetBSD Kernel Technical Discussion List <tech-kern@NetBSD.ORG>
From: Charles M. Hannum <abuse@spamalicious.com>
List: tech-kern
Date: 04/29/2001 14:25:21
On Fri, Apr 20, 2001 at 02:26:47PM -0400, Greg A. Woods wrote:
> [ On Friday, April 20, 2001 at 02:39:03 (-0700), Michael Lyle wrote: ]
> > Subject: PR 7170 -- init and /dev/console
> >
> > I was thinking about ways to fix this without major kludges (e.g. fixing
> > up a file descriptor in the kernel before init is exec'd).  I have a
> > proposal which might be useful in other operating situations.
> 
> It's really not a kludge at all for the kernel to hand init a file
> descriptor for the console device on stdin/stdout/stderr.  That's the
> way it *should* work, IMO.  The kernel knows what hardware it is using
> as a console and without much trickery it can even know what device
> major/minor numbers it's using so that a stat() would work too.

I actually did this years ago.

The problem is that every transition between single and multi-user mode
requires the console device to be close(2)d, open(2)ed and revoke(2)ed,
so at best it helps you through single-user and then you lose anyway.
Plus, in anything other than a diskless environment, if your /dev is
toast you can't upgrade / to r/w to fix it.  So it didn't seem like
much of a gain, and I punted.