1: /* 2: * Copyright (c) 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 1.2 (2.11BSD GTE) 11/29/94 7: */ 8: 9: /* 10: * Indirect driver for controlling tty. 11: * 12: */ 13: #include "param.h" 14: #include "user.h" 15: #include "proc.h" 16: #include "ioctl.h" 17: #include "tty.h" 18: #include "conf.h" 19: 20: /*ARGSUSED*/ 21: syopen(dev, flag) 22: dev_t dev; 23: int flag; 24: { 25: if (u.u_ttyp == NULL) 26: return (ENXIO); 27: return((*cdevsw[major(u.u_ttyd)].d_open)(u.u_ttyd, flag)); 28: } 29: 30: /*ARGSUSED*/ 31: syread(dev, uio, flag) 32: dev_t dev; 33: struct uio *uio; 34: int flag; 35: { 36: if (u.u_ttyp == NULL) 37: return (ENXIO); 38: return ((*cdevsw[major(u.u_ttyd)].d_read)(u.u_ttyd, uio, flag)); 39: } 40: 41: /*ARGSUSED*/ 42: sywrite(dev, uio, flag) 43: dev_t dev; 44: struct uio *uio; 45: { 46: if (u.u_ttyp == NULL) 47: return (ENXIO); 48: return ((*cdevsw[major(u.u_ttyd)].d_write)(u.u_ttyd, uio, flag)); 49: } 50: 51: /*ARGSUSED*/ 52: syioctl(dev, cmd, addr, flag) 53: dev_t dev; 54: u_int cmd; 55: caddr_t addr; 56: int flag; 57: { 58: if (cmd == TIOCNOTTY) { 59: u.u_ttyp = 0; 60: u.u_ttyd = 0; 61: u.u_procp->p_pgrp = 0; 62: return (0); 63: } 64: if (u.u_ttyp == NULL) 65: return (ENXIO); 66: return ((*cdevsw[major(u.u_ttyd)].d_ioctl)(u.u_ttyd, cmd, addr, flag)); 67: } 68: 69: /*ARGSUSED*/ 70: syselect(dev, flag) 71: dev_t dev; 72: int flag; 73: { 74: 75: if (u.u_ttyp == NULL) { 76: u.u_error = ENXIO; 77: return (0); 78: } 79: return ((*cdevsw[major(u.u_ttyd)].d_select)(u.u_ttyd, flag)); 80: }