[PATCH] getty: Wait until all output written to stdouthas beentransmitted

Cathey, Jim jcathey at ciena.com
Mon Jan 24 23:13:00 UTC 2011


> why is it required? as the tty should have been 
> closed and reopened before, the queues should already be empty.

It is entirely possible for the system to be configured
with something that holds the port open.  Used to use stty
(or something else, I forget) started by init to set the port
baud rate, for example.  It'd hold the port open forever, so
there was no close-induced flush.  A flush was still needed,
so getty does it.

>I don't know what output gets truncated. I assume it's kernel
>console output.

I believe it was init script output that is being considered here.
(The kernel should be responsible for taking care of its own
business; not getty's job at all.)

>"Thanks for informing us that it is important.
>It would be awesome if we would also be informed
>WHY it is important..."

Agreed.  Hayes-style modems litter the input/output
streams with various in-band messages for out-of-band
functions, flushes are entirely appropriate.  As I recall,
you would get something like "CONNECT 1200\r\n" to let you
know what baud rate you should be setting the port to, and
it wasn't too cool to feed that crud on to getty or login!

> old init processes sometimes delayed spawning of new (getty)
> processes for several seconds (resulting in tty close - delay - open)

This was (is) to prevent burning up the CPU time if there is some kind
of hardware configuration problem that results in a looping close/open
kind of thing.  The delay is harmless in normal use, and essential
when things fail in a certain way.

-- Jim






More information about the busybox mailing list