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

Peter Korsgaard jacmet at sunsite.dk
Mon Jan 24 16:43:03 UTC 2011

>>>>> "Rich" == Rich Felker <dalias at aerifal.cx> writes:

 Rich> On Mon, Jan 24, 2011 at 09:03:45AM +0100, Peter Korsgaard wrote:
 >> Ok, what about:
 >> +	/* 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);

 Rich> How does this work? Normally plain signal sets SA_RESTART and won't be
 Rich> interrupting. You need sigaction without SA_RESTART, or the BB
 Rich> wrapper, to get the interrupting behavior that's desired. Was this
 Rich> code tested?

No, like I said:

> Why not use the alarm() approach like suggested? E.G. something like
> (untested):

I'll respin with signal_no_SA_RESTART_empty_mask().

Bye, Peter Korsgaard

More information about the busybox mailing list