1 /*- 2 * Copyright (c) 1982, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the University of 21 * California, Berkeley and its contributors. 22 * 4. Neither the name of the University nor the names of its contributors 23 * may be used to endorse or promote products derived from this software 24 * without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * from: @(#)tty_conf.c 8.4 (Berkeley) 1/21/94 39 * $Id: tty_conf.c,v 1.11 1994/05/12 03:43:00 cgd Exp $ 40 */ 41 42 #include <sys/param.h> 43 #include <sys/systm.h> 44 #include <sys/buf.h> 45 #include <sys/ioctl.h> 46 #include <sys/proc.h> 47 #include <sys/tty.h> 48 #include <sys/conf.h> 49 50 #define ttynodisc ((int (*) __P((dev_t, struct tty *)))enodev) 51 #define ttyerrclose ((int (*) __P((struct tty *, int flags)))enodev) 52 #define ttyerrio ((int (*) __P((struct tty *, struct uio *, int)))enodev) 53 #define ttyerrinput ((int (*) __P((int c, struct tty *)))enodev) 54 #define ttyerrstart ((int (*) __P((struct tty *)))enodev) 55 56 int nullioctl __P((struct tty *tp, int cmd, caddr_t data, 57 int flag, struct proc *p)); 58 59 #include "tb.h" 60 #if NTB > 0 61 int tbopen __P((dev_t dev, struct tty *tp)); 62 int tbclose __P((struct tty *tp, int flags)); 63 int tbread __P((struct tty *tp, struct uio *uio, int flags)); 64 int tbtioctl __P((struct tty *tp, int cmd, caddr_t data, 65 int flag, struct proc *p)); 66 int tbinput __P((int c, struct tty *tp)); 67 #endif 68 69 #include "sl.h" 70 #if NSL > 0 71 int slopen __P((dev_t dev, struct tty *tp)); 72 int slclose __P((struct tty *tp, int flags)); 73 int sltioctl __P((struct tty *tp, int cmd, caddr_t data, 74 int flag, struct proc *p)); 75 int slinput __P((int c, struct tty *tp)); 76 int slstart __P((struct tty *tp)); 77 #endif 78 79 #include "ppp.h" 80 #if NPPP > 0 81 int pppopen __P((dev_t dev, struct tty *tp)); 82 int pppclose __P((struct tty *tp, int flags)); 83 int ppptioctl __P((struct tty *tp, int cmd, caddr_t data, 84 int flag, struct proc *p)); 85 void pppinput __P((int c, struct tty *tp)); 86 void pppstart __P((struct tty *tp)); 87 int pppread __P((struct tty *tp, struct uio *uio, int flag)); 88 int pppwrite __P((struct tty *tp, struct uio *uio, int flag)); 89 #endif 90 91 struct linesw linesw[] = 92 { 93 { ttyopen, ttylclose, ttread, ttwrite, nullioctl, 94 ttyinput, ttstart, ttymodem }, /* 0- termios */ 95 96 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl, 97 ttyerrinput, ttyerrstart, nullmodem }, /* 1- defunct */ 98 99 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl, 100 ttyerrinput, ttyerrstart, nullmodem }, /* 2- defunct */ 101 102 #if NTB > 0 103 { tbopen, tbclose, tbread, ttyerrio, tbtioctl, 104 tbinput, ttstart, nullmodem }, /* 3- TABLDISC */ 105 #else 106 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl, 107 ttyerrinput, ttyerrstart, nullmodem }, 108 #endif 109 110 #if NSL > 0 111 { slopen, slclose, ttyerrio, ttyerrio, sltioctl, 112 slinput, slstart, nullmodem }, /* 4- SLIPDISC */ 113 #else 114 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl, 115 ttyerrinput, ttyerrstart, nullmodem }, 116 #endif 117 118 #if NPPP > 0 119 { pppopen, pppclose, pppread, pppwrite, ppptioctl, 120 pppinput, pppstart, ttymodem }, /* 5- PPPDISC */ 121 #else 122 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl, 123 ttyerrinput, ttyerrstart, nullmodem }, 124 #endif 125 }; 126 127 int nlinesw = sizeof (linesw) / sizeof (linesw[0]); 128 129 /* 130 * Do nothing specific version of line 131 * discipline specific ioctl command. 132 */ 133 /*ARGSUSED*/ 134 nullioctl(tp, cmd, data, flags, p) 135 struct tty *tp; 136 int cmd; 137 char *data; 138 int flags; 139 struct proc *p; 140 { 141 142 #ifdef lint 143 tp = tp; data = data; flags = flags; p = p; 144 #endif 145 return (-1); 146 } 147