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