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