Deleted Added
full compact
39c39
< * $Id: tty.c,v 1.61 1995/07/31 18:29:28 bde Exp $
---
> * $Id: tty.c,v 1.62 1995/07/31 19:17:11 bde Exp $
775,776c775
< ISSET(constty->t_state, TS_CARR_ON | TS_ISOPEN) ==
< (TS_CARR_ON | TS_ISOPEN))
---
> ISSET(constty->t_state, TS_CONNECTED))
845,853c844,856
< } else {
< if (!ISSET(tp->t_state, TS_CARR_ON) &&
< ISSET(tp->t_cflag, CLOCAL) &&
< !ISSET(t->c_cflag, CLOCAL)) {
< #if 0
< CLR(tp->t_state, TS_ISOPEN);
< #endif
< ttwakeup(tp);
< }
---
> }
> if (ISSET(t->c_cflag, CLOCAL) &&
> !ISSET(tp->t_cflag, CLOCAL)) {
> /*
> * XXX disconnections would be too hard to
> * get rid of without this kludge. The only
> * way to get rid of controlling terminals
> * is to exit from the session leader.
> */
> CLR(tp->t_state, TS_ZOMBIE);
>
> wakeup(TSA_CARR_ON(tp));
> ttwakeup(tp);
855,857d857
< tp->t_cflag = t->c_cflag;
< tp->t_ispeed = t->c_ispeed;
< tp->t_ospeed = t->c_ospeed;
858a859,867
> if ((ISSET(tp->t_state, TS_CARR_ON) ||
> ISSET(t->c_cflag, CLOCAL)) &&
> !ISSET(tp->t_state, TS_ZOMBIE))
> SET(tp->t_state, TS_CONNECTED);
> else
> CLR(tp->t_state, TS_CONNECTED);
> tp->t_cflag = t->c_cflag;
> tp->t_ispeed = t->c_ispeed;
> tp->t_ospeed = t->c_ospeed;
1021,1022c1030
< if (ttnread(tp) > 0 || (!ISSET(tp->t_cflag, CLOCAL) &&
< !ISSET(tp->t_state, TS_CARR_ON)))
---
> if (ttnread(tp) > 0 || ISSET(tp->t_state, TS_ZOMBIE))
1027c1035,1037
< if (tp->t_outq.c_cc <= tp->t_lowat) {
---
> if ((tp->t_outq.c_cc <= tp->t_lowat &&
> ISSET(tp->t_state, TS_CONNECTED))
> || ISSET(tp->t_state, TS_ZOMBIE)) {
1083,1084c1093
< (ISSET(tp->t_state, TS_CARR_ON) || ISSET(tp->t_cflag, CLOCAL))
< && tp->t_oproc) {
---
> ISSET(tp->t_state, TS_CONNECTED) && tp->t_oproc) {
1087c1096
< (ISSET(tp->t_state, TS_CARR_ON) || ISSET(tp->t_cflag, CLOCAL))) {
---
> ISSET(tp->t_state, TS_CONNECTED)) {
1308a1318,1319
> SET(tp->t_state, TS_ZOMBIE);
> CLR(tp->t_state, TS_CONNECTED);
1318a1330,1332
> if (!ISSET(tp->t_state, TS_ZOMBIE))
> SET(tp->t_state, TS_CONNECTED);
> wakeup(TSA_CARR_ON(tp));
1367c1381
< int s, first, error = 0, carrier;
---
> int s, first, error = 0;
1399a1414,1418
> if (ISSET(tp->t_state, TS_ZOMBIE)) {
> splx(s);
> return (0); /* EOF */
> }
>
1411,1414c1430
< carrier = ISSET(tp->t_state, TS_CARR_ON) ||
< ISSET(tp->t_cflag, CLOCAL);
< if ((!carrier && ISSET(tp->t_state, TS_ISOPEN)) ||
< !ISSET(lflag, ICANON) && cc[VMIN] == 0) {
---
> if (!ISSET(lflag, ICANON) && cc[VMIN] == 0) {
1504,1509d1519
<
< /*
< * If there is no input, sleep on rawq
< * awaiting hardware receipt and notification.
< * If we have data, we don't need to check for carrier.
< */
1512,1519c1522,1526
< carrier = ISSET(tp->t_state, TS_CARR_ON) ||
< ISSET(tp->t_cflag, CLOCAL);
< if (!carrier && ISSET(tp->t_state, TS_ISOPEN)) {
< splx(s);
< return (0); /* EOF */
< }
< error = ttysleep(tp, TSA_CARR_ON(tp), TTIPRI | PCATCH,
< carrier ?
---
> /*
> * There is no input, or not enough input and we can block.
> */
> error = ttysleep(tp, TSA_HUP_OR_INPUT(tp), TTIPRI | PCATCH,
> ISSET(tp->t_state, TS_CONNECTED) ?
1693,1695c1700,1707
< if (!ISSET(tp->t_state, TS_CARR_ON) &&
< !ISSET(tp->t_cflag, CLOCAL)) {
< if (ISSET(tp->t_state, TS_ISOPEN)) {
---
> if (ISSET(tp->t_state, TS_ZOMBIE)) {
> splx(s);
> if (uio->uio_resid == cnt)
> error = EIO;
> goto out;
> }
> if (!ISSET(tp->t_state, TS_CONNECTED)) {
> if (flag & IO_NDELAY) {
1697,1699d1708
< return (EIO);
< } else if (flag & IO_NDELAY) {
< splx(s);
1702,1708d1710
< } else {
< error = ttysleep(tp, TSA_CARR_ON(tp), TTIPRI | PCATCH,
< "ttydcd", 0);
< splx(s);
< if (error)
< goto out;
< goto loop;
1709a1712,1717
> error = ttysleep(tp, TSA_CARR_ON(tp), TTIPRI | PCATCH,
> "ttydcd", 0);
> splx(s);
> if (error)
> goto out;
> goto loop;
2043c2051,2052
< selwakeup(&tp->t_rsel);
---
> if (tp->t_rsel.si_pid != 0)
> selwakeup(&tp->t_rsel);
2046c2055
< wakeup(TSA_CARR_ON(tp));
---
> wakeup(TSA_HUP_OR_INPUT(tp));
2253,2254c2262
< if (ISSET(tp->t_state,
< TS_CARR_ON | TS_ISOPEN) != (TS_CARR_ON | TS_ISOPEN)) {
---
> if (!ISSET(tp->t_state, TS_CONNECTED)) {