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

Cathey, Jim jcathey at ciena.com
Mon Jan 24 20:22:11 UTC 2011

>This thread started by Michal, who's trying to use a very slow
>serial-over-jtag setup on microblaze, and had issues with characters
>getting lost when getty started up (because of the tcflush), so we
>wanted to add a tcdrain() instead.

A design problem?  Why even issue the tcflush(stdout) (in essence)
if you _don't_ want to discard pending output?

Putting a drain first to avoid the flush seems silly.
Perhaps the real fix is to modify the tcflush to not flush
the output stream at all?  Or maybe just for the first time
around, if it's inside a loop of some sort?

If the flush problem is from stuff sent by a process that
preceded getty, rather than getty's own early output, then
the lack of the flush is _its_ problem, not getty's, given
that getty's charter is to program the serial port (if only
partially) in the first place!  Perhaps the parent shouldn't
even be calling getty, but rather login instead?

-- Jim

More information about the busybox mailing list