1: /* 2: * SCCS id @(#)sys.c 2.1 (Berkeley) 8/5/83 3: */ 4: 5: /* 6: * indirect driver for controlling tty. 7: */ 8: #include "param.h" 9: #include <sys/conf.h> 10: #include <sys/dir.h> 11: #include <sys/user.h> 12: #include <sys/tty.h> 13: #include <sys/proc.h> 14: 15: 16: syopen(dev, flag) 17: dev_t dev; 18: { 19: if(u.u_ttyp == NULL) { 20: u.u_error = ENXIO; 21: return; 22: } 23: (*cdevsw[major(u.u_ttyd)].d_open)(u.u_ttyd, flag); 24: } 25: 26: syread(dev) 27: dev_t dev; 28: { 29: #ifdef UCB_NET 30: if (u.u_ttyp == NULL) { 31: u.u_error = ENXIO; 32: return; 33: } 34: #endif 35: (*cdevsw[major(u.u_ttyd)].d_read)(u.u_ttyd); 36: } 37: 38: sywrite(dev) 39: dev_t dev; 40: { 41: #ifdef UCB_NET 42: if (u.u_ttyp == NULL) { 43: u.u_error = ENXIO; 44: return; 45: } 46: #endif 47: (*cdevsw[major(u.u_ttyd)].d_write)(u.u_ttyd); 48: } 49: 50: sysioctl(dev, cmd, addr, flag) 51: dev_t dev; 52: caddr_t addr; 53: { 54: #ifdef UCB_NET 55: if (cmd == TIOCNOTTY) { 56: u.u_ttyp = 0; 57: u.u_ttyd = 0; 58: u.u_procp->p_pgrp = 0; 59: return; 60: } 61: if (u.u_ttyp == NULL) { 62: u.u_error = ENXIO; 63: return; 64: } 65: #endif 66: (*cdevsw[major(u.u_ttyd)].d_ioctl)(u.u_ttyd, cmd, addr, flag); 67: } 68: 69: #ifdef UCB_NET 70: syselect(dev, flag) 71: { 72: if (u.u_ttyp == NULL) { 73: u.u_error = ENXIO; 74: return (0); 75: } 76: return ((*cdevsw[major(u.u_ttyd)].d_select)(u.u_ttyd, flag)); 77: } 78: #endif