Deleted Added
full compact
pty.c (129939) pty.c (130054)
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

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95
30 */
31
32#include <sys/cdefs.h>
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

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/kern/tty_pty.c 129939 2004-06-01 11:57:15Z phk $");
33__FBSDID("$FreeBSD: head/sys/kern/tty_pty.c 130054 2004-06-04 06:50:35Z phk $");
34
35/*
36 * Pseudo-teletype Driver
37 * (Actually two drivers, requiring two entries in 'cdevsw')
38 */
39#include "opt_compat.h"
40#include "opt_tty.h"
41#include <sys/param.h>

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

103
104#define BUFSIZ 100 /* Chunk size iomoved to/from user */
105
106struct pt_ioctl {
107 int pt_flags;
108 struct selinfo pt_selr, pt_selw;
109 u_char pt_send;
110 u_char pt_ucntl;
34
35/*
36 * Pseudo-teletype Driver
37 * (Actually two drivers, requiring two entries in 'cdevsw')
38 */
39#include "opt_compat.h"
40#include "opt_tty.h"
41#include <sys/param.h>

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

103
104#define BUFSIZ 100 /* Chunk size iomoved to/from user */
105
106struct pt_ioctl {
107 int pt_flags;
108 struct selinfo pt_selr, pt_selw;
109 u_char pt_send;
110 u_char pt_ucntl;
111 struct tty pt_tty;
111 struct tty *pt_tty;
112 dev_t devs, devc;
113 struct prison *pt_prison;
114};
115
116#define PF_PKT 0x08 /* packet mode */
117#define PF_STOPPED 0x10 /* user told stopped */
118#define PF_REMOTE 0x20 /* remote and flow controlled input */
119#define PF_NOSTOP 0x40

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

143
144 devc->si_flags &= ~SI_CHEAPCLONE;
145
146 pt = malloc(sizeof(*pt), M_PTY, M_WAITOK | M_ZERO);
147 pt->devs = devs = make_dev(&pts_cdevsw, n,
148 UID_ROOT, GID_WHEEL, 0666, "tty%c%r", names[n / 32], n % 32);
149 pt->devc = devc;
150
112 dev_t devs, devc;
113 struct prison *pt_prison;
114};
115
116#define PF_PKT 0x08 /* packet mode */
117#define PF_STOPPED 0x10 /* user told stopped */
118#define PF_REMOTE 0x20 /* remote and flow controlled input */
119#define PF_NOSTOP 0x40

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

143
144 devc->si_flags &= ~SI_CHEAPCLONE;
145
146 pt = malloc(sizeof(*pt), M_PTY, M_WAITOK | M_ZERO);
147 pt->devs = devs = make_dev(&pts_cdevsw, n,
148 UID_ROOT, GID_WHEEL, 0666, "tty%c%r", names[n / 32], n % 32);
149 pt->devc = devc;
150
151 pt->pt_tty = ttymalloc(pt->pt_tty);
151 devs->si_drv1 = devc->si_drv1 = pt;
152 devs->si_drv1 = devc->si_drv1 = pt;
152 devs->si_tty = devc->si_tty = &pt->pt_tty;
153 pt->pt_tty.t_dev = devs;
154 ttyregister(&pt->pt_tty);
153 devs->si_tty = devc->si_tty = pt->pt_tty;
154 pt->pt_tty->t_dev = devs;
155 return (devc);
156}
157
158/*ARGSUSED*/
159static int
160ptsopen(dev, flag, devtype, td)
161 dev_t dev;
162 int flag, devtype;

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

743 (pti->pt_flags & PF_PKT)) {
744 pti->pt_send |= TIOCPKT_IOCTL;
745 ptcwakeup(tp, FREAD);
746 }
747 tp->t_lflag &= ~EXTPROC;
748 }
749 return(0);
750 }
155 return (devc);
156}
157
158/*ARGSUSED*/
159static int
160ptsopen(dev, flag, devtype, td)
161 dev_t dev;
162 int flag, devtype;

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

743 (pti->pt_flags & PF_PKT)) {
744 pti->pt_send |= TIOCPKT_IOCTL;
745 ptcwakeup(tp, FREAD);
746 }
747 tp->t_lflag &= ~EXTPROC;
748 }
749 return(0);
750 }
751 error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
752 if (error == ENOIOCTL)
753 error = ttioctl(tp, cmd, data, flag);
754 if (error == ENOIOCTL) {
751 error = ttyioctl(dev, cmd, data, flag, td);
752 if (error == ENOTTY) {
755 if (pti->pt_flags & PF_UCNTL &&
756 (cmd & ~0xff) == UIOCCMD(0)) {
757 if (cmd & 0xff) {
758 pti->pt_ucntl = (u_char)cmd;
759 ptcwakeup(tp, FREAD);
760 }
761 return (0);
762 }

--- 100 unchanged lines hidden ---
753 if (pti->pt_flags & PF_UCNTL &&
754 (cmd & ~0xff) == UIOCCMD(0)) {
755 if (cmd & 0xff) {
756 pti->pt_ucntl = (u_char)cmd;
757 ptcwakeup(tp, FREAD);
758 }
759 return (0);
760 }

--- 100 unchanged lines hidden ---