tty_tty.c (29041) | tty_tty.c (29354) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1991, 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_tty.c 8.2 (Berkeley) 9/23/93 | 1/*- 2 * Copyright (c) 1982, 1986, 1991, 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_tty.c 8.2 (Berkeley) 9/23/93 |
34 * $Id: tty_tty.c,v 1.16 1997/03/24 11:24:38 bde Exp $ | 34 * $Id: tty_tty.c,v 1.17 1997/09/02 20:05:56 bde Exp $ |
35 */ 36 37/* 38 * Indirect driver for controlling tty. 39 */ 40#include <sys/param.h> | 35 */ 36 37/* 38 * Indirect driver for controlling tty. 39 */ 40#include <sys/param.h> |
41#include <sys/systm.h> |
|
41#include <sys/conf.h> 42#include <sys/proc.h> 43#include <sys/tty.h> 44#include <sys/vnode.h> 45#include <sys/fcntl.h> 46#include <sys/kernel.h> 47#ifdef DEVFS 48#include <sys/devfsext.h> 49#endif /*DEVFS*/ 50 51static d_open_t cttyopen; 52static d_read_t cttyread; 53static d_write_t cttywrite; 54static d_ioctl_t cttyioctl; | 42#include <sys/conf.h> 43#include <sys/proc.h> 44#include <sys/tty.h> 45#include <sys/vnode.h> 46#include <sys/fcntl.h> 47#include <sys/kernel.h> 48#ifdef DEVFS 49#include <sys/devfsext.h> 50#endif /*DEVFS*/ 51 52static d_open_t cttyopen; 53static d_read_t cttyread; 54static d_write_t cttywrite; 55static d_ioctl_t cttyioctl; |
55static d_select_t cttyselect; | 56static d_poll_t cttypoll; |
56 57#define CDEV_MAJOR 1 58/* Don't make static, fdesc_vnops uses this. */ 59struct cdevsw ctty_cdevsw = 60 { cttyopen, nullclose, cttyread, cttywrite, /*1*/ 61 cttyioctl, nullstop, nullreset, nodevtotty,/* tty */ | 57 58#define CDEV_MAJOR 1 59/* Don't make static, fdesc_vnops uses this. */ 60struct cdevsw ctty_cdevsw = 61 { cttyopen, nullclose, cttyread, cttywrite, /*1*/ 62 cttyioctl, nullstop, nullreset, nodevtotty,/* tty */ |
62 cttyselect, nommap, NULL, "ctty", NULL, -1 }; | 63 cttypoll, nommap, NULL, "ctty", NULL, -1 }; |
63 64 65#define cttyvp(p) ((p)->p_flag & P_CONTROLT ? (p)->p_session->s_ttyvp : NULL) 66 67/*ARGSUSED*/ 68static int 69cttyopen(dev, flag, mode, p) 70 dev_t dev; --- 84 unchanged lines hidden (view full) --- 155 } else 156 return (EINVAL); 157 } 158 return (VOP_IOCTL(ttyvp, cmd, addr, flag, NOCRED, p)); 159} 160 161/*ARGSUSED*/ 162static int | 64 65 66#define cttyvp(p) ((p)->p_flag & P_CONTROLT ? (p)->p_session->s_ttyvp : NULL) 67 68/*ARGSUSED*/ 69static int 70cttyopen(dev, flag, mode, p) 71 dev_t dev; --- 84 unchanged lines hidden (view full) --- 156 } else 157 return (EINVAL); 158 } 159 return (VOP_IOCTL(ttyvp, cmd, addr, flag, NOCRED, p)); 160} 161 162/*ARGSUSED*/ 163static int |
163cttyselect(dev, flag, p) | 164cttypoll(dev, events, p) |
164 dev_t dev; | 165 dev_t dev; |
165 int flag; | 166 int events; |
166 struct proc *p; 167{ 168 struct vnode *ttyvp = cttyvp(p); 169 170 if (ttyvp == NULL) | 167 struct proc *p; 168{ 169 struct vnode *ttyvp = cttyvp(p); 170 171 if (ttyvp == NULL) |
171 return (1); /* try operation to get EOF/failure */ 172 return (VOP_SELECT(ttyvp, flag, FREAD|FWRITE, NOCRED, p)); | 172 /* try operation to get EOF/failure */ 173 return (seltrue(dev, events, p)); 174 return (VOP_POLL(ttyvp, events, p->p_ucred, p)); |
173} 174 175static ctty_devsw_installed = 0; 176#ifdef DEVFS 177static void *ctty_devfs_token; 178#endif 179 180static void --- 17 unchanged lines hidden --- | 175} 176 177static ctty_devsw_installed = 0; 178#ifdef DEVFS 179static void *ctty_devfs_token; 180#endif 181 182static void --- 17 unchanged lines hidden --- |