Re: [PATCH] Console: fall back to /dev/null when no console is availlable

Jörn Engel
2004-10-06T13:33:36Z

On Wed, 6 October 2004 15:07:05 +0200, Geert Uytterhoeven wrote:
> On Wed, 6 Oct 2004, [iso-8859-1] Jörn Engel wrote:
> >
> > Point is that above patch is simpler and empiria didn't give me a
> > reason to worry about anything else.
>
> I'll give you another reason :-)
>
> If I do have multiple active struct consoles registered (e.g. normal tty0 or
> ttyS0 and a debug console without a real tty), and the /dev/console demux
> thinks the debug console is the real one (the one opened if you open
> /dev/console), printk() messages will appear on both active consoles, but
> /dev/console cannot be opened.
>
> To avoid this problem, the /dev/console demux should walk the list of active
> consoles until it finds one that can be opened, or fall back to /dev/null if
> none is found.
>
> Does that sound reasonable?

Not to me, no. But I was wrong before.

Having no console at all is a valid design. It used to cause
problems, my patch fixes them. A command-line option like
"console=/dev/null" doesn't fix it because it doesn't do what it
appears to do at first glance, so the patch is needed.

Having a non-working console, esp. for debug, is a rather odd design.
My approach would be to either explicitly tell the kernel to use the
other as default console via "console=/dev/ttyS0" or not have the
debug thing in the kernel in the first place. Either way, no patch is
needed.

Worse, a kernel patch would paper over what is an underlying problem
in my book. Fix the first problem, don't live with it as good as
possible.

Is this reasonable?

Jörn

--
The competent programmer is fully aware of the strictly limited size of
his own skull; therefore he approaches the programming task in full
humility, and among other things he avoids clever tricks like the plague.
-- Edsger W. Dijkstra