tty.c (12662) | tty.c (12813) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1990, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)tty.c 8.8 (Berkeley) 1/21/94 | 1/*- 2 * Copyright (c) 1982, 1986, 1990, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)tty.c 8.8 (Berkeley) 1/21/94 |
39 * $Id: tty.c,v 1.71 1995/10/31 19:27:50 bde Exp $ | 39 * $Id: tty.c,v 1.72 1995/12/07 12:46:57 davidg Exp $ |
40 */ 41 42/*- 43 * TODO: 44 * o Fix races for sending the start char in ttyflush(). 45 * o Handle inter-byte timeout for "MIN > 0, TIME > 0" in ttyselect(). 46 * With luck, there will be MIN chars before select() returns(). 47 * o Handle CLOCAL consistently for ptys. Perhaps disallow setting it. --- 373 unchanged lines hidden (view full) --- 421 */ 422 if (ISSET(iflag, IXON)) { 423 if (CCEQ(cc[VSTOP], c)) { 424 if (!ISSET(tp->t_state, TS_TTSTOP)) { 425 SET(tp->t_state, TS_TTSTOP); 426#ifdef sun4c /* XXX */ 427 (*tp->t_stop)(tp, 0); 428#else | 40 */ 41 42/*- 43 * TODO: 44 * o Fix races for sending the start char in ttyflush(). 45 * o Handle inter-byte timeout for "MIN > 0, TIME > 0" in ttyselect(). 46 * With luck, there will be MIN chars before select() returns(). 47 * o Handle CLOCAL consistently for ptys. Perhaps disallow setting it. --- 373 unchanged lines hidden (view full) --- 421 */ 422 if (ISSET(iflag, IXON)) { 423 if (CCEQ(cc[VSTOP], c)) { 424 if (!ISSET(tp->t_state, TS_TTSTOP)) { 425 SET(tp->t_state, TS_TTSTOP); 426#ifdef sun4c /* XXX */ 427 (*tp->t_stop)(tp, 0); 428#else |
429 (*cdevsw[major(tp->t_dev)].d_stop)(tp, | 429 (*cdevsw[major(tp->t_dev)]->d_stop)(tp, |
430 0); 431#endif 432 return (0); 433 } 434 if (!CCEQ(cc[VSTART], c)) 435 return (0); 436 /* 437 * if VSTART == VSTOP then toggle --- 522 unchanged lines hidden (view full) --- 960 break; 961 case TIOCSTOP: /* stop output, like ^S */ 962 s = spltty(); 963 if (!ISSET(tp->t_state, TS_TTSTOP)) { 964 SET(tp->t_state, TS_TTSTOP); 965#ifdef sun4c /* XXX */ 966 (*tp->t_stop)(tp, 0); 967#else | 430 0); 431#endif 432 return (0); 433 } 434 if (!CCEQ(cc[VSTART], c)) 435 return (0); 436 /* 437 * if VSTART == VSTOP then toggle --- 522 unchanged lines hidden (view full) --- 960 break; 961 case TIOCSTOP: /* stop output, like ^S */ 962 s = spltty(); 963 if (!ISSET(tp->t_state, TS_TTSTOP)) { 964 SET(tp->t_state, TS_TTSTOP); 965#ifdef sun4c /* XXX */ 966 (*tp->t_stop)(tp, 0); 967#else |
968 (*cdevsw[major(tp->t_dev)].d_stop)(tp, 0); | 968 (*cdevsw[major(tp->t_dev)]->d_stop)(tp, 0); |
969#endif 970 } 971 splx(s); 972 break; 973 case TIOCSCTTY: /* become controlling tty */ 974 /* Session ctty vnode pointer set in vnode layer. */ 975 if (!SESS_LEADER(p) || 976 ((p->p_session->s_ttyvp || tp->t_session) && --- 84 unchanged lines hidden (view full) --- 1061 * cdevsw. It relies on a proper xxxdevtotty routine. 1062 */ 1063int 1064ttselect(dev, rw, p) 1065 dev_t dev; 1066 int rw; 1067 struct proc *p; 1068{ | 969#endif 970 } 971 splx(s); 972 break; 973 case TIOCSCTTY: /* become controlling tty */ 974 /* Session ctty vnode pointer set in vnode layer. */ 975 if (!SESS_LEADER(p) || 976 ((p->p_session->s_ttyvp || tp->t_session) && --- 84 unchanged lines hidden (view full) --- 1061 * cdevsw. It relies on a proper xxxdevtotty routine. 1062 */ 1063int 1064ttselect(dev, rw, p) 1065 dev_t dev; 1066 int rw; 1067 struct proc *p; 1068{ |
1069 return ttyselect((*cdevsw[major(dev)].d_devtotty)(dev), rw, p); | 1069 return ttyselect((*cdevsw[major(dev)]->d_devtotty)(dev), rw, p); |
1070} 1071 1072/* 1073 * Must be called at spltty(). 1074 */ 1075static int 1076ttnread(tp) 1077 struct tty *tp; --- 71 unchanged lines hidden (view full) --- 1149 1150 s = spltty(); 1151again: 1152 if (rw & FWRITE) 1153 CLR(tp->t_state, TS_TTSTOP); 1154#ifdef sun4c /* XXX */ 1155 (*tp->t_stop)(tp, rw); 1156#else | 1070} 1071 1072/* 1073 * Must be called at spltty(). 1074 */ 1075static int 1076ttnread(tp) 1077 struct tty *tp; --- 71 unchanged lines hidden (view full) --- 1149 1150 s = spltty(); 1151again: 1152 if (rw & FWRITE) 1153 CLR(tp->t_state, TS_TTSTOP); 1154#ifdef sun4c /* XXX */ 1155 (*tp->t_stop)(tp, rw); 1156#else |
1157 (*cdevsw[major(tp->t_dev)].d_stop)(tp, rw); | 1157 (*cdevsw[major(tp->t_dev)]->d_stop)(tp, rw); |
1158#endif 1159 if (rw & FREAD) { 1160 FLUSHQ(&tp->t_canq); 1161 FLUSHQ(&tp->t_rawq); 1162 CLR(tp->t_lflag, PENDIN); 1163 tp->t_rocount = 0; 1164 tp->t_rocol = 0; 1165 CLR(tp->t_state, TS_LOCAL); --- 150 unchanged lines hidden (view full) --- 1316 CLR(tp->t_state, TS_TTSTOP); 1317 ttstart(tp); 1318 } else if (!ISSET(tp->t_state, TS_CAR_OFLOW)) { 1319 SET(tp->t_state, TS_CAR_OFLOW); 1320 SET(tp->t_state, TS_TTSTOP); 1321#ifdef sun4c /* XXX */ 1322 (*tp->t_stop)(tp, 0); 1323#else | 1158#endif 1159 if (rw & FREAD) { 1160 FLUSHQ(&tp->t_canq); 1161 FLUSHQ(&tp->t_rawq); 1162 CLR(tp->t_lflag, PENDIN); 1163 tp->t_rocount = 0; 1164 tp->t_rocol = 0; 1165 CLR(tp->t_state, TS_LOCAL); --- 150 unchanged lines hidden (view full) --- 1316 CLR(tp->t_state, TS_TTSTOP); 1317 ttstart(tp); 1318 } else if (!ISSET(tp->t_state, TS_CAR_OFLOW)) { 1319 SET(tp->t_state, TS_CAR_OFLOW); 1320 SET(tp->t_state, TS_TTSTOP); 1321#ifdef sun4c /* XXX */ 1322 (*tp->t_stop)(tp, 0); 1323#else |
1324 (*cdevsw[major(tp->t_dev)].d_stop)(tp, 0); | 1324 (*cdevsw[major(tp->t_dev)]->d_stop)(tp, 0); |
1325#endif 1326 } 1327 } else if (flag == 0) { 1328 /* 1329 * Lost carrier. 1330 */ 1331 CLR(tp->t_state, TS_CARR_ON); 1332 if (ISSET(tp->t_state, TS_ISOPEN) && --- 1010 unchanged lines hidden --- | 1325#endif 1326 } 1327 } else if (flag == 0) { 1328 /* 1329 * Lost carrier. 1330 */ 1331 CLR(tp->t_state, TS_CARR_ON); 1332 if (ISSET(tp->t_state, TS_ISOPEN) && --- 1010 unchanged lines hidden --- |