Annotation of kernel/bsd/sys/termios.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */
                     26: /*
                     27:  * Copyright (c) 1988, 1989, 1993, 1994
                     28:  *     The Regents of the University of California.  All rights reserved.
                     29:  *
                     30:  * Redistribution and use in source and binary forms, with or without
                     31:  * modification, are permitted provided that the following conditions
                     32:  * are met:
                     33:  * 1. Redistributions of source code must retain the above copyright
                     34:  *    notice, this list of conditions and the following disclaimer.
                     35:  * 2. Redistributions in binary form must reproduce the above copyright
                     36:  *    notice, this list of conditions and the following disclaimer in the
                     37:  *    documentation and/or other materials provided with the distribution.
                     38:  * 3. All advertising materials mentioning features or use of this software
                     39:  *    must display the following acknowledgement:
                     40:  *     This product includes software developed by the University of
                     41:  *     California, Berkeley and its contributors.
                     42:  * 4. Neither the name of the University nor the names of its contributors
                     43:  *    may be used to endorse or promote products derived from this software
                     44:  *    without specific prior written permission.
                     45:  *
                     46:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     47:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     48:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     49:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     50:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     51:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     52:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     53:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     54:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     55:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     56:  * SUCH DAMAGE.
                     57:  *
                     58:  *     @(#)termios.h   8.3 (Berkeley) 3/28/94
                     59:  */
                     60: 
                     61: #ifndef _SYS_TERMIOS_H_
                     62: #define _SYS_TERMIOS_H_
                     63: 
                     64: /*
                     65:  * Special Control Characters
                     66:  *
                     67:  * Index into c_cc[] character array.
                     68:  *
                     69:  *     Name         Subscript  Enabled by
                     70:  */
                     71: #define        VEOF            0       /* ICANON */
                     72: #define        VEOL            1       /* ICANON */
                     73: #ifndef _POSIX_SOURCE
                     74: #define        VEOL2           2       /* ICANON together with IEXTEN */
                     75: #endif
                     76: #define        VERASE          3       /* ICANON */
                     77: #ifndef _POSIX_SOURCE
                     78: #define VWERASE        4       /* ICANON together with IEXTEN */
                     79: #endif
                     80: #define VKILL          5       /* ICANON */
                     81: #ifndef _POSIX_SOURCE
                     82: #define        VREPRINT        6       /* ICANON together with IEXTEN */
                     83: #endif
                     84: /*                     7          spare 1 */
                     85: #define VINTR          8       /* ISIG */
                     86: #define VQUIT          9       /* ISIG */
                     87: #define VSUSP          10      /* ISIG */
                     88: #ifndef _POSIX_SOURCE
                     89: #define VDSUSP         11      /* ISIG together with IEXTEN */
                     90: #endif
                     91: #define VSTART         12      /* IXON, IXOFF */
                     92: #define VSTOP          13      /* IXON, IXOFF */
                     93: #ifndef _POSIX_SOURCE
                     94: #define        VLNEXT          14      /* IEXTEN */
                     95: #define        VDISCARD        15      /* IEXTEN */
                     96: #endif
                     97: #define VMIN           16      /* !ICANON */
                     98: #define VTIME          17      /* !ICANON */
                     99: #ifndef _POSIX_SOURCE
                    100: #define VSTATUS                18      /* ICANON together with IEXTEN */
                    101: /*                     19         spare 2 */
                    102: #endif
                    103: #define        NCCS            20
                    104: 
                    105: #ifndef _POSIX_VDISABLE
                    106: #define        _POSIX_VDISABLE 0xff
                    107: #endif
                    108: 
                    109: #ifndef _POSIX_SOURCE
                    110: #define        CCEQ(val, c)    ((c) == (val) ? (val) != _POSIX_VDISABLE : 0)
                    111: #endif
                    112: 
                    113: /*
                    114:  * Input flags - software input processing
                    115:  */
                    116: #define        IGNBRK          0x00000001      /* ignore BREAK condition */
                    117: #define        BRKINT          0x00000002      /* map BREAK to SIGINTR */
                    118: #define        IGNPAR          0x00000004      /* ignore (discard) parity errors */
                    119: #define        PARMRK          0x00000008      /* mark parity and framing errors */
                    120: #define        INPCK           0x00000010      /* enable checking of parity errors */
                    121: #define        ISTRIP          0x00000020      /* strip 8th bit off chars */
                    122: #define        INLCR           0x00000040      /* map NL into CR */
                    123: #define        IGNCR           0x00000080      /* ignore CR */
                    124: #define        ICRNL           0x00000100      /* map CR to NL (ala CRMOD) */
                    125: #define        IXON            0x00000200      /* enable output flow control */
                    126: #define        IXOFF           0x00000400      /* enable input flow control */
                    127: #ifndef _POSIX_SOURCE
                    128: #define        IXANY           0x00000800      /* any char will restart after stop */
                    129: #define IMAXBEL                0x00002000      /* ring bell on input queue full */
                    130: #endif  /*_POSIX_SOURCE */
                    131: 
                    132: /*
                    133:  * Output flags - software output processing
                    134:  */
                    135: #define        OPOST           0x00000001      /* enable following output processing */
                    136: #ifndef _POSIX_SOURCE
                    137: #define ONLCR          0x00000002      /* map NL to CR-NL (ala CRMOD) */
                    138: #define OXTABS         0x00000004      /* expand tabs to spaces */
                    139: #define ONOEOT         0x00000008      /* discard EOT's (^D) on output) */
                    140: #endif  /*_POSIX_SOURCE */
                    141: 
                    142: /*
                    143:  * Control flags - hardware control of terminal
                    144:  */
                    145: #ifndef _POSIX_SOURCE
                    146: #define        CIGNORE         0x00000001      /* ignore control flags */
                    147: #endif
                    148: #define CSIZE          0x00000300      /* character size mask */
                    149: #define     CS5                    0x00000000      /* 5 bits (pseudo) */
                    150: #define     CS6                    0x00000100      /* 6 bits */
                    151: #define     CS7                    0x00000200      /* 7 bits */
                    152: #define     CS8                    0x00000300      /* 8 bits */
                    153: #define CSTOPB         0x00000400      /* send 2 stop bits */
                    154: #define CREAD          0x00000800      /* enable receiver */
                    155: #define PARENB         0x00001000      /* parity enable */
                    156: #define PARODD         0x00002000      /* odd parity, else even */
                    157: #define HUPCL          0x00004000      /* hang up on last close */
                    158: #define CLOCAL         0x00008000      /* ignore modem status lines */
                    159: #ifndef _POSIX_SOURCE
                    160: #define CCTS_OFLOW     0x00010000      /* CTS flow control of output */
                    161: #define CRTSCTS                (CCTS_OFLOW | CRTS_IFLOW)
                    162: #define CRTS_IFLOW     0x00020000      /* RTS flow control of input */
                    163: #define        CDTR_IFLOW      0x00040000      /* DTR flow control of input */
                    164: #define CDSR_OFLOW     0x00080000      /* DSR flow control of output */
                    165: #define        CCAR_OFLOW      0x00100000      /* DCD flow control of output */
                    166: #define        MDMBUF          0x00100000      /* old name for CCAR_OFLOW */
                    167: #endif
                    168: 
                    169: 
                    170: /*
                    171:  * "Local" flags - dumping ground for other state
                    172:  *
                    173:  * Warning: some flags in this structure begin with
                    174:  * the letter "I" and look like they belong in the
                    175:  * input flag.
                    176:  */
                    177: 
                    178: #ifndef _POSIX_SOURCE
                    179: #define        ECHOKE          0x00000001      /* visual erase for line kill */
                    180: #endif  /*_POSIX_SOURCE */
                    181: #define        ECHOE           0x00000002      /* visually erase chars */
                    182: #define        ECHOK           0x00000004      /* echo NL after line kill */
                    183: #define ECHO           0x00000008      /* enable echoing */
                    184: #define        ECHONL          0x00000010      /* echo NL even if ECHO is off */
                    185: #ifndef _POSIX_SOURCE
                    186: #define        ECHOPRT         0x00000020      /* visual erase mode for hardcopy */
                    187: #define ECHOCTL        0x00000040      /* echo control chars as ^(Char) */
                    188: #endif  /*_POSIX_SOURCE */
                    189: #define        ISIG            0x00000080      /* enable signals INTR, QUIT, [D]SUSP */
                    190: #define        ICANON          0x00000100      /* canonicalize input lines */
                    191: #ifndef _POSIX_SOURCE
                    192: #define ALTWERASE      0x00000200      /* use alternate WERASE algorithm */
                    193: #endif  /*_POSIX_SOURCE */
                    194: #define        IEXTEN          0x00000400      /* enable DISCARD and LNEXT */
                    195: #define EXTPROC         0x00000800      /* external processing */
                    196: #define TOSTOP         0x00400000      /* stop background jobs from output */
                    197: #ifndef _POSIX_SOURCE
                    198: #define FLUSHO         0x00800000      /* output being flushed (state) */
                    199: #define        NOKERNINFO      0x02000000      /* no kernel output from VSTATUS */
                    200: #define PENDIN         0x20000000      /* XXX retype pending input (state) */
                    201: #endif  /*_POSIX_SOURCE */
                    202: #define        NOFLSH          0x80000000      /* don't flush after interrupt */
                    203: 
                    204: typedef unsigned long  tcflag_t;
                    205: typedef unsigned char  cc_t;
                    206: typedef long           speed_t;        /* XXX should be unsigned long */
                    207: 
                    208: struct termios {
                    209:        tcflag_t        c_iflag;        /* input flags */
                    210:        tcflag_t        c_oflag;        /* output flags */
                    211:        tcflag_t        c_cflag;        /* control flags */
                    212:        tcflag_t        c_lflag;        /* local flags */
                    213:        cc_t            c_cc[NCCS];     /* control chars */
                    214:        speed_t         c_ispeed;       /* input speed */
                    215:        speed_t         c_ospeed;       /* output speed */
                    216: };
                    217: 
                    218: /*
                    219:  * Commands passed to tcsetattr() for setting the termios structure.
                    220:  */
                    221: #define        TCSANOW         0               /* make change immediate */
                    222: #define        TCSADRAIN       1               /* drain output, then change */
                    223: #define        TCSAFLUSH       2               /* drain output, flush input */
                    224: #ifndef _POSIX_SOURCE
                    225: #define TCSASOFT       0x10            /* flag - don't alter h.w. state */
                    226: #endif
                    227: 
                    228: /*
                    229:  * Standard speeds
                    230:  */
                    231: #define B0     0
                    232: #define B50    50
                    233: #define B75    75
                    234: #define B110   110
                    235: #define B134   134
                    236: #define B150   150
                    237: #define B200   200
                    238: #define B300   300
                    239: #define B600   600
                    240: #define B1200  1200
                    241: #define        B1800   1800
                    242: #define B2400  2400
                    243: #define B4800  4800
                    244: #define B9600  9600
                    245: #define B19200 19200
                    246: #define B38400 38400
                    247: #ifndef _POSIX_SOURCE
                    248: #define B7200  7200
                    249: #define B14400 14400
                    250: #define B28800 28800
                    251: #define B57600 57600
                    252: #define B76800 76800
                    253: #define B115200        115200
                    254: #define B230400        230400
                    255: #define EXTA   19200
                    256: #define EXTB   38400
                    257: #endif  /* !_POSIX_SOURCE */
                    258: 
                    259: #ifndef _KERNEL
                    260: 
                    261: #define        TCIFLUSH        1
                    262: #define        TCOFLUSH        2
                    263: #define TCIOFLUSH      3
                    264: #define        TCOOFF          1
                    265: #define        TCOON           2
                    266: #define TCIOFF         3
                    267: #define TCION          4
                    268: 
                    269: #include <sys/cdefs.h>
                    270: 
                    271: __BEGIN_DECLS
                    272: speed_t        cfgetispeed __P((const struct termios *));
                    273: speed_t        cfgetospeed __P((const struct termios *));
                    274: int    cfsetispeed __P((struct termios *, speed_t));
                    275: int    cfsetospeed __P((struct termios *, speed_t));
                    276: int    tcgetattr __P((int, struct termios *));
                    277: int    tcsetattr __P((int, int, const struct termios *));
                    278: int    tcdrain __P((int));
                    279: int    tcflow __P((int, int));
                    280: int    tcflush __P((int, int));
                    281: int    tcsendbreak __P((int, int));
                    282: 
                    283: #ifndef _POSIX_SOURCE
                    284: void   cfmakeraw __P((struct termios *));
                    285: int    cfsetspeed __P((struct termios *, speed_t));
                    286: #endif /* !_POSIX_SOURCE */
                    287: __END_DECLS
                    288: 
                    289: #endif /* !_KERNEL */
                    290: 
                    291: #ifndef _POSIX_SOURCE
                    292: 
                    293: /*
                    294:  * Include tty ioctl's that aren't just for backwards compatibility
                    295:  * with the old tty driver.  These ioctl definitions were previously
                    296:  * in <sys/ioctl.h>.
                    297:  */
                    298: #include <sys/ttycom.h>
                    299: #endif
                    300: 
                    301: /*
                    302:  * END OF PROTECTED INCLUDE.
                    303:  */
                    304: #endif /* !_SYS_TERMIOS_H_ */
                    305: 
                    306: #ifndef _POSIX_SOURCE
                    307: #include <sys/ttydefaults.h>
                    308: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.