Deleted Added
full compact
pty.c (50652) pty.c (51654)
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 * $FreeBSD: head/sys/kern/tty_pty.c 50652 1999-08-30 10:35:37Z phk $
34 * $FreeBSD: head/sys/kern/tty_pty.c 51654 1999-09-25 16:21:39Z phk $
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"

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

53#include <sys/kernel.h>
54#include <sys/vnode.h>
55#include <sys/signalvar.h>
56#include <sys/malloc.h>
57
58MALLOC_DEFINE(M_PTY, "ptys", "pty data structures");
59
60static void ptsstart __P((struct tty *tp));
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"

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

53#include <sys/kernel.h>
54#include <sys/vnode.h>
55#include <sys/signalvar.h>
56#include <sys/malloc.h>
57
58MALLOC_DEFINE(M_PTY, "ptys", "pty data structures");
59
60static void ptsstart __P((struct tty *tp));
61static void ptsstop __P((struct tty *tp, int rw));
61static void ptcwakeup __P((struct tty *tp, int flag));
62static void ptyinit __P((int n));
63
64static d_open_t ptsopen;
65static d_close_t ptsclose;
66static d_read_t ptsread;
67static d_write_t ptswrite;
68static d_ioctl_t ptyioctl;
62static void ptcwakeup __P((struct tty *tp, int flag));
63static void ptyinit __P((int n));
64
65static d_open_t ptsopen;
66static d_close_t ptsclose;
67static d_read_t ptsread;
68static d_write_t ptswrite;
69static d_ioctl_t ptyioctl;
69static d_stop_t ptsstop;
70static d_devtotty_t ptydevtotty;
71static d_open_t ptcopen;
72static d_close_t ptcclose;
73static d_read_t ptcread;
74static d_write_t ptcwrite;
75static d_poll_t ptcpoll;
76
77#define CDEV_MAJOR_S 5
78static struct cdevsw pts_cdevsw = {
79 /* open */ ptsopen,
80 /* close */ ptsclose,
81 /* read */ ptsread,
82 /* write */ ptswrite,
83 /* ioctl */ ptyioctl,
70static d_open_t ptcopen;
71static d_close_t ptcclose;
72static d_read_t ptcread;
73static d_write_t ptcwrite;
74static d_poll_t ptcpoll;
75
76#define CDEV_MAJOR_S 5
77static struct cdevsw pts_cdevsw = {
78 /* open */ ptsopen,
79 /* close */ ptsclose,
80 /* read */ ptsread,
81 /* write */ ptswrite,
82 /* ioctl */ ptyioctl,
84 /* stop */ ptsstop,
83 /* stop */ nostop,
85 /* reset */ noreset,
84 /* reset */ noreset,
86 /* devtotty */ ptydevtotty,
87 /* poll */ ttpoll,
85 /* devtotty */ nodevtotty,
86 /* poll */ ttypoll,
88 /* mmap */ nommap,
89 /* strategy */ nostrategy,
90 /* name */ "pts",
91 /* parms */ noparms,
92 /* maj */ CDEV_MAJOR_S,
93 /* dump */ nodump,
94 /* psize */ nopsize,
95 /* flags */ D_TTY,

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

101static struct cdevsw ptc_cdevsw = {
102 /* open */ ptcopen,
103 /* close */ ptcclose,
104 /* read */ ptcread,
105 /* write */ ptcwrite,
106 /* ioctl */ ptyioctl,
107 /* stop */ nostop,
108 /* reset */ noreset,
87 /* mmap */ nommap,
88 /* strategy */ nostrategy,
89 /* name */ "pts",
90 /* parms */ noparms,
91 /* maj */ CDEV_MAJOR_S,
92 /* dump */ nodump,
93 /* psize */ nopsize,
94 /* flags */ D_TTY,

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

100static struct cdevsw ptc_cdevsw = {
101 /* open */ ptcopen,
102 /* close */ ptcclose,
103 /* read */ ptcread,
104 /* write */ ptcwrite,
105 /* ioctl */ ptyioctl,
106 /* stop */ nostop,
107 /* reset */ noreset,
109 /* devtotty */ ptydevtotty,
108 /* devtotty */ nodevtotty,
110 /* poll */ ptcpoll,
111 /* mmap */ nommap,
112 /* strategy */ nostrategy,
113 /* name */ "ptc",
114 /* parms */ noparms,
115 /* maj */ CDEV_MAJOR_C,
116 /* dump */ nodump,
117 /* psize */ nopsize,

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

357 if (!dev->si_drv1)
358 ptyinit(minor(dev));
359 if (!dev->si_drv1)
360 return(ENXIO);
361 tp = dev->si_tty;
362 if (tp->t_oproc)
363 return (EIO);
364 tp->t_oproc = ptsstart;
109 /* poll */ ptcpoll,
110 /* mmap */ nommap,
111 /* strategy */ nostrategy,
112 /* name */ "ptc",
113 /* parms */ noparms,
114 /* maj */ CDEV_MAJOR_C,
115 /* dump */ nodump,
116 /* psize */ nopsize,

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

356 if (!dev->si_drv1)
357 ptyinit(minor(dev));
358 if (!dev->si_drv1)
359 return(ENXIO);
360 tp = dev->si_tty;
361 if (tp->t_oproc)
362 return (EIO);
363 tp->t_oproc = ptsstart;
364 tp->t_stop = ptsstop;
365 (void)(*linesw[tp->t_line].l_modem)(tp, 1);
366 tp->t_lflag &= ~EXTPROC;
367 pti = dev->si_drv1;
368 pti->pt_flags = 0;
369 pti->pt_send = 0;
370 pti->pt_ucntl = 0;
371 return (0);
372}

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

642 if (error) {
643 /* adjust for data copied in but not written */
644 uio->uio_resid += cc;
645 return (error);
646 }
647 goto again;
648}
649
365 (void)(*linesw[tp->t_line].l_modem)(tp, 1);
366 tp->t_lflag &= ~EXTPROC;
367 pti = dev->si_drv1;
368 pti->pt_flags = 0;
369 pti->pt_send = 0;
370 pti->pt_ucntl = 0;
371 return (0);
372}

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

642 if (error) {
643 /* adjust for data copied in but not written */
644 uio->uio_resid += cc;
645 return (error);
646 }
647 goto again;
648}
649
650static struct tty *
651ptydevtotty(dev)
652 dev_t dev;
653{
654 if (minor(dev) & ~0xff)
655 return (NULL);
656
657 return dev->si_tty;
658}
659
660/*ARGSUSED*/
661static int
662ptyioctl(dev, cmd, data, flag, p)
663 dev_t dev;
664 u_long cmd;
665 caddr_t data;
666 int flag;
667 struct proc *p;

--- 176 unchanged lines hidden ---
650/*ARGSUSED*/
651static int
652ptyioctl(dev, cmd, data, flag, p)
653 dev_t dev;
654 u_long cmd;
655 caddr_t data;
656 int flag;
657 struct proc *p;

--- 176 unchanged lines hidden ---