serial on lombard

Michael Schmitz schmitz at opal.biophys.uni-duesseldorf.de
Fri Oct 15 02:10:12 EST 1999


> I think the code should be as follows:
>    signal( SIGALRM, a_signal_handler_which_just_returns );
>    alarm(4);
>    portfd = open( dial_tty, O_RDWR|O_NONBLOCK);
>    alarm(0);
>    if( portfd >= 0 ) {
>       ...
> 
> In old code (and in the patched one too) there is a race condition
> between clearing the alarm and signal delivery. A sequence similar
> to the above one relies only on the return value of open().
> Regards,

alarm(0) only clears the timer and won't change the return value of open. 
Watching the strace output closely you will see that the return value of 
open is filled in only after the alarm fired. The macserial open fails to 
check for pending signals after completing the modem powerup wait, and 
can't detect the timeout. 

	Michael

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-dev mailing list