[PATCH] getty: Wait until all output written to stdout has beentransmitted
jacmet at sunsite.dk
Mon Jan 24 19:32:52 UTC 2011
>>>>> "Jim" == Cathey, Jim <jcathey at ciena.com> writes:
Jim> Perhaps I missed something, but wasn't the purpose to ensure the
Jim> flush happened before the program exited? In that case, wouldn't:
Jim> signal(SIGALRM, exit);
Jim> tcdrain(STDOUT_FILENO); // Stdout, not stdin, isn't it?
Jim> signal(SIGALRM, SIG_DFL);
Jim> do it? Restart bits don't matter if you're not coming back.
Jim> There is no recovery strategy for the tcdrain anyway. All signals
Jim> _are_ interrupting, you _will_ take the signal no matter where
Jim> you are in the flow of execution.
No, this is while starting up, so we don't want to exit. The only reason
for the alarm() is that tcdrain() might hang because of flow control
issues according to Denys, and if that happens we just want to fall
through and tcflush().
And yes, STDOUT_FILENO would be somewhat clearer (but wouldn't matter as
we just did xdup2(0, 1)), but I kept it as STDIN to match the tcflush
Bye, Peter Korsgaard
More information about the busybox