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