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_conf.c 1.2 (2.11BSD GTE) 11/30/94 7: */ 8: 9: #include "param.h" 10: #include "../pdp/seg.h" 11: 12: #include "file.h" 13: #include "ioctl.h" 14: #include "tty.h" 15: #include "errno.h" 16: #include "conf.h" 17: 18: int nodev(); 19: int nulldev(); 20: 21: int ttyopen(),ttylclose(),ttread(),ttwrite(),nullioctl(),ttstart(); 22: int ttymodem(), nullmodem(), ttyinput(); 23: 24: /* #include "bk.h" */ 25: #if NBK > 0 26: int bkopen(),bkclose(),bkread(),bkinput(),bkioctl(); 27: #endif 28: 29: /* #include "tb.h" */ 30: #if NTB > 0 31: int tbopen(),tbclose(),tbread(),tbinput(),tbioctl(); 32: #endif 33: #include "sl.h" 34: #if NSL > 0 35: int SLOPEN(),SLCLOSE(),SLINPUT(),SLTIOCTL(),SLSTART(); 36: #endif 37: 38: 39: struct linesw linesw[] = 40: { 41: ttyopen, ttylclose, ttread, ttwrite, nullioctl, /* 0- OTTYDISC */ 42: ttyinput, nodev, nulldev, ttstart, ttymodem, 43: #if NBK > 0 44: bkopen, bkclose, bkread, ttwrite, bkioctl, /* 1- NETLDISC */ 45: bkinput, nodev, nulldev, ttstart, nullmodem, 46: #else 47: nodev, nodev, nodev, nodev, nodev, 48: nodev, nodev, nodev, nodev, nodev, 49: #endif 50: ttyopen, ttylclose, ttread, ttwrite, nullioctl, /* 2- NTTYDISC */ 51: ttyinput, nodev, nulldev, ttstart, ttymodem, 52: #if NTB > 0 53: tbopen, tbclose, tbread, nodev, tbioctl, 54: tbinput, nodev, nulldev, ttstart, nullmodem, /* 3- TABLDISC */ 55: #else 56: nodev, nodev, nodev, nodev, nodev, 57: nodev, nodev, nodev, nodev, nodev, 58: #endif 59: #if NSL > 0 60: SLOPEN, SLCLOSE, nodev, nodev, SLTIOCTL, 61: SLINPUT, nodev, nulldev, SLSTART, nulldev, /* 4- SLIPDISC */ 62: #else 63: nodev, nodev, nodev, nodev, nodev, 64: nodev, nodev, nodev, nodev, nodev, 65: #endif 66: }; 67: 68: int nldisp = sizeof (linesw) / sizeof (linesw[0]); 69: 70: /* 71: * Do nothing specific version of line 72: * discipline specific ioctl command. 73: */ 74: /*ARGSUSED*/ 75: nullioctl(tp, cmd, data, flags) 76: struct tty *tp; 77: u_int cmd; 78: char *data; 79: int flags; 80: { 81: 82: #ifdef lint 83: tp = tp; data = data; flags = flags; 84: #endif 85: return (-1); 86: } 87: 88: #if NSL > 0 89: SLOPEN(dev, tp) 90: dev_t dev; 91: struct tty *tp; 92: { 93: int error, slopen(); 94: 95: if (!suser()) 96: return (EPERM); 97: if (tp->t_line == SLIPDISC) 98: return (EBUSY); 99: error = KScall(slopen, sizeof(dev_t) + sizeof(struct tty *), dev, tp); 100: if (!error) 101: ttyflush(tp, FREAD | FWRITE); 102: return(error); 103: } 104: 105: SLCLOSE(tp, flag) 106: struct tty *tp; 107: int flag; 108: { 109: int slclose(); 110: 111: ttywflush(tp); 112: tp->t_line = 0; 113: KScall(slclose, sizeof(struct tty *), tp); 114: } 115: 116: SLTIOCTL(tp, cmd, data, flag) 117: struct tty *tp; 118: int cmd, flag; 119: caddr_t data; 120: { 121: int sltioctl(); 122: 123: return(KScall(sltioctl, sizeof(struct tty *) + sizeof(int) + 124: sizeof(caddr_t) + sizeof(int), tp, cmd, data, flag)); 125: } 126: 127: SLSTART(tp) 128: struct tty *tp; 129: { 130: mapinfo map; 131: void slstart(); 132: 133: savemap(map); 134: KScall(slstart, sizeof(struct tty *), tp); 135: restormap(map); 136: } 137: 138: SLINPUT(c, tp) 139: int c; 140: struct tty *tp; 141: { 142: mapinfo map; 143: void slinput(); 144: 145: savemap(map); 146: KScall(slinput, sizeof(int) + sizeof(struct tty *), c, tp); 147: restormap(map); 148: } 149: #endif