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