xref: /xnu-11417.140.69/bsd/sys/termios.h (revision 43a90889846e00bfb5cf1d255cdc0a701a1e05a4)
1*43a90889SApple OSS Distributions /*
2*43a90889SApple OSS Distributions  * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3*43a90889SApple OSS Distributions  *
4*43a90889SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*43a90889SApple OSS Distributions  *
6*43a90889SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*43a90889SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*43a90889SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*43a90889SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*43a90889SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*43a90889SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*43a90889SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*43a90889SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*43a90889SApple OSS Distributions  *
15*43a90889SApple OSS Distributions  * Please obtain a copy of the License at
16*43a90889SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*43a90889SApple OSS Distributions  *
18*43a90889SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*43a90889SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*43a90889SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*43a90889SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*43a90889SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*43a90889SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*43a90889SApple OSS Distributions  * limitations under the License.
25*43a90889SApple OSS Distributions  *
26*43a90889SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*43a90889SApple OSS Distributions  */
28*43a90889SApple OSS Distributions /* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */
29*43a90889SApple OSS Distributions /*
30*43a90889SApple OSS Distributions  * Copyright (c) 1988, 1989, 1993, 1994
31*43a90889SApple OSS Distributions  *	The Regents of the University of California.  All rights reserved.
32*43a90889SApple OSS Distributions  *
33*43a90889SApple OSS Distributions  * Redistribution and use in source and binary forms, with or without
34*43a90889SApple OSS Distributions  * modification, are permitted provided that the following conditions
35*43a90889SApple OSS Distributions  * are met:
36*43a90889SApple OSS Distributions  * 1. Redistributions of source code must retain the above copyright
37*43a90889SApple OSS Distributions  *    notice, this list of conditions and the following disclaimer.
38*43a90889SApple OSS Distributions  * 2. Redistributions in binary form must reproduce the above copyright
39*43a90889SApple OSS Distributions  *    notice, this list of conditions and the following disclaimer in the
40*43a90889SApple OSS Distributions  *    documentation and/or other materials provided with the distribution.
41*43a90889SApple OSS Distributions  * 3. All advertising materials mentioning features or use of this software
42*43a90889SApple OSS Distributions  *    must display the following acknowledgement:
43*43a90889SApple OSS Distributions  *      This product includes software developed by the University of
44*43a90889SApple OSS Distributions  *      California, Berkeley and its contributors.
45*43a90889SApple OSS Distributions  * 4. Neither the name of the University nor the names of its contributors
46*43a90889SApple OSS Distributions  *    may be used to endorse or promote products derived from this software
47*43a90889SApple OSS Distributions  *    without specific prior written permission.
48*43a90889SApple OSS Distributions  *
49*43a90889SApple OSS Distributions  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50*43a90889SApple OSS Distributions  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51*43a90889SApple OSS Distributions  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52*43a90889SApple OSS Distributions  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53*43a90889SApple OSS Distributions  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54*43a90889SApple OSS Distributions  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55*43a90889SApple OSS Distributions  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56*43a90889SApple OSS Distributions  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57*43a90889SApple OSS Distributions  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58*43a90889SApple OSS Distributions  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59*43a90889SApple OSS Distributions  * SUCH DAMAGE.
60*43a90889SApple OSS Distributions  *
61*43a90889SApple OSS Distributions  *	@(#)termios.h	8.3 (Berkeley) 3/28/94
62*43a90889SApple OSS Distributions  */
63*43a90889SApple OSS Distributions 
64*43a90889SApple OSS Distributions #ifndef _SYS_TERMIOS_H_
65*43a90889SApple OSS Distributions #define _SYS_TERMIOS_H_
66*43a90889SApple OSS Distributions 
67*43a90889SApple OSS Distributions #include <sys/cdefs.h>
68*43a90889SApple OSS Distributions 
69*43a90889SApple OSS Distributions /*
70*43a90889SApple OSS Distributions  * Special Control Characters
71*43a90889SApple OSS Distributions  *
72*43a90889SApple OSS Distributions  * Index into c_cc[] character array.
73*43a90889SApple OSS Distributions  *
74*43a90889SApple OSS Distributions  *	Name	     Subscript	Enabled by
75*43a90889SApple OSS Distributions  */
76*43a90889SApple OSS Distributions #define VEOF            0       /* ICANON */
77*43a90889SApple OSS Distributions #define VEOL            1       /* ICANON */
78*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
79*43a90889SApple OSS Distributions #define VEOL2           2       /* ICANON together with IEXTEN */
80*43a90889SApple OSS Distributions #endif
81*43a90889SApple OSS Distributions #define VERASE          3       /* ICANON */
82*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
83*43a90889SApple OSS Distributions #define VWERASE         4       /* ICANON together with IEXTEN */
84*43a90889SApple OSS Distributions #endif
85*43a90889SApple OSS Distributions #define VKILL           5       /* ICANON */
86*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
87*43a90889SApple OSS Distributions #define VREPRINT        6       /* ICANON together with IEXTEN */
88*43a90889SApple OSS Distributions #endif
89*43a90889SApple OSS Distributions /*			7	   spare 1 */
90*43a90889SApple OSS Distributions #define VINTR           8       /* ISIG */
91*43a90889SApple OSS Distributions #define VQUIT           9       /* ISIG */
92*43a90889SApple OSS Distributions #define VSUSP           10      /* ISIG */
93*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
94*43a90889SApple OSS Distributions #define VDSUSP          11      /* ISIG together with IEXTEN */
95*43a90889SApple OSS Distributions #endif
96*43a90889SApple OSS Distributions #define VSTART          12      /* IXON, IXOFF */
97*43a90889SApple OSS Distributions #define VSTOP           13      /* IXON, IXOFF */
98*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
99*43a90889SApple OSS Distributions #define VLNEXT          14      /* IEXTEN */
100*43a90889SApple OSS Distributions #define VDISCARD        15      /* IEXTEN */
101*43a90889SApple OSS Distributions #endif
102*43a90889SApple OSS Distributions #define VMIN            16      /* !ICANON */
103*43a90889SApple OSS Distributions #define VTIME           17      /* !ICANON */
104*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
105*43a90889SApple OSS Distributions #define VSTATUS         18      /* ICANON together with IEXTEN */
106*43a90889SApple OSS Distributions /*			19	   spare 2 */
107*43a90889SApple OSS Distributions #endif
108*43a90889SApple OSS Distributions #define NCCS            20
109*43a90889SApple OSS Distributions 
110*43a90889SApple OSS Distributions #include <sys/_types/_posix_vdisable.h>
111*43a90889SApple OSS Distributions 
112*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
113*43a90889SApple OSS Distributions #define CCEQ(val, c)    ((c) == (val) ? (val) != _POSIX_VDISABLE : 0)
114*43a90889SApple OSS Distributions #endif
115*43a90889SApple OSS Distributions 
116*43a90889SApple OSS Distributions /*
117*43a90889SApple OSS Distributions  * Input flags - software input processing
118*43a90889SApple OSS Distributions  */
119*43a90889SApple OSS Distributions #define IGNBRK          0x00000001      /* ignore BREAK condition */
120*43a90889SApple OSS Distributions #define BRKINT          0x00000002      /* map BREAK to SIGINTR */
121*43a90889SApple OSS Distributions #define IGNPAR          0x00000004      /* ignore (discard) parity errors */
122*43a90889SApple OSS Distributions #define PARMRK          0x00000008      /* mark parity and framing errors */
123*43a90889SApple OSS Distributions #define INPCK           0x00000010      /* enable checking of parity errors */
124*43a90889SApple OSS Distributions #define ISTRIP          0x00000020      /* strip 8th bit off chars */
125*43a90889SApple OSS Distributions #define INLCR           0x00000040      /* map NL into CR */
126*43a90889SApple OSS Distributions #define IGNCR           0x00000080      /* ignore CR */
127*43a90889SApple OSS Distributions #define ICRNL           0x00000100      /* map CR to NL (ala CRMOD) */
128*43a90889SApple OSS Distributions #define IXON            0x00000200      /* enable output flow control */
129*43a90889SApple OSS Distributions #define IXOFF           0x00000400      /* enable input flow control */
130*43a90889SApple OSS Distributions #define IXANY           0x00000800      /* any char will restart after stop */
131*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
132*43a90889SApple OSS Distributions #define IMAXBEL         0x00002000      /* ring bell on input queue full */
133*43a90889SApple OSS Distributions #define IUTF8           0x00004000      /* maintain state for UTF-8 VERASE */
134*43a90889SApple OSS Distributions #endif  /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
135*43a90889SApple OSS Distributions 
136*43a90889SApple OSS Distributions /*
137*43a90889SApple OSS Distributions  * Output flags - software output processing
138*43a90889SApple OSS Distributions  */
139*43a90889SApple OSS Distributions #define OPOST           0x00000001      /* enable following output processing */
140*43a90889SApple OSS Distributions #define ONLCR           0x00000002      /* map NL to CR-NL (ala CRMOD) */
141*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
142*43a90889SApple OSS Distributions #define OXTABS          0x00000004      /* expand tabs to spaces */
143*43a90889SApple OSS Distributions #define ONOEOT          0x00000008      /* discard EOT's (^D) on output) */
144*43a90889SApple OSS Distributions #endif  /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
145*43a90889SApple OSS Distributions /*
146*43a90889SApple OSS Distributions  * The following block of features is unimplemented.  Use of these flags in
147*43a90889SApple OSS Distributions  * programs will currently result in unexpected behaviour.
148*43a90889SApple OSS Distributions  *
149*43a90889SApple OSS Distributions  * - Begin unimplemented features
150*43a90889SApple OSS Distributions  */
151*43a90889SApple OSS Distributions #define OCRNL           0x00000010      /* map CR to NL on output */
152*43a90889SApple OSS Distributions #define ONOCR           0x00000020      /* no CR output at column 0 */
153*43a90889SApple OSS Distributions #define ONLRET          0x00000040      /* NL performs CR function */
154*43a90889SApple OSS Distributions #define OFILL           0x00000080      /* use fill characters for delay */
155*43a90889SApple OSS Distributions #define NLDLY           0x00000300      /* \n delay */
156*43a90889SApple OSS Distributions #define TABDLY          0x00000c04      /* horizontal tab delay */
157*43a90889SApple OSS Distributions #define CRDLY           0x00003000      /* \r delay */
158*43a90889SApple OSS Distributions #define FFDLY           0x00004000      /* form feed delay */
159*43a90889SApple OSS Distributions #define BSDLY           0x00008000      /* \b delay */
160*43a90889SApple OSS Distributions #define VTDLY           0x00010000      /* vertical tab delay */
161*43a90889SApple OSS Distributions #define OFDEL           0x00020000      /* fill is DEL, else NUL */
162*43a90889SApple OSS Distributions #if !defined(_SYS_IOCTL_COMPAT_H_) || __DARWIN_UNIX03
163*43a90889SApple OSS Distributions /*
164*43a90889SApple OSS Distributions  * These manifest constants have the same names as those in the header
165*43a90889SApple OSS Distributions  * <sys/ioctl_compat.h>, so you are not permitted to have both definitions
166*43a90889SApple OSS Distributions  * in scope simultaneously in the same compilation unit.  Nevertheless,
167*43a90889SApple OSS Distributions  * they are required to be in scope when _POSIX_C_SOURCE is requested;
168*43a90889SApple OSS Distributions  * this means that including the <sys/ioctl_compat.h> header before this
169*43a90889SApple OSS Distributions  * one when _POSIX_C_SOURCE is in scope will result in redefintions.  We
170*43a90889SApple OSS Distributions  * attempt to maintain these as the same values so as to avoid this being
171*43a90889SApple OSS Distributions  * an outright error in most compilers.
172*43a90889SApple OSS Distributions  */
173*43a90889SApple OSS Distributions #define         NL0     0x00000000
174*43a90889SApple OSS Distributions #define         NL1     0x00000100
175*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
176*43a90889SApple OSS Distributions #define         NL2     0x00000200
177*43a90889SApple OSS Distributions #define         NL3     0x00000300
178*43a90889SApple OSS Distributions #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
179*43a90889SApple OSS Distributions #define         TAB0    0x00000000
180*43a90889SApple OSS Distributions #define         TAB1    0x00000400
181*43a90889SApple OSS Distributions #define         TAB2    0x00000800
182*43a90889SApple OSS Distributions /* not in sys/ioctl_compat.h, use OXTABS value */
183*43a90889SApple OSS Distributions #define         TAB3    0x00000004
184*43a90889SApple OSS Distributions #define         CR0     0x00000000
185*43a90889SApple OSS Distributions #define         CR1     0x00001000
186*43a90889SApple OSS Distributions #define         CR2     0x00002000
187*43a90889SApple OSS Distributions #define         CR3     0x00003000
188*43a90889SApple OSS Distributions #define         FF0     0x00000000
189*43a90889SApple OSS Distributions #define         FF1     0x00004000
190*43a90889SApple OSS Distributions #define         BS0     0x00000000
191*43a90889SApple OSS Distributions #define         BS1     0x00008000
192*43a90889SApple OSS Distributions #define         VT0     0x00000000
193*43a90889SApple OSS Distributions #define         VT1     0x00010000
194*43a90889SApple OSS Distributions #endif  /* !_SYS_IOCTL_COMPAT_H_ */
195*43a90889SApple OSS Distributions /*
196*43a90889SApple OSS Distributions  * + End unimplemented features
197*43a90889SApple OSS Distributions  */
198*43a90889SApple OSS Distributions 
199*43a90889SApple OSS Distributions /*
200*43a90889SApple OSS Distributions  * Control flags - hardware control of terminal
201*43a90889SApple OSS Distributions  */
202*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
203*43a90889SApple OSS Distributions #define CIGNORE         0x00000001      /* ignore control flags */
204*43a90889SApple OSS Distributions #endif
205*43a90889SApple OSS Distributions #define CSIZE           0x00000300      /* character size mask */
206*43a90889SApple OSS Distributions #define     CS5             0x00000000      /* 5 bits (pseudo) */
207*43a90889SApple OSS Distributions #define     CS6             0x00000100      /* 6 bits */
208*43a90889SApple OSS Distributions #define     CS7             0x00000200      /* 7 bits */
209*43a90889SApple OSS Distributions #define     CS8             0x00000300      /* 8 bits */
210*43a90889SApple OSS Distributions #define CSTOPB          0x00000400      /* send 2 stop bits */
211*43a90889SApple OSS Distributions #define CREAD           0x00000800      /* enable receiver */
212*43a90889SApple OSS Distributions #define PARENB          0x00001000      /* parity enable */
213*43a90889SApple OSS Distributions #define PARODD          0x00002000      /* odd parity, else even */
214*43a90889SApple OSS Distributions #define HUPCL           0x00004000      /* hang up on last close */
215*43a90889SApple OSS Distributions #define CLOCAL          0x00008000      /* ignore modem status lines */
216*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
217*43a90889SApple OSS Distributions #define CCTS_OFLOW      0x00010000      /* CTS flow control of output */
218*43a90889SApple OSS Distributions #define CRTSCTS         (CCTS_OFLOW | CRTS_IFLOW)
219*43a90889SApple OSS Distributions #define CRTS_IFLOW      0x00020000      /* RTS flow control of input */
220*43a90889SApple OSS Distributions #define CDTR_IFLOW      0x00040000      /* DTR flow control of input */
221*43a90889SApple OSS Distributions #define CDSR_OFLOW      0x00080000      /* DSR flow control of output */
222*43a90889SApple OSS Distributions #define CCAR_OFLOW      0x00100000      /* DCD flow control of output */
223*43a90889SApple OSS Distributions #define MDMBUF          0x00100000      /* old name for CCAR_OFLOW */
224*43a90889SApple OSS Distributions #endif
225*43a90889SApple OSS Distributions 
226*43a90889SApple OSS Distributions 
227*43a90889SApple OSS Distributions /*
228*43a90889SApple OSS Distributions  * "Local" flags - dumping ground for other state
229*43a90889SApple OSS Distributions  *
230*43a90889SApple OSS Distributions  * Warning: some flags in this structure begin with
231*43a90889SApple OSS Distributions  * the letter "I" and look like they belong in the
232*43a90889SApple OSS Distributions  * input flag.
233*43a90889SApple OSS Distributions  */
234*43a90889SApple OSS Distributions 
235*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
236*43a90889SApple OSS Distributions #define ECHOKE          0x00000001      /* visual erase for line kill */
237*43a90889SApple OSS Distributions #endif  /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
238*43a90889SApple OSS Distributions #define ECHOE           0x00000002      /* visually erase chars */
239*43a90889SApple OSS Distributions #define ECHOK           0x00000004      /* echo NL after line kill */
240*43a90889SApple OSS Distributions #define ECHO            0x00000008      /* enable echoing */
241*43a90889SApple OSS Distributions #define ECHONL          0x00000010      /* echo NL even if ECHO is off */
242*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
243*43a90889SApple OSS Distributions #define ECHOPRT         0x00000020      /* visual erase mode for hardcopy */
244*43a90889SApple OSS Distributions #define ECHOCTL         0x00000040      /* echo control chars as ^(Char) */
245*43a90889SApple OSS Distributions #endif  /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
246*43a90889SApple OSS Distributions #define ISIG            0x00000080      /* enable signals INTR, QUIT, [D]SUSP */
247*43a90889SApple OSS Distributions #define ICANON          0x00000100      /* canonicalize input lines */
248*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
249*43a90889SApple OSS Distributions #define ALTWERASE       0x00000200      /* use alternate WERASE algorithm */
250*43a90889SApple OSS Distributions #endif  /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
251*43a90889SApple OSS Distributions #define IEXTEN          0x00000400      /* enable DISCARD and LNEXT */
252*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
253*43a90889SApple OSS Distributions #define EXTPROC         0x00000800      /* external processing */
254*43a90889SApple OSS Distributions #endif  /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
255*43a90889SApple OSS Distributions #define TOSTOP          0x00400000      /* stop background jobs from output */
256*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
257*43a90889SApple OSS Distributions #define FLUSHO          0x00800000      /* output being flushed (state) */
258*43a90889SApple OSS Distributions #define NOKERNINFO      0x02000000      /* no kernel output from VSTATUS */
259*43a90889SApple OSS Distributions #define PENDIN          0x20000000      /* XXX retype pending input (state) */
260*43a90889SApple OSS Distributions #endif  /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
261*43a90889SApple OSS Distributions #define NOFLSH          0x80000000      /* don't flush after interrupt */
262*43a90889SApple OSS Distributions 
263*43a90889SApple OSS Distributions typedef unsigned long   tcflag_t;
264*43a90889SApple OSS Distributions typedef unsigned char   cc_t;
265*43a90889SApple OSS Distributions typedef unsigned long   speed_t;
266*43a90889SApple OSS Distributions 
267*43a90889SApple OSS Distributions struct termios {
268*43a90889SApple OSS Distributions 	tcflag_t        c_iflag;        /* input flags */
269*43a90889SApple OSS Distributions 	tcflag_t        c_oflag;        /* output flags */
270*43a90889SApple OSS Distributions 	tcflag_t        c_cflag;        /* control flags */
271*43a90889SApple OSS Distributions 	tcflag_t        c_lflag;        /* local flags */
272*43a90889SApple OSS Distributions 	cc_t            c_cc[NCCS];     /* control chars */
273*43a90889SApple OSS Distributions 	speed_t         c_ispeed;       /* input speed */
274*43a90889SApple OSS Distributions 	speed_t         c_ospeed;       /* output speed */
275*43a90889SApple OSS Distributions };
276*43a90889SApple OSS Distributions 
277*43a90889SApple OSS Distributions #ifdef KERNEL
278*43a90889SApple OSS Distributions typedef __uint64_t      user_tcflag_t;
279*43a90889SApple OSS Distributions typedef __uint64_t      user_speed_t;
280*43a90889SApple OSS Distributions 
281*43a90889SApple OSS Distributions /*
282*43a90889SApple OSS Distributions  * LP64 version of struct termios.  tcflag_t and speed_t are long and must
283*43a90889SApple OSS Distributions  * grow when we're dealing with a 64-bit process.
284*43a90889SApple OSS Distributions  * WARNING - keep in sync with struct termios
285*43a90889SApple OSS Distributions  */
286*43a90889SApple OSS Distributions 
287*43a90889SApple OSS Distributions struct user_termios {
288*43a90889SApple OSS Distributions 	user_tcflag_t   c_iflag;        /* input flags */
289*43a90889SApple OSS Distributions 	user_tcflag_t   c_oflag;        /* output flags */
290*43a90889SApple OSS Distributions 	user_tcflag_t   c_cflag;        /* control flags */
291*43a90889SApple OSS Distributions 	user_tcflag_t   c_lflag;        /* local flags */
292*43a90889SApple OSS Distributions 	cc_t            c_cc[NCCS];     /* control chars */
293*43a90889SApple OSS Distributions 	user_speed_t    c_ispeed __attribute((aligned(8)));     /* input speed */
294*43a90889SApple OSS Distributions 	user_speed_t    c_ospeed;       /* output speed */
295*43a90889SApple OSS Distributions };
296*43a90889SApple OSS Distributions 
297*43a90889SApple OSS Distributions /* 32 bit version */
298*43a90889SApple OSS Distributions struct termios32 {
299*43a90889SApple OSS Distributions 	__uint32_t      c_iflag;        /* input flags */
300*43a90889SApple OSS Distributions 	__uint32_t      c_oflag;        /* output flags */
301*43a90889SApple OSS Distributions 	__uint32_t      c_cflag;        /* control flags */
302*43a90889SApple OSS Distributions 	__uint32_t      c_lflag;        /* local flags */
303*43a90889SApple OSS Distributions 	cc_t            c_cc[NCCS];     /* control chars */
304*43a90889SApple OSS Distributions 	__uint32_t      c_ispeed;       /* input speed */
305*43a90889SApple OSS Distributions 	__uint32_t      c_ospeed;       /* output speed */
306*43a90889SApple OSS Distributions };
307*43a90889SApple OSS Distributions 
308*43a90889SApple OSS Distributions #endif  /* KERNEL */
309*43a90889SApple OSS Distributions 
310*43a90889SApple OSS Distributions /*
311*43a90889SApple OSS Distributions  * Commands passed to tcsetattr() for setting the termios structure.
312*43a90889SApple OSS Distributions  */
313*43a90889SApple OSS Distributions #define TCSANOW         0               /* make change immediate */
314*43a90889SApple OSS Distributions #define TCSADRAIN       1               /* drain output, then change */
315*43a90889SApple OSS Distributions #define TCSAFLUSH       2               /* drain output, flush input */
316*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
317*43a90889SApple OSS Distributions #define TCSASOFT        0x10            /* flag - don't alter h.w. state */
318*43a90889SApple OSS Distributions #endif
319*43a90889SApple OSS Distributions 
320*43a90889SApple OSS Distributions /*
321*43a90889SApple OSS Distributions  * Standard speeds
322*43a90889SApple OSS Distributions  */
323*43a90889SApple OSS Distributions #define B0      0
324*43a90889SApple OSS Distributions #define B50     50
325*43a90889SApple OSS Distributions #define B75     75
326*43a90889SApple OSS Distributions #define B110    110
327*43a90889SApple OSS Distributions #define B134    134
328*43a90889SApple OSS Distributions #define B150    150
329*43a90889SApple OSS Distributions #define B200    200
330*43a90889SApple OSS Distributions #define B300    300
331*43a90889SApple OSS Distributions #define B600    600
332*43a90889SApple OSS Distributions #define B1200   1200
333*43a90889SApple OSS Distributions #define B1800   1800
334*43a90889SApple OSS Distributions #define B2400   2400
335*43a90889SApple OSS Distributions #define B4800   4800
336*43a90889SApple OSS Distributions #define B9600   9600
337*43a90889SApple OSS Distributions #define B19200  19200
338*43a90889SApple OSS Distributions #define B38400  38400
339*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
340*43a90889SApple OSS Distributions #define B7200   7200
341*43a90889SApple OSS Distributions #define B14400  14400
342*43a90889SApple OSS Distributions #define B28800  28800
343*43a90889SApple OSS Distributions #define B57600  57600
344*43a90889SApple OSS Distributions #define B76800  76800
345*43a90889SApple OSS Distributions #define B115200 115200
346*43a90889SApple OSS Distributions #define B230400 230400
347*43a90889SApple OSS Distributions #define EXTA    19200
348*43a90889SApple OSS Distributions #define EXTB    38400
349*43a90889SApple OSS Distributions #endif  /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
350*43a90889SApple OSS Distributions 
351*43a90889SApple OSS Distributions #ifndef KERNEL
352*43a90889SApple OSS Distributions 
353*43a90889SApple OSS Distributions #define TCIFLUSH        1
354*43a90889SApple OSS Distributions #define TCOFLUSH        2
355*43a90889SApple OSS Distributions #define TCIOFLUSH       3
356*43a90889SApple OSS Distributions #define TCOOFF          1
357*43a90889SApple OSS Distributions #define TCOON           2
358*43a90889SApple OSS Distributions #define TCIOFF          3
359*43a90889SApple OSS Distributions #define TCION           4
360*43a90889SApple OSS Distributions 
361*43a90889SApple OSS Distributions #include <sys/cdefs.h>
362*43a90889SApple OSS Distributions 
363*43a90889SApple OSS Distributions __BEGIN_DECLS
364*43a90889SApple OSS Distributions speed_t cfgetispeed(const struct termios *);
365*43a90889SApple OSS Distributions speed_t cfgetospeed(const struct termios *);
366*43a90889SApple OSS Distributions int     cfsetispeed(struct termios *, speed_t);
367*43a90889SApple OSS Distributions int     cfsetospeed(struct termios *, speed_t);
368*43a90889SApple OSS Distributions int     tcgetattr(int, struct termios *);
369*43a90889SApple OSS Distributions int     tcsetattr(int, int, const struct termios *);
370*43a90889SApple OSS Distributions int     tcdrain(int) __DARWIN_ALIAS_C(tcdrain);
371*43a90889SApple OSS Distributions int     tcflow(int, int);
372*43a90889SApple OSS Distributions int     tcflush(int, int);
373*43a90889SApple OSS Distributions int     tcsendbreak(int, int);
374*43a90889SApple OSS Distributions 
375*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
376*43a90889SApple OSS Distributions void    cfmakeraw(struct termios *);
377*43a90889SApple OSS Distributions int     cfsetspeed(struct termios *, speed_t);
378*43a90889SApple OSS Distributions #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
379*43a90889SApple OSS Distributions __END_DECLS
380*43a90889SApple OSS Distributions 
381*43a90889SApple OSS Distributions #endif /* !KERNEL */
382*43a90889SApple OSS Distributions 
383*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
384*43a90889SApple OSS Distributions 
385*43a90889SApple OSS Distributions /*
386*43a90889SApple OSS Distributions  * Include tty ioctl's that aren't just for backwards compatibility
387*43a90889SApple OSS Distributions  * with the old tty driver.  These ioctl definitions were previously
388*43a90889SApple OSS Distributions  * in <sys/ioctl.h>.
389*43a90889SApple OSS Distributions  */
390*43a90889SApple OSS Distributions #include <sys/ttycom.h>
391*43a90889SApple OSS Distributions #endif
392*43a90889SApple OSS Distributions 
393*43a90889SApple OSS Distributions /*
394*43a90889SApple OSS Distributions  * END OF PROTECTED INCLUDE.
395*43a90889SApple OSS Distributions  */
396*43a90889SApple OSS Distributions #endif /* !_SYS_TERMIOS_H_ */
397*43a90889SApple OSS Distributions 
398*43a90889SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
399*43a90889SApple OSS Distributions #include <sys/ttydefaults.h>
400*43a90889SApple OSS Distributions #endif
401