[PATCH] getty: Wait until all output written to stdout has been transmitted
monstr at monstr.eu
Mon Jan 24 12:25:51 UTC 2011
Denys Vlasenko wrote:
> On Sun, Jan 23, 2011 at 11:28 AM, Michal Simek <monstr at monstr.eu> wrote:
>> Rich Felker wrote:
>>> On Sat, Jan 22, 2011 at 01:40:45PM +0100, Mikhail Gusarov wrote:
>>>> Twas brillig at 02:57:47 22.01.2011 UTC+01 when vda.linux at googlemail.com
>>>> did gyre and gimble:
>>>> DV> But it may lead to a hang if serial line gets mangled: in some
>>>> DV> situations tcdrain may wait forever.
>>>> DV> I propose adding sleep(1) before the flush. Can you verify that it
>>>> DV> works?
>>>> alarm+tcdrain maybe? This way it won't wait a second if there is nothing
>>>> to drain.
>>> Indeed this is a much better solution. Calling sleep(1) is really
>> 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.
This doesn't solve the problem.
> 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?
yes, it is the same.
Peter's solution with alarm work for me.
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
More information about the busybox