xref: /illumos-gate/usr/src/uts/common/sys/ttcompat.h (revision 67e157eca677c3d1b1c5d1049d9fc53c2e05033c)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
27 /*	  All Rights Reserved  	*/
28 
29 #ifndef	_SYS_TTCOMPAT_H
30 #define	_SYS_TTCOMPAT_H
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * BSD/XENIX/V7 ttcompat module header file
38  */
39 
40 /*
41  * Old-style terminal state.
42  */
43 typedef struct {
44 	int	t_flags;		/* flags */
45 	char	t_ispeed, t_ospeed;	/* speeds */
46 	char	t_erase;		/* erase last character */
47 	char	t_kill;			/* erase entire line */
48 	char	t_intrc;		/* interrupt */
49 	char	t_quitc;		/* quit */
50 	char	t_startc;		/* start output */
51 	char	t_stopc;		/* stop output */
52 	char	t_eofc;			/* end-of-file */
53 	char	t_brkc;			/* input delimiter (like nl) */
54 	char	t_suspc;		/* stop process signal */
55 	char	t_dsuspc;		/* delayed stop process signal */
56 	char	t_rprntc;		/* reprint line */
57 	char	t_flushc;		/* flush output (toggles) */
58 	char	t_werasc;		/* word erase */
59 	char	t_lnextc;		/* literal next character */
60 	int	t_xflags;		/* XXX extended flags */
61 } compat_state_t;
62 
63 /*
64  * Per-tty structure.
65  */
66 typedef struct {
67 	mblk_t	*t_iocpending;		/* ioctl pending successful */
68 					/* allocation */
69 	compat_state_t t_curstate;	/* current emulated state */
70 	struct sgttyb t_new_sgttyb;	/* new sgttyb from TIOCSET[PN] */
71 	struct tchars t_new_tchars;	/* new tchars from TIOCSETC */
72 	struct ltchars t_new_ltchars;	/* new ltchars from TIOCSLTC */
73 	int	t_new_lflags;		/* new lflags from TIOCLSET/LBIS/LBIC */
74 	int	t_state;		/* state bits */
75 	int	t_iocid;		/* ID of "ioctl" we handle specially */
76 	int	t_ioccmd;		/* ioctl code for that "ioctl" */
77 	bufcall_id_t t_bufcallid;	/* ID from qbufcall */
78 	intptr_t t_arg;			/* third argument to ioctl */
79 } ttcompat_state_t;
80 
81 
82 #define	TS_FREE	 0x00	/* not in use */
83 #define	TS_INUSE 0x01	/* allocated */
84 #define	TS_W_IN	 0x02	/* waiting for an M_IOCDATA response to an */
85 			/* M_COPYIN request */
86 #define	TS_W_OUT 0x04	/* waiting for an M_IOCDATA response to an */
87 			/* M_COPYOUT request */
88 #define	TS_IOCWAIT 0x08	/* waiting for an M_IOCACK/M_IOCNAK from downstream */
89 #define	TS_TIOCNAK 0x10	/* received a NAK in response to a ttcompat message */
90 
91 #ifdef	__cplusplus
92 }
93 #endif
94 
95 #endif	/* _SYS_TTCOMPAT_H */
96