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

Rich Felker dalias at aerifal.cx
Sun Jan 23 19:08:29 UTC 2011

On Sun, Jan 23, 2011 at 03:39:02PM +0100, Denys Vlasenko wrote:
> On Sun, Jan 23, 2011 at 11:28 AM, Michal Simek <monstr at monstr.eu> wrote:
> > Give me what I should test and I will do it.
> Insert sleep(1) before tcflush(0, TCIOFLUSH) in termios_init in getty.c,
> and let us know whether the "getty nukes a few last output chars sent
> before it is started" problem has been fixed by it.
> If it does, experiment with smaller sleeps - use usleep(MICROSECONDS) -
> and let us know what minimal pause is enough. Also let us know
> the settings on the serial line (primarily baud rate). If you can use
> different ones, experiment with smallest available.
> There is already another sleep(1) in getty, in get_logname - can you
> experiment with lowering it too?

Is there a reason you're not considering the alarm approach?
alarm+drain will not hang at all if the buffer drains immediately.
sleep+flush or usleep+flush will *always* sleep at least some
interval, which is annoying to the user.


More information about the busybox mailing list