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