tty_conf.c revision 1.13 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.13 1994/06/20 00:32:31 paulus 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 int pppinput __P((int c, struct tty *tp));
86 int 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 #ifdef COMPAT_43
100 { ttyopen, ttylclose, ttread, ttwrite, nullioctl,
101 ttyinput, ttstart, ttymodem }, /* 2- old NTTYDISC */
102 #else
103 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
104 ttyerrinput, ttyerrstart, nullmodem }, /* 2- defunct */
105 #endif
106
107 #if NTB > 0
108 { tbopen, tbclose, tbread, ttyerrio, tbtioctl,
109 tbinput, ttstart, nullmodem }, /* 3- TABLDISC */
110 #else
111 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
112 ttyerrinput, ttyerrstart, nullmodem },
113 #endif
114
115 #if NSL > 0
116 { slopen, slclose, ttyerrio, ttyerrio, sltioctl,
117 slinput, slstart, nullmodem }, /* 4- SLIPDISC */
118 #else
119 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
120 ttyerrinput, ttyerrstart, nullmodem },
121 #endif
122
123 #if NPPP > 0
124 { pppopen, pppclose, pppread, pppwrite, ppptioctl,
125 pppinput, pppstart, ttymodem }, /* 5- PPPDISC */
126 #else
127 { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
128 ttyerrinput, ttyerrstart, nullmodem },
129 #endif
130 };
131
132 int nlinesw = sizeof (linesw) / sizeof (linesw[0]);
133
134 /*
135 * Do nothing specific version of line
136 * discipline specific ioctl command.
137 */
138 /*ARGSUSED*/
139 nullioctl(tp, cmd, data, flags, p)
140 struct tty *tp;
141 int cmd;
142 char *data;
143 int flags;
144 struct proc *p;
145 {
146
147 #ifdef lint
148 tp = tp; data = data; flags = flags; p = p;
149 #endif
150 return (-1);
151 }
152