Deleted Added
sdiff udiff text old ( 53483 ) new ( 57070 )
full compact
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 * $FreeBSD: head/sys/kern/tty_pty.c 53483 1999-11-21 02:54:54Z jkh $
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"

--- 70 unchanged lines hidden (view full) ---

113
114struct pt_ioctl {
115 int pt_flags;
116 struct selinfo pt_selr, pt_selw;
117 u_char pt_send;
118 u_char pt_ucntl;
119 struct tty pt_tty;
120 dev_t devs, devc;
121};
122
123#define PF_PKT 0x08 /* packet mode */
124#define PF_STOPPED 0x10 /* user told stopped */
125#define PF_REMOTE 0x20 /* remote and flow controlled input */
126#define PF_NOSTOP 0x40
127#define PF_UCNTL 0x80 /* user control mode */
128

--- 36 unchanged lines hidden (view full) ---

165 dev_t dev;
166 int flag, devtype;
167 struct proc *p;
168{
169 register struct tty *tp;
170 int error;
171 int minr;
172 dev_t nextdev;
173
174 /*
175 * XXX: Gross hack for DEVFS:
176 * If we openned this device, ensure we have the
177 * next one too, so people can open it.
178 */
179 minr = lminor(dev);
180 if (minr < 255) {
181 nextdev = makedev(major(dev), minr + 1);
182 if (!nextdev->si_drv1) {
183 ptyinit(minr + 1);
184 }
185 }
186 if (!dev->si_drv1)
187 ptyinit(minor(dev));
188 if (!dev->si_drv1)
189 return(ENXIO);
190 tp = dev->si_tty;
191 if ((tp->t_state & TS_ISOPEN) == 0) {
192 ttychars(tp); /* Set up default chars */
193 tp->t_iflag = TTYDEF_IFLAG;
194 tp->t_oflag = TTYDEF_OFLAG;
195 tp->t_lflag = TTYDEF_LFLAG;
196 tp->t_cflag = TTYDEF_CFLAG;
197 tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
198 } else if (tp->t_state & TS_XCLUDE && suser(p))
199 return (EBUSY);
200 if (tp->t_oproc) /* Ctrlr still around. */
201 (void)(*linesw[tp->t_line].l_modem)(tp, 1);
202 while ((tp->t_state & TS_CARR_ON) == 0) {
203 if (flag&FNONBLOCK)
204 break;
205 error = ttysleep(tp, TSA_CARR_ON(tp), TTIPRI | PCATCH,
206 "ptsopn", 0);
207 if (error)

--- 141 unchanged lines hidden (view full) ---

349 tp = dev->si_tty;
350 if (tp->t_oproc)
351 return (EIO);
352 tp->t_oproc = ptsstart;
353 tp->t_stop = ptsstop;
354 (void)(*linesw[tp->t_line].l_modem)(tp, 1);
355 tp->t_lflag &= ~EXTPROC;
356 pti = dev->si_drv1;
357 pti->pt_flags = 0;
358 pti->pt_send = 0;
359 pti->pt_ucntl = 0;
360 return (0);
361}
362
363static int
364ptcclose(dev, flags, fmt, p)

--- 458 unchanged lines hidden ---