1: /* 2: * Copyright (c) 1982, 1986 Regents of the University of California. 3: * All rights reserved. The Berkeley software License Agreement 4: * specifies the terms and conditions for redistribution. 5: * 6: * @(#)tty_tty.c 7.1 (Berkeley) 6/5/86 7: */ 8: 9: /* 10: * Indirect driver for controlling tty. 11: * 12: * THIS IS GARBAGE: MUST SOON BE DONE WITH struct inode * IN PROC TABLE. 13: */ 14: #include "param.h" 15: #include "systm.h" 16: #include "conf.h" 17: #include "dir.h" 18: #include "user.h" 19: #include "ioctl.h" 20: #include "tty.h" 21: #include "proc.h" 22: #include "uio.h" 23: 24: /*ARGSUSED*/ 25: syopen(dev, flag) 26: dev_t dev; 27: int flag; 28: { 29: 30: if (u.u_ttyp == NULL) 31: return (ENXIO); 32: return ((*cdevsw[major(u.u_ttyd)].d_open)(u.u_ttyd, flag)); 33: } 34: 35: /*ARGSUSED*/ 36: syread(dev, uio) 37: dev_t dev; 38: struct uio *uio; 39: { 40: 41: if (u.u_ttyp == NULL) 42: return (ENXIO); 43: return ((*cdevsw[major(u.u_ttyd)].d_read)(u.u_ttyd, uio)); 44: } 45: 46: /*ARGSUSED*/ 47: sywrite(dev, uio) 48: dev_t dev; 49: struct uio *uio; 50: { 51: 52: if (u.u_ttyp == NULL) 53: return (ENXIO); 54: return ((*cdevsw[major(u.u_ttyd)].d_write)(u.u_ttyd, uio)); 55: } 56: 57: /*ARGSUSED*/ 58: syioctl(dev, cmd, addr, flag) 59: dev_t dev; 60: int cmd; 61: caddr_t addr; 62: int flag; 63: { 64: 65: if (cmd == TIOCNOTTY) { 66: u.u_ttyp = 0; 67: u.u_ttyd = 0; 68: u.u_procp->p_pgrp = 0; 69: return (0); 70: } 71: if (u.u_ttyp == NULL) 72: return (ENXIO); 73: return ((*cdevsw[major(u.u_ttyd)].d_ioctl)(u.u_ttyd, cmd, addr, flag)); 74: } 75: 76: /*ARGSUSED*/ 77: syselect(dev, flag) 78: dev_t dev; 79: int flag; 80: { 81: 82: if (u.u_ttyp == NULL) { 83: u.u_error = ENXIO; 84: return (0); 85: } 86: return ((*cdevsw[major(u.u_ttyd)].d_select)(u.u_ttyd, flag)); 87: }