>> + /* 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);
>How does this work? Normally plain signal sets SA_RESTART and won't be
>interrupting. You need sigaction without SA_RESTART, or the BB
>wrapper, to get the interrupting behavior that's desired. Was this
>code tested?
Perhaps I missed something, but wasn't the purpose to ensure the
flush happened before the program exited? In that case, wouldn't:
signal(SIGALRM, exit);
alarm(5);
tcdrain(STDOUT_FILENO); // Stdout, not stdin, isn't it?
alarm(0);
signal(SIGALRM, SIG_DFL);
do it? Restart bits don't matter if you're not coming back.
There is no recovery strategy for the tcdrain anyway. All signals
_are_ interrupting, you _will_ take the signal no matter where
you are in the flow of execution.
Or is all this just before closing the transmitting fd,
but _not_ exiting? In which case what happens after the
alarm signal hits _does_ matter?
-- Jim
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox