]>
Commit | Line | Data |
---|---|---|
28f540f4 | 1 | /* termios type and macro definitions. 4.4 BSD/generic GNU version. |
b7b5a610 | 2 | Copyright (C) 1993,94,96,97,99 Free Software Foundation, Inc. |
54d79e99 | 3 | This file is part of the GNU C Library. |
28f540f4 | 4 | |
54d79e99 UD |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public License as | |
7 | published by the Free Software Foundation; either version 2 of the | |
8 | License, or (at your option) any later version. | |
28f540f4 | 9 | |
54d79e99 UD |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Library General Public License for more details. | |
28f540f4 | 14 | |
54d79e99 UD |
15 | You should have received a copy of the GNU Library General Public |
16 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
17 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
18 | Boston, MA 02111-1307, USA. */ | |
28f540f4 | 19 | |
f4017d20 UD |
20 | #ifndef _TERMIOS_H |
21 | # error "Never include <bits/termios.h> directly; use <termios.h> instead." | |
22 | #endif | |
23 | ||
5107cf1d UD |
24 | /* These macros are also defined in some <bits/ioctls.h> files (with |
25 | numerically identical values), but this serves to shut up cpp's | |
26 | complaining. */ | |
18c75117 TBB |
27 | #ifdef __USE_BSD |
28 | ||
f4017d20 UD |
29 | # ifdef MDMBUF |
30 | # undef MDMBUF | |
31 | # endif | |
32 | # ifdef FLUSHO | |
33 | # undef FLUSHO | |
34 | # endif | |
35 | # ifdef PENDIN | |
36 | # undef PENDIN | |
37 | # endif | |
18c75117 TBB |
38 | |
39 | #endif /* __USE_BSD */ | |
40 | ||
41 | #ifdef ECHO | |
f4017d20 | 42 | # undef ECHO |
18c75117 TBB |
43 | #endif |
44 | #ifdef TOSTOP | |
f4017d20 | 45 | # undef TOSTOP |
18c75117 TBB |
46 | #endif |
47 | #ifdef NOFLSH | |
f4017d20 | 48 | # undef NOFLSH |
18c75117 TBB |
49 | #endif |
50 | ||
51 | ||
28f540f4 RM |
52 | /* These definitions match those used by the 4.4 BSD kernel. |
53 | If the operating system has termios system calls or ioctls that | |
54 | correctly implement the POSIX.1 behavior, there should be a | |
55 | system-dependent version of this file that defines `struct termios', | |
56 | `tcflag_t', `cc_t', `speed_t' and the `TC*' constants appropriately. */ | |
57 | ||
58 | /* Type of terminal control flag masks. */ | |
59 | typedef unsigned long int tcflag_t; | |
60 | ||
61 | /* Type of control characters. */ | |
62 | typedef unsigned char cc_t; | |
63 | ||
64 | /* Type of baud rate specifiers. */ | |
65 | typedef long int speed_t; | |
66 | ||
67 | /* Terminal control structure. */ | |
68 | struct termios | |
69 | { | |
70 | /* Input modes. */ | |
71 | tcflag_t c_iflag; | |
72 | #define IGNBRK (1 << 0) /* Ignore break condition. */ | |
73 | #define BRKINT (1 << 1) /* Signal interrupt on break. */ | |
74 | #define IGNPAR (1 << 2) /* Ignore characters with parity errors. */ | |
75 | #define PARMRK (1 << 3) /* Mark parity and framing errors. */ | |
76 | #define INPCK (1 << 4) /* Enable input parity check. */ | |
77 | #define ISTRIP (1 << 5) /* Strip 8th bit off characters. */ | |
78 | #define INLCR (1 << 6) /* Map NL to CR on input. */ | |
79 | #define IGNCR (1 << 7) /* Ignore CR. */ | |
80 | #define ICRNL (1 << 8) /* Map CR to NL on input. */ | |
81 | #define IXON (1 << 9) /* Enable start/stop output control. */ | |
82 | #define IXOFF (1 << 10) /* Enable start/stop input control. */ | |
83 | #ifdef __USE_BSD | |
84 | #define IXANY (1 << 11) /* Any character will restart after stop. */ | |
85 | #define IMAXBEL (1 << 13) /* Ring bell when input queue is full. */ | |
86 | #endif | |
87 | ||
88 | /* Output modes. */ | |
89 | tcflag_t c_oflag; | |
90 | #define OPOST (1 << 0) /* Perform output processing. */ | |
91 | #ifdef __USE_BSD | |
f4017d20 UD |
92 | # define ONLCR (1 << 1) /* Map NL to CR-NL on output. */ |
93 | # define OXTABS (1 << 2) /* Expand tabs to spaces. */ | |
94 | # define ONOEOT (1 << 8) /* Discard EOT (^D) on output. */ | |
28f540f4 RM |
95 | #endif |
96 | ||
97 | /* Control modes. */ | |
98 | tcflag_t c_cflag; | |
99 | #ifdef __USE_BSD | |
f4017d20 | 100 | # define CIGNORE (1 << 0) /* Ignore these control flags. */ |
28f540f4 RM |
101 | #endif |
102 | #define CSIZE (CS5|CS6|CS7|CS8) /* Number of bits per byte (mask). */ | |
103 | #define CS5 0 /* 5 bits per byte. */ | |
104 | #define CS6 (1 << 8) /* 6 bits per byte. */ | |
105 | #define CS7 (1 << 9) /* 7 bits per byte. */ | |
106 | #define CS8 (CS6|CS7) /* 8 bits per byte. */ | |
107 | #define CSTOPB (1 << 10) /* Two stop bits instead of one. */ | |
108 | #define CREAD (1 << 11) /* Enable receiver. */ | |
109 | #define PARENB (1 << 12) /* Parity enable. */ | |
110 | #define PARODD (1 << 13) /* Odd parity instead of even. */ | |
111 | #define HUPCL (1 << 14) /* Hang up on last close. */ | |
112 | #define CLOCAL (1 << 15) /* Ignore modem status lines. */ | |
113 | #ifdef __USE_BSD | |
f4017d20 UD |
114 | # define CCTS_OFLOW (1 << 16) /* CTS flow control of output. */ |
115 | # define CRTS_IFLOW (1 << 17) /* RTS flow control of input. */ | |
b7b5a610 | 116 | # define CRTSCTS (CCTS_OFLOW|CRTS_IFLOW) /* CTS/RTS flow control. */ |
f4017d20 | 117 | # define MDMBUF (1 << 20) /* Carrier flow control of output. */ |
28f540f4 RM |
118 | #endif |
119 | ||
120 | /* Local modes. */ | |
121 | tcflag_t c_lflag; | |
122 | #ifdef __USE_BSD | |
f4017d20 | 123 | # define ECHOKE (1 << 0) /* Visual erase for KILL. */ |
28f540f4 RM |
124 | #endif |
125 | #define _ECHOE (1 << 1) /* Visual erase for ERASE. */ | |
126 | #define ECHOE _ECHOE | |
127 | #define _ECHOK (1 << 2) /* Echo NL after KILL. */ | |
128 | #define ECHOK _ECHOK | |
129 | #define _ECHO (1 << 3) /* Enable echo. */ | |
130 | #define ECHO _ECHO | |
131 | #define _ECHONL (1 << 4) /* Echo NL even if ECHO is off. */ | |
132 | #define ECHONL _ECHONL | |
133 | #ifdef __USE_BSD | |
f4017d20 UD |
134 | # define ECHOPRT (1 << 5) /* Hardcopy visual erase. */ |
135 | # define ECHOCTL (1 << 6) /* Echo control characters as ^X. */ | |
28f540f4 RM |
136 | #endif |
137 | #define _ISIG (1 << 7) /* Enable signals. */ | |
138 | #define ISIG _ISIG | |
139 | #define _ICANON (1 << 8) /* Do erase and kill processing. */ | |
140 | #define ICANON _ICANON | |
141 | #ifdef __USE_BSD | |
f4017d20 | 142 | # define ALTWERASE (1 << 9) /* Alternate WERASE algorithm. */ |
28f540f4 RM |
143 | #endif |
144 | #define _IEXTEN (1 << 10) /* Enable DISCARD and LNEXT. */ | |
145 | #define IEXTEN _IEXTEN | |
146 | #define EXTPROC (1 << 11) /* External processing. */ | |
147 | #define _TOSTOP (1 << 22) /* Send SIGTTOU for background output. */ | |
148 | #define TOSTOP _TOSTOP | |
149 | #ifdef __USE_BSD | |
f4017d20 UD |
150 | # define FLUSHO (1 << 23) /* Output being flushed (state). */ |
151 | # define NOKERNINFO (1 << 25) /* Disable VSTATUS. */ | |
152 | # define PENDIN (1 << 29) /* Retype pending input (state). */ | |
28f540f4 RM |
153 | #endif |
154 | #define _NOFLSH (1 << 31) /* Disable flush after interrupt. */ | |
155 | #define NOFLSH _NOFLSH | |
156 | ||
157 | /* Control characters. */ | |
158 | #define VEOF 0 /* End-of-file character [ICANON]. */ | |
159 | #define VEOL 1 /* End-of-line character [ICANON]. */ | |
160 | #ifdef __USE_BSD | |
f4017d20 | 161 | # define VEOL2 2 /* Second EOL character [ICANON]. */ |
28f540f4 RM |
162 | #endif |
163 | #define VERASE 3 /* Erase character [ICANON]. */ | |
164 | #ifdef __USE_BSD | |
f4017d20 | 165 | # define VWERASE 4 /* Word-erase character [ICANON]. */ |
28f540f4 RM |
166 | #endif |
167 | #define VKILL 5 /* Kill-line character [ICANON]. */ | |
168 | #ifdef __USE_BSD | |
f4017d20 | 169 | # define VREPRINT 6 /* Reprint-line character [ICANON]. */ |
28f540f4 RM |
170 | #endif |
171 | #define VINTR 8 /* Interrupt character [ISIG]. */ | |
172 | #define VQUIT 9 /* Quit character [ISIG]. */ | |
173 | #define VSUSP 10 /* Suspend character [ISIG]. */ | |
174 | #ifdef __USE_BSD | |
f4017d20 | 175 | # define VDSUSP 11 /* Delayed suspend character [ISIG]. */ |
28f540f4 RM |
176 | #endif |
177 | #define VSTART 12 /* Start (X-ON) character [IXON, IXOFF]. */ | |
178 | #define VSTOP 13 /* Stop (X-OFF) character [IXON, IXOFF]. */ | |
179 | #ifdef __USE_BSD | |
f4017d20 UD |
180 | # define VLNEXT 14 /* Literal-next character [IEXTEN]. */ |
181 | # define VDISCARD 15 /* Discard character [IEXTEN]. */ | |
28f540f4 RM |
182 | #endif |
183 | #define VMIN 16 /* Minimum number of bytes read at once [!ICANON]. */ | |
184 | #define VTIME 17 /* Time-out value (tenths of a second) [!ICANON]. */ | |
185 | #ifdef __USE_BSD | |
f4017d20 | 186 | # define VSTATUS 18 /* Status character [ICANON]. */ |
28f540f4 RM |
187 | #endif |
188 | #define NCCS 20 /* Value duplicated in <hurd/tioctl.defs>. */ | |
189 | cc_t c_cc[NCCS]; | |
190 | ||
191 | /* Input and output baud rates. */ | |
192 | speed_t __ispeed, __ospeed; | |
193 | #define B0 0 /* Hang up. */ | |
194 | #define B50 50 /* 50 baud. */ | |
195 | #define B75 75 /* 75 baud. */ | |
196 | #define B110 110 /* 110 baud. */ | |
197 | #define B134 134 /* 134.5 baud. */ | |
198 | #define B150 150 /* 150 baud. */ | |
199 | #define B200 200 /* 200 baud. */ | |
200 | #define B300 300 /* 300 baud. */ | |
201 | #define B600 600 /* 600 baud. */ | |
202 | #define B1200 1200 /* 1200 baud. */ | |
203 | #define B1800 1800 /* 1800 baud. */ | |
204 | #define B2400 2400 /* 2400 baud. */ | |
205 | #define B4800 4800 /* 4800 baud. */ | |
206 | #define B9600 9600 /* 9600 baud. */ | |
207 | #define B19200 19200 /* 19200 baud. */ | |
208 | #define B38400 38400 /* 38400 baud. */ | |
209 | #ifdef __USE_BSD | |
f4017d20 UD |
210 | # define EXTA 19200 |
211 | # define EXTB 38400 | |
28f540f4 RM |
212 | #endif |
213 | }; | |
214 | ||
215 | #define _IOT_termios /* Hurd ioctl type field. */ \ | |
216 | _IOT (_IOTS (tcflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) | |
217 | ||
218 | /* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */ | |
219 | #define TCSANOW 0 /* Change immediately. */ | |
220 | #define TCSADRAIN 1 /* Change when pending output is written. */ | |
221 | #define TCSAFLUSH 2 /* Flush pending input before changing. */ | |
222 | #ifdef __USE_BSD | |
f4017d20 | 223 | # define TCSASOFT 0x10 /* Flag: Don't alter hardware state. */ |
28f540f4 RM |
224 | #endif |
225 | ||
226 | /* Values for the QUEUE_SELECTOR argument to `tcflush'. */ | |
227 | #define TCIFLUSH 1 /* Discard data received but not yet read. */ | |
228 | #define TCOFLUSH 2 /* Discard data written but not yet sent. */ | |
229 | #define TCIOFLUSH 3 /* Discard all pending data. */ | |
230 | ||
231 | /* Values for the ACTION argument to `tcflow'. */ | |
232 | #define TCOOFF 1 /* Suspend output. */ | |
233 | #define TCOON 2 /* Restart suspended output. */ | |
234 | #define TCIOFF 3 /* Send a STOP character. */ | |
235 | #define TCION 4 /* Send a START character. */ |