]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/ttycom.h
6d036066d0c6ccd6eda6c699ecec260b5562e015
[apple/xnu.git] / bsd / sys / ttycom.h
1 /*
2 * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */
31 /*-
32 * Copyright (c) 1982, 1986, 1990, 1993, 1994
33 * The Regents of the University of California. All rights reserved.
34 * (c) UNIX System Laboratories, Inc.
35 * All or some portions of this file are derived from material licensed
36 * to the University of California by American Telephone and Telegraph
37 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
38 * the permission of UNIX System Laboratories, Inc.
39 *
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
42 * are met:
43 * 1. Redistributions of source code must retain the above copyright
44 * notice, this list of conditions and the following disclaimer.
45 * 2. Redistributions in binary form must reproduce the above copyright
46 * notice, this list of conditions and the following disclaimer in the
47 * documentation and/or other materials provided with the distribution.
48 * 3. All advertising materials mentioning features or use of this software
49 * must display the following acknowledgement:
50 * This product includes software developed by the University of
51 * California, Berkeley and its contributors.
52 * 4. Neither the name of the University nor the names of its contributors
53 * may be used to endorse or promote products derived from this software
54 * without specific prior written permission.
55 *
56 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
57 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
58 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
59 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
60 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
61 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
62 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
64 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
65 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
66 * SUCH DAMAGE.
67 *
68 * @(#)ttycom.h 8.1 (Berkeley) 3/28/94
69 */
70
71 #ifndef _SYS_TTYCOM_H_
72 #define _SYS_TTYCOM_H_
73
74 #include <sys/ioccom.h>
75
76 /*
77 * Tty ioctl's except for those supported only for backwards compatibility
78 * with the old tty driver.
79 */
80
81 /*
82 * Window/terminal size structure. This information is stored by the kernel
83 * in order to provide a consistent interface, but is not used by the kernel.
84 */
85 struct winsize {
86 unsigned short ws_row; /* rows, in characters */
87 unsigned short ws_col; /* columns, in characters */
88 unsigned short ws_xpixel; /* horizontal size, pixels */
89 unsigned short ws_ypixel; /* vertical size, pixels */
90 };
91
92 #define TIOCMODG _IOR('t', 3, int) /* get modem control state */
93 #define TIOCMODS _IOW('t', 4, int) /* set modem control state */
94 #define TIOCM_LE 0001 /* line enable */
95 #define TIOCM_DTR 0002 /* data terminal ready */
96 #define TIOCM_RTS 0004 /* request to send */
97 #define TIOCM_ST 0010 /* secondary transmit */
98 #define TIOCM_SR 0020 /* secondary receive */
99 #define TIOCM_CTS 0040 /* clear to send */
100 #define TIOCM_CAR 0100 /* carrier detect */
101 #define TIOCM_CD TIOCM_CAR
102 #define TIOCM_RNG 0200 /* ring */
103 #define TIOCM_RI TIOCM_RNG
104 #define TIOCM_DSR 0400 /* data set ready */
105 /* 8-10 compat */
106 #define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */
107 #define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */
108 /* 15 unused */
109 #define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */
110 /* 17-18 compat */
111 #define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */
112 #define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */
113 #define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */
114 #define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */
115 #ifdef KERNEL
116 #define TIOCGETA_64 _IOR('t', 19, struct user_termios)
117 #define TIOCSETA_64 _IOW('t', 20, struct user_termios)
118 #define TIOCSETAW_64 _IOW('t', 21, struct user_termios)
119 #define TIOCSETAF_64 _IOW('t', 22, struct user_termios)
120 #endif /* KERNEL */
121 #define TIOCGETD _IOR('t', 26, int) /* get line discipline */
122 #define TIOCSETD _IOW('t', 27, int) /* set line discipline */
123 /* 127-124 compat */
124 #define TIOCSBRK _IO('t', 123) /* set break bit */
125 #define TIOCCBRK _IO('t', 122) /* clear break bit */
126 #define TIOCSDTR _IO('t', 121) /* set data terminal ready */
127 #define TIOCCDTR _IO('t', 120) /* clear data terminal ready */
128 #define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */
129 #define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */
130 /* 117-116 compat */
131 #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
132 #define TIOCSTI _IOW('t', 114, char) /* simulate terminal input */
133 #define TIOCNOTTY _IO('t', 113) /* void tty association */
134 #define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */
135 #define TIOCPKT_DATA 0x00 /* data packet */
136 #define TIOCPKT_FLUSHREAD 0x01 /* flush packet */
137 #define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
138 #define TIOCPKT_STOP 0x04 /* stop output */
139 #define TIOCPKT_START 0x08 /* start output */
140 #define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
141 #define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
142 #define TIOCPKT_IOCTL 0x40 /* state change of pty driver */
143 #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
144 #define TIOCSTART _IO('t', 110) /* start output, like ^Q */
145 #define TIOCMSET _IOW('t', 109, int) /* set all modem bits */
146 #define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */
147 #define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */
148 #define TIOCMGET _IOR('t', 106, int) /* get all modem bits */
149 #define TIOCREMOTE _IOW('t', 105, int) /* remote input editing */
150 #define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */
151 #define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */
152 #define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */
153 #define TIOCSTAT _IO('t', 101) /* simulate ^T status message */
154 #define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */
155 #define TIOCSCONS _IO('t', 99) /* 4.2 compatibility */
156 #define TIOCCONS _IOW('t', 98, int) /* become virtual console */
157 #define TIOCSCTTY _IO('t', 97) /* become controlling tty */
158 #define TIOCEXT _IOW('t', 96, int) /* pty: external processing */
159 #define TIOCSIG _IO('t', 95) /* pty: generate signal */
160 #define TIOCDRAIN _IO('t', 94) /* wait till output drained */
161 #define TIOCMSDTRWAIT _IOW('t', 91, int) /* modem: set wait on close */
162 #define TIOCMGDTRWAIT _IOR('t', 90, int) /* modem: get wait on close */
163 #define TIOCTIMESTAMP _IOR('t', 89, struct timeval) /* enable/get timestamp
164 * of last input event */
165 #define TIOCDCDTIMESTAMP _IOR('t', 88, struct timeval) /* enable/get timestamp
166 * of last DCd rise */
167 #define TIOCSDRAINWAIT _IOW('t', 87, int) /* set ttywait timeout */
168 #define TIOCGDRAINWAIT _IOR('t', 86, int) /* get ttywait timeout */
169 #define TIOCDSIMICROCODE _IO('t', 85) /* download microcode to
170 * DSI Softmodem */
171
172 #define TTYDISC 0 /* termios tty line discipline */
173 #define TABLDISC 3 /* tablet discipline */
174 #define SLIPDISC 4 /* serial IP discipline */
175 #define PPPDISC 5 /* PPP discipline */
176
177 #endif /* !_SYS_TTYCOM_H_ */