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