>>>>> "Denys" == Denys Vlasenko <[email protected]> writes:
Hi, Denys> I committed a fix with usleep(100*1000) for now - it's better than what Denys> we have now. Denys> If you feel strongly about needing alarm-based fix, please send a patch Denys> for review. Ok, what about: >From 343e399118d1039cca8c55a5b865920e0b57f69d Mon Sep 17 00:00:00 2001 From: Peter Korsgaard <[email protected]> Date: Mon, 24 Jan 2011 09:02:01 +0100 Subject: [PATCH] getty: wait up to 5 seconds for the output buffer to drain To not lose data on slow serial ports. Signed-off-by: Peter Korsgaard <[email protected]> --- loginutils/getty.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/loginutils/getty.c b/loginutils/getty.c index bf66f22..c063f74 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c @@ -232,12 +232,12 @@ static void open_tty(void) /* initialize termios settings */ static void termios_init(int speed) { - /* Flush input and output queues, important for modems! - * Users report losing previously queued output chars, and I hesitate - * to use tcdrain here instead of tcflush - I imagine it can block. - * Using small sleep instead. - */ - usleep(100*1000); /* 0.1 sec */ + /* Wait up to 5 seconds for the output buffer to drain */ + signal(SIGALRM, record_signo); + alarm(5); + tcdrain(STDIN_FILENO); + alarm(0); + signal(SIGALRM, SIG_DFL); tcflush(STDIN_FILENO, TCIOFLUSH); /* Set speed if it wasn't specified as "0" on command line. */ -- 1.7.2.3 -- Bye, Peter Korsgaard _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
