2011/3/11 Anton Maksimenkov <anton...@gmail.com>: >> If some process can catch COM port in a way that noone can use the >> port and noone can kill that process - it is wrong situation.
I think this would be a little bit better: --- /usr/origsrc/sys/kern/tty.c Mon Oct 11 22:20:15 2010 +++ /usr/src/sys/kern/tty.c Fri Mar 11 22:57:48 2011 @@ -1188,7 +1188,8 @@ int ttywait(struct tty *tp) { - int error, s; + int error, s, tm; + struct proc *p = curproc; error = 0; s = spltty(); @@ -1200,8 +1201,15 @@ (ISSET(tp->t_state, TS_CARR_ON) || ISSET(tp->t_cflag, CLOCAL)) && tp->t_oproc) { SET(tp->t_state, TS_ASLEEP); - error = ttysleep(tp, &tp->t_outq, TTOPRI | PCATCH, ttyout, 0); + if (p->p_flag & P_WEXIT) + tm = 100; + else + tm = 0; + error = ttysleep(tp, &tp->t_outq, TTOPRI | PCATCH, ttyout, tm); if (error) + break; + /* If the process exiting we have to exit */ + if (p->p_flag & P_WEXIT) break; } else break; -- antonvm