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 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)); |
61static void ptsstop __P((struct tty *tp, int rw)); |
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; |
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, |
83 /* stop */ nostop, |
84 /* reset */ noreset, |
85 /* devtotty */ nodevtotty, 86 /* poll */ ttypoll, |
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, |
108 /* devtotty */ nodevtotty, |
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 |
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 --- |