The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/include/termios.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* The <termios.h> header is used for controlling tty modes. */
    2 
    3 #ifndef _TERMIOS_H
    4 #define _TERMIOS_H
    5 
    6 typedef unsigned short tcflag_t;
    7 typedef unsigned char cc_t;
    8 typedef unsigned int speed_t;
    9 
   10 #define NCCS               20   /* size of cc_c array, some extra space
   11                                  * for extensions. */
   12 
   13 /* Primary terminal control structure. POSIX Table 7-1. */
   14 struct termios {
   15   tcflag_t c_iflag;             /* input modes */
   16   tcflag_t c_oflag;             /* output modes */
   17   tcflag_t c_cflag;             /* control modes */
   18   tcflag_t c_lflag;             /* local modes */
   19   speed_t  c_ispeed;            /* input speed */
   20   speed_t  c_ospeed;            /* output speed */
   21   cc_t c_cc[NCCS];              /* control characters */
   22 };
   23 
   24 /* Values for termios c_iflag bit map.  POSIX Table 7-2. */
   25 #define BRKINT          0x0001  /* signal interrupt on break */
   26 #define ICRNL           0x0002  /* map CR to NL on input */
   27 #define IGNBRK          0x0004  /* ignore break */
   28 #define IGNCR           0x0008  /* ignore CR */
   29 #define IGNPAR          0x0010  /* ignore characters with parity errors */
   30 #define INLCR           0x0020  /* map NL to CR on input */
   31 #define INPCK           0x0040  /* enable input parity check */
   32 #define ISTRIP          0x0080  /* mask off 8th bit */
   33 #define IXOFF           0x0100  /* enable start/stop input control */
   34 #define IXON            0x0200  /* enable start/stop output control */
   35 #define PARMRK          0x0400  /* mark parity errors in the input queue */
   36 
   37 /* Values for termios c_oflag bit map.  POSIX Sec. 7.1.2.3. */
   38 #define OPOST           0x0001  /* perform output processing */
   39 
   40 /* Values for termios c_cflag bit map.  POSIX Table 7-3. */
   41 #define CLOCAL          0x0001  /* ignore modem status lines */
   42 #define CREAD           0x0002  /* enable receiver */
   43 #define CSIZE           0x000C  /* number of bits per character */
   44 #define         CS5     0x0000  /* if CSIZE is CS5, characters are 5 bits */
   45 #define         CS6     0x0004  /* if CSIZE is CS6, characters are 6 bits */
   46 #define         CS7     0x0008  /* if CSIZE is CS7, characters are 7 bits */
   47 #define         CS8     0x000C  /* if CSIZE is CS8, characters are 8 bits */
   48 #define CSTOPB          0x0010  /* send 2 stop bits if set, else 1 */
   49 #define HUPCL           0x0020  /* hang up on last close */
   50 #define PARENB          0x0040  /* enable parity on output */
   51 #define PARODD          0x0080  /* use odd parity if set, else even */
   52 
   53 /* Values for termios c_lflag bit map.  POSIX Table 7-4. */
   54 #define ECHO            0x0001  /* enable echoing of input characters */
   55 #define ECHOE           0x0002  /* echo ERASE as backspace */
   56 #define ECHOK           0x0004  /* echo KILL */
   57 #define ECHONL          0x0008  /* echo NL */
   58 #define ICANON          0x0010  /* canonical input (erase and kill enabled) */
   59 #define IEXTEN          0x0020  /* enable extended functions */
   60 #define ISIG            0x0040  /* enable signals */
   61 #define NOFLSH          0x0080  /* disable flush after interrupt or quit */
   62 #define TOSTOP          0x0100  /* send SIGTTOU (job control, not implemented*/
   63 
   64 /* Indices into c_cc array.  Default values in parentheses. POSIX Table 7-5. */
   65 #define VEOF                 0  /* cc_c[VEOF] = EOF char (^D) */
   66 #define VEOL                 1  /* cc_c[VEOL] = EOL char (undef) */
   67 #define VERASE               2  /* cc_c[VERASE] = ERASE char (^H) */
   68 #define VINTR                3  /* cc_c[VINTR] = INTR char (DEL) */
   69 #define VKILL                4  /* cc_c[VKILL] = KILL char (^U) */
   70 #define VMIN                 5  /* cc_c[VMIN] = MIN value for timer */
   71 #define VQUIT                6  /* cc_c[VQUIT] = QUIT char (^\) */
   72 #define VTIME                7  /* cc_c[VTIME] = TIME value for timer */
   73 #define VSUSP                8  /* cc_c[VSUSP] = SUSP (^Z, ignored) */
   74 #define VSTART               9  /* cc_c[VSTART] = START char (^S) */
   75 #define VSTOP               10  /* cc_c[VSTOP] = STOP char (^Q) */
   76 
   77 #define _POSIX_VDISABLE   (cc_t)0xFF    /* You can't even generate this 
   78                                          * character with 'normal' keyboards.
   79                                          * But some language specific keyboards
   80                                          * can generate 0xFF. It seems that all
   81                                          * 256 are used, so cc_t should be a
   82                                          * short...
   83                                          */
   84 
   85 /* Values for the baud rate settings.  POSIX Table 7-6. */
   86 #define B0              0x0000  /* hang up the line */
   87 #define B50             0x1000  /* 50 baud */
   88 #define B75             0x2000  /* 75 baud */
   89 #define B110            0x3000  /* 110 baud */
   90 #define B134            0x4000  /* 134.5 baud */
   91 #define B150            0x5000  /* 150 baud */
   92 #define B200            0x6000  /* 200 baud */
   93 #define B300            0x7000  /* 300 baud */
   94 #define B600            0x8000  /* 600 baud */
   95 #define B1200           0x9000  /* 1200 baud */
   96 #define B1800           0xA000  /* 1800 baud */
   97 #define B2400           0xB000  /* 2400 baud */
   98 #define B4800           0xC000  /* 4800 baud */
   99 #define B9600           0xD000  /* 9600 baud */
  100 #define B19200          0xE000  /* 19200 baud */
  101 #define B38400          0xF000  /* 38400 baud */
  102 
  103 /* Optional actions for tcsetattr().  POSIX Sec. 7.2.1.2. */
  104 #define TCSANOW            1    /* changes take effect immediately */
  105 #define TCSADRAIN          2    /* changes take effect after output is done */
  106 #define TCSAFLUSH          3    /* wait for output to finish and flush input */
  107 
  108 /* Queue_selector values for tcflush().  POSIX Sec. 7.2.2.2. */
  109 #define TCIFLUSH           1    /* flush accumulated input data */
  110 #define TCOFLUSH           2    /* flush accumulated output data */
  111 #define TCIOFLUSH          3    /* flush accumulated input and output data */
  112 
  113 /* Action values for tcflow().  POSIX Sec. 7.2.2.2. */
  114 #define TCOOFF             1    /* suspend output */
  115 #define TCOON              2    /* restart suspended output */
  116 #define TCIOFF             3    /* transmit a STOP character on the line */
  117 #define TCION              4    /* transmit a START character on the line */
  118 
  119 /* Function Prototypes. */
  120 #ifndef _ANSI_H
  121 #include <ansi.h>
  122 #endif
  123 
  124 _PROTOTYPE( int tcsendbreak, (int _fildes, int _duration)                    );
  125 _PROTOTYPE( int tcdrain, (int _filedes)                                      );
  126 _PROTOTYPE( int tcflush, (int _filedes, int _queue_selector)                 );
  127 _PROTOTYPE( int tcflow, (int _filedes, int _action)                          );
  128 _PROTOTYPE( speed_t cfgetispeed, (const struct termios *_termios_p)          );
  129 _PROTOTYPE( speed_t cfgetospeed, (const struct termios *_termios_p)          );
  130 _PROTOTYPE( int cfsetispeed, (struct termios *_termios_p, speed_t _speed)    );
  131 _PROTOTYPE( int cfsetospeed, (struct termios *_termios_p, speed_t _speed)    );
  132 _PROTOTYPE( int tcgetattr, (int _filedes, struct termios *_termios_p)        );
  133 _PROTOTYPE( int tcsetattr, \
  134         (int _filedes, int _opt_actions, const struct termios *_termios_p)   );
  135 
  136 #define cfgetispeed(termios_p)          ((termios_p)->c_ispeed)
  137 #define cfgetospeed(termios_p)          ((termios_p)->c_ospeed)
  138 #define cfsetispeed(termios_p, speed)   ((termios_p)->c_ispeed = (speed), 0)
  139 #define cfsetospeed(termios_p, speed)   ((termios_p)->c_ospeed = (speed), 0)
  140 
  141 #ifdef _MINIX
  142 /* Here are the local extensions to the POSIX standard for Minix. Posix
  143  * conforming programs are not able to access these, and therefore they are
  144  * only defined when a Minix program is compiled.
  145  */
  146 
  147 /* Extensions to the termios c_iflag bit map.  */
  148 #define IXANY           0x0800  /* allow any key to continue ouptut */
  149 
  150 /* Extensions to the termios c_oflag bit map. They are only active iff
  151  * OPOST is enabled. */
  152 #define ONLCR           0x0002  /* Map NL to CR-NL on output */
  153 #define XTABS           0x0004  /* Expand tabs to spaces */
  154 #define ONOEOT          0x0008  /* discard EOT's (^D) on output) */
  155 
  156 /* Extensions to the termios c_lflag bit map.  */
  157 #define LFLUSHO         0x0200  /* Flush output. */
  158 
  159 /* Extensions to the c_cc array. */
  160 #define VREPRINT          11    /* cc_c[VREPRINT] (^R) */
  161 #define VLNEXT            12    /* cc_c[VLNEXT] (^V) */
  162 #define VDISCARD          13    /* cc_c[VDISCARD] (^O) */
  163 
  164 /* Extensions to baud rate settings. */
  165 #define B57600          0x0100  /* 57600 baud */
  166 #define B115200         0x0200  /* 115200 baud */
  167 
  168 /* These are the default settings used by the kernel and by 'stty sane' */
  169 
  170 #define TCTRL_DEF       (CREAD | CS8 | HUPCL)
  171 #define TINPUT_DEF      (BRKINT | ICRNL | IXON | IXANY)
  172 #define TOUTPUT_DEF     (OPOST | ONLCR)
  173 #define TLOCAL_DEF      (ISIG | IEXTEN | ICANON | ECHO | ECHOE)
  174 #define TSPEED_DEF      B9600
  175 
  176 #define TEOF_DEF        '\4'    /* ^D */
  177 #define TEOL_DEF        _POSIX_VDISABLE
  178 #define TERASE_DEF      '\1'   /* ^H */
  179 #define TINTR_DEF       '\3'    /* ^C */
  180 #define TKILL_DEF       '\25'   /* ^U */
  181 #define TMIN_DEF        1
  182 #define TQUIT_DEF       '\34'   /* ^\ */
  183 #define TSTART_DEF      '\21'   /* ^Q */
  184 #define TSTOP_DEF       '\23'   /* ^S */
  185 #define TSUSP_DEF       '\32'   /* ^Z */
  186 #define TTIME_DEF       0
  187 #define TREPRINT_DEF    '\22'   /* ^R */
  188 #define TLNEXT_DEF      '\26'   /* ^V */
  189 #define TDISCARD_DEF    '\17'   /* ^O */
  190 
  191 /* Window size. This information is stored in the TTY driver but not used.
  192  * This can be used for screen based applications in a window environment. 
  193  * The ioctls TIOCGWINSZ and TIOCSWINSZ can be used to get and set this 
  194  * information.
  195  */
  196 
  197 struct winsize
  198 {
  199         unsigned short  ws_row;         /* rows, in characters */
  200         unsigned short  ws_col;         /* columns, in characters */
  201         unsigned short  ws_xpixel;      /* horizontal size, pixels */
  202         unsigned short  ws_ypixel;      /* vertical size, pixels */
  203 };
  204 #endif /* _MINIX */
  205 
  206 #endif /* _TERMIOS_H */

Cache object: d3de99e13f6a0677e113112f55a6ab47


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.