pty.c (37683) | pty.c (38485) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95 | 1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95 |
34 * $Id: tty_pty.c,v 1.52 1998/06/07 17:11:43 dfr Exp $ | 34 * $Id: tty_pty.c,v 1.53 1998/07/15 12:18:30 bde Exp $ |
35 */ 36 37/* 38 * Pseudo-teletype Driver 39 * (Actually two drivers, requiring two entries in 'cdevsw') 40 */ 41#include "pty.h" /* XXX */ 42#include "opt_compat.h" --- 31 unchanged lines hidden (view full) --- 74static d_stop_t ptsstop; 75static d_devtotty_t ptydevtotty; 76static d_open_t ptcopen; 77static d_close_t ptcclose; 78static d_read_t ptcread; 79static d_write_t ptcwrite; 80static d_poll_t ptcpoll; 81 | 35 */ 36 37/* 38 * Pseudo-teletype Driver 39 * (Actually two drivers, requiring two entries in 'cdevsw') 40 */ 41#include "pty.h" /* XXX */ 42#include "opt_compat.h" --- 31 unchanged lines hidden (view full) --- 74static d_stop_t ptsstop; 75static d_devtotty_t ptydevtotty; 76static d_open_t ptcopen; 77static d_close_t ptcclose; 78static d_read_t ptcread; 79static d_write_t ptcwrite; 80static d_poll_t ptcpoll; 81 |
82#define CDEV_MAJOR_S 5 83#define CDEV_MAJOR_C 6 84static struct cdevsw pts_cdevsw = 85 { ptsopen, ptsclose, ptsread, ptswrite, /*5*/ 86 ptyioctl, ptsstop, nullreset, ptydevtotty,/* ttyp */ 87 ttpoll, nommap, NULL, "pts", NULL, -1 }; | 82#define CDEV_MAJOR_S 5 83static struct cdevsw pts_cdevsw = { 84 ptsopen, ptsclose, ptsread, ptswrite, 85 ptyioctl, ptsstop, nullreset, ptydevtotty, 86 ttpoll, nommap, NULL, "pts", 87 NULL, -1, nodump, nopsize, 88 D_TTY, 89}; |
88 | 90 |
89static struct cdevsw ptc_cdevsw = 90 { ptcopen, ptcclose, ptcread, ptcwrite, /*6*/ 91 ptyioctl, nullstop, nullreset, ptydevtotty,/* ptyp */ 92 ptcpoll, nommap, NULL, "ptc", NULL, -1 }; | 91#define CDEV_MAJOR_C 6 92static struct cdevsw ptc_cdevsw = { 93 ptcopen, ptcclose, ptcread, ptcwrite, 94 ptyioctl, nullstop, nullreset, ptydevtotty, 95 ptcpoll, nommap, NULL, "ptc", 96 NULL, -1, nodump, nopsize, 97 D_TTY, 98}; |
93 | 99 |
94 | |
95#if NPTY == 1 96#undef NPTY 97#define NPTY 32 /* crude XXX */ 98#warning You have only one pty defined, redefining to 32. 99#endif 100 101#ifdef DEVFS 102#define MAXUNITS (8 * 32) --- 70 unchanged lines hidden (view full) --- 173 tp = &pt_tty[minor(dev)]; 174 if ((tp->t_state & TS_ISOPEN) == 0) { 175 ttychars(tp); /* Set up default chars */ 176 tp->t_iflag = TTYDEF_IFLAG; 177 tp->t_oflag = TTYDEF_OFLAG; 178 tp->t_lflag = TTYDEF_LFLAG; 179 tp->t_cflag = TTYDEF_CFLAG; 180 tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; | 100#if NPTY == 1 101#undef NPTY 102#define NPTY 32 /* crude XXX */ 103#warning You have only one pty defined, redefining to 32. 104#endif 105 106#ifdef DEVFS 107#define MAXUNITS (8 * 32) --- 70 unchanged lines hidden (view full) --- 178 tp = &pt_tty[minor(dev)]; 179 if ((tp->t_state & TS_ISOPEN) == 0) { 180 ttychars(tp); /* Set up default chars */ 181 tp->t_iflag = TTYDEF_IFLAG; 182 tp->t_oflag = TTYDEF_OFLAG; 183 tp->t_lflag = TTYDEF_LFLAG; 184 tp->t_cflag = TTYDEF_CFLAG; 185 tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; |
181 ttsetwater(tp); /* would be done in xxparam() */ | |
182 } else if (tp->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0) 183 return (EBUSY); 184 if (tp->t_oproc) /* Ctrlr still around. */ 185 (void)(*linesw[tp->t_line].l_modem)(tp, 1); 186 while ((tp->t_state & TS_CARR_ON) == 0) { 187 if (flag&FNONBLOCK) 188 break; 189 error = ttysleep(tp, TSA_CARR_ON(tp), TTIPRI | PCATCH, --- 639 unchanged lines hidden --- | 186 } else if (tp->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0) 187 return (EBUSY); 188 if (tp->t_oproc) /* Ctrlr still around. */ 189 (void)(*linesw[tp->t_line].l_modem)(tp, 1); 190 while ((tp->t_state & TS_CARR_ON) == 0) { 191 if (flag&FNONBLOCK) 192 break; 193 error = ttysleep(tp, TSA_CARR_ON(tp), TTIPRI | PCATCH, --- 639 unchanged lines hidden --- |