Home | History | Annotate | Line # | Download | only in kern
tty_conf.c revision 1.1.1.2
      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  *	@(#)tty_conf.c	8.4 (Berkeley) 1/21/94
     39  */
     40 
     41 #include <sys/param.h>
     42 #include <sys/systm.h>
     43 #include <sys/buf.h>
     44 #include <sys/ioctl.h>
     45 #include <sys/proc.h>
     46 #include <sys/tty.h>
     47 #include <sys/conf.h>
     48 
     49 #define	ttynodisc ((int (*) __P((dev_t, struct tty *)))enodev)
     50 #define	ttyerrclose ((int (*) __P((struct tty *, int flags)))enodev)
     51 #define	ttyerrio ((int (*) __P((struct tty *, struct uio *, int)))enodev)
     52 #define	ttyerrinput ((int (*) __P((int c, struct tty *)))enodev)
     53 #define	ttyerrstart ((int (*) __P((struct tty *)))enodev)
     54 
     55 int	nullioctl __P((struct tty *tp, int cmd, caddr_t data,
     56 			int flag, struct proc *p));
     57 
     58 #include "tb.h"
     59 #if NTB > 0
     60 int	tbopen __P((dev_t dev, struct tty *tp));
     61 int	tbclose __P((struct tty *tp, int flags));
     62 int	tbread __P((struct tty *, struct uio *, int flags));
     63 int	tbioctl __P((struct tty *tp, int cmd, caddr_t data,
     64 			int flag, struct proc *p));
     65 int	tbinput __P((int c, struct tty *tp));
     66 #endif
     67 
     68 #include "sl.h"
     69 #if NSL > 0
     70 int	slopen __P((dev_t dev, struct tty *tp));
     71 int	slclose __P((struct tty *tp, int flags));
     72 int	sltioctl __P((struct tty *tp, int cmd, caddr_t data,
     73 			int flag, struct proc *p));
     74 int	slinput __P((int c, struct tty *tp));
     75 int	slstart __P((struct tty *tp));
     76 #endif
     77 
     78 
     79 struct	linesw linesw[] =
     80 {
     81 	{ ttyopen, ttylclose, ttread, ttwrite, nullioctl,
     82 	  ttyinput, ttstart, ttymodem },		/* 0- termios */
     83 
     84 	{ ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
     85 	  ttyerrinput, ttyerrstart, nullmodem },	/* 1- defunct */
     86 
     87 	{ ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
     88 	  ttyerrinput, ttyerrstart, nullmodem },	/* 2- defunct */
     89 
     90 #if NTB > 0
     91 	{ tbopen, tbclose, tbread, enodev, tbioctl,
     92 	  tbinput, ttstart, nullmodem },		/* 3- TABLDISC */
     93 #else
     94 	{ ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
     95 	  ttyerrinput, ttyerrstart, nullmodem },
     96 #endif
     97 
     98 #if NSL > 0
     99 	{ slopen, slclose, ttyerrio, ttyerrio, sltioctl,
    100 	  slinput, slstart, nullmodem },		/* 4- SLIPDISC */
    101 #else
    102 	{ ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
    103 	  ttyerrinput, ttyerrstart, nullmodem },
    104 #endif
    105 };
    106 
    107 int	nlinesw = sizeof (linesw) / sizeof (linesw[0]);
    108 
    109 /*
    110  * Do nothing specific version of line
    111  * discipline specific ioctl command.
    112  */
    113 /*ARGSUSED*/
    114 nullioctl(tp, cmd, data, flags, p)
    115 	struct tty *tp;
    116 	int cmd;
    117 	char *data;
    118 	int flags;
    119 	struct proc *p;
    120 {
    121 
    122 #ifdef lint
    123 	tp = tp; data = data; flags = flags; p = p;
    124 #endif
    125 	return (-1);
    126 }
    127