smk (12/22/82)
The following shows 2 bug fixes in /usr/sys/dev/tty.c. I hope these are included in 4.2bsd. The first is a bug that is not noticed when 2 UNIX systems are communicating, but appear when UNIX is connected to a machine that does flow control but refuses to take 2 stop characters without an intervening start character. The fix looks to see if the stop character was sent already. If so, it is not sent again. The fix now makes computer-compter communication possible with flow control between 4.1 and any other machine (e.g., IBM) that handles flow control with terminals. The second fix allows the stty hup to be undone. We defined TIOCCHPCL in /usr/include/sys/ioctl.h as: #define TIOCCHPCL (('t'<<8)|113) /* clear hangup line on close bit */ and changed stty.c to allow for it: *** /usr/src/cmd/stty.c Wed Jul 8 21:48:57 1981 --- /usr/src/new/stty.c Sun May 16 10:45:20 1982 *************** *** 256,261 ioctl(1, TIOCHPCL, NULL); continue; } for(i=0; speeds[i].string; i++) if(eq(speeds[i].string)) { mode.sg_ispeed = mode.sg_ospeed = speeds[i].speed; --- 256,267 ----- ioctl(1, TIOCHPCL, NULL); continue; } + #ifdef MITRE + if (eq("-hup")) { + ioctl(1, TIOCCHPCL, NULL); + continue; + } + #endif for(i=0; speeds[i].string; i++) if(eq(speeds[i].string)) { mode.sg_ispeed = mode.sg_ospeed = speeds[i].speed; *** tty.c.orig Sun May 16 10:32:55 1982 --- tty.c Mon Dec 20 18:10:59 1982 *************** *** 142,147 flushtty(tp, FREAD|FWRITE); tp->t_state &= ~TBLOCK; } if (x >= TTYHOG/2) { if (putc(tun.t_stopc, &tp->t_outq)==0) { tp->t_state |= TBLOCK; --- 142,153 ----- flushtty(tp, FREAD|FWRITE); tp->t_state &= ~TBLOCK; } + #ifdef MITRE + /* We should only block if we aren't in that state already. + We check for the blocked state before blocking, and + don't block if we already have. */ + if (!(tp->t_state & TBLOCK)) + #endif if (x >= TTYHOG/2) { if (putc(tun.t_stopc, &tp->t_outq)==0) { tp->t_state |= TBLOCK; *************** *** 369,374 case TIOCHPCL: tp->t_state |= HUPCLS; break; case TIOCFLUSH: { int flags; --- 375,389 ----- case TIOCHPCL: tp->t_state |= HUPCLS; break; + + #ifdef MITRE + /* + * Do not hang up line on last close + */ + case TIOCCHPCL: + tp->t_state &= ~HUPCLS; + break; + #endif case TIOCFLUSH: { int flags;