]>
Commit | Line | Data |
---|---|---|
28f540f4 | 1 | /* termios type and macro definitions. 4.4 BSD/generic GNU version. |
15c64502 | 2 | Copyright (C) 1993,94,96,97,99,2001 Free Software Foundation, Inc. |
54d79e99 | 3 | This file is part of the GNU C Library. |
28f540f4 | 4 | |
54d79e99 | 5 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the 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 | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
28f540f4 | 14 | |
41bdb6e2 AJ |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library; if not, write to the Free | |
17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
18 | 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. */ | |
45d5ac9c RM |
27 | #if defined __USE_MISC || defined __USE_XOPEN |
28 | ||
29 | # ifdef NL0 | |
30 | # undef NL0 | |
31 | # endif | |
32 | # ifdef NL1 | |
33 | # undef NL1 | |
34 | # endif | |
35 | # ifdef TAB0 | |
36 | # undef TAB0 | |
37 | # endif | |
38 | # ifdef TAB1 | |
39 | # undef TAB1 | |
40 | # endif | |
41 | # ifdef TAB2 | |
42 | # undef TAB2 | |
43 | # endif | |
44 | # ifdef CR0 | |
45 | # undef CR0 | |
46 | # endif | |
47 | # ifdef CR1 | |
48 | # undef CR1 | |
49 | # endif | |
50 | # ifdef CR2 | |
51 | # undef CR2 | |
52 | # endif | |
53 | # ifdef CR3 | |
54 | # undef CR3 | |
55 | # endif | |
56 | # ifdef FF0 | |
57 | # undef FF0 | |
58 | # endif | |
59 | # ifdef FF1 | |
60 | # undef FF1 | |
61 | # endif | |
62 | # ifdef BS0 | |
63 | # undef BS0 | |
64 | # endif | |
65 | # ifdef BS1 | |
66 | # undef BS1 | |
67 | # endif | |
68 | ||
69 | #endif /* __USE_MISC || __USE_XOPEN */ | |
70 | ||
18c75117 TBB |
71 | #ifdef __USE_BSD |
72 | ||
f4017d20 UD |
73 | # ifdef MDMBUF |
74 | # undef MDMBUF | |
75 | # endif | |
76 | # ifdef FLUSHO | |
77 | # undef FLUSHO | |
78 | # endif | |
79 | # ifdef PENDIN | |
80 | # undef PENDIN | |
81 | # endif | |
18c75117 TBB |
82 | |
83 | #endif /* __USE_BSD */ | |
84 | ||
85 | #ifdef ECHO | |
f4017d20 | 86 | # undef ECHO |
18c75117 TBB |
87 | #endif |
88 | #ifdef TOSTOP | |
f4017d20 | 89 | # undef TOSTOP |
18c75117 TBB |
90 | #endif |
91 | #ifdef NOFLSH | |
f4017d20 | 92 | # undef NOFLSH |
18c75117 TBB |
93 | #endif |
94 | ||
95 | ||
28f540f4 RM |
96 | /* These definitions match those used by the 4.4 BSD kernel. |
97 | If the operating system has termios system calls or ioctls that | |
98 | correctly implement the POSIX.1 behavior, there should be a | |
99 | system-dependent version of this file that defines `struct termios', | |
100 | `tcflag_t', `cc_t', `speed_t' and the `TC*' constants appropriately. */ | |
101 | ||
102 | /* Type of terminal control flag masks. */ | |
103 | typedef unsigned long int tcflag_t; | |
104 | ||
105 | /* Type of control characters. */ | |
106 | typedef unsigned char cc_t; | |
107 | ||
108 | /* Type of baud rate specifiers. */ | |
109 | typedef long int speed_t; | |
110 | ||
111 | /* Terminal control structure. */ | |
112 | struct termios | |
113 | { | |
114 | /* Input modes. */ | |
115 | tcflag_t c_iflag; | |
116 | #define IGNBRK (1 << 0) /* Ignore break condition. */ | |
117 | #define BRKINT (1 << 1) /* Signal interrupt on break. */ | |
118 | #define IGNPAR (1 << 2) /* Ignore characters with parity errors. */ | |
119 | #define PARMRK (1 << 3) /* Mark parity and framing errors. */ | |
120 | #define INPCK (1 << 4) /* Enable input parity check. */ | |
121 | #define ISTRIP (1 << 5) /* Strip 8th bit off characters. */ | |
122 | #define INLCR (1 << 6) /* Map NL to CR on input. */ | |
123 | #define IGNCR (1 << 7) /* Ignore CR. */ | |
124 | #define ICRNL (1 << 8) /* Map CR to NL on input. */ | |
125 | #define IXON (1 << 9) /* Enable start/stop output control. */ | |
126 | #define IXOFF (1 << 10) /* Enable start/stop input control. */ | |
127 | #ifdef __USE_BSD | |
5f0b70fe RM |
128 | # define IXANY (1 << 11) /* Any character will restart after stop. */ |
129 | # define IMAXBEL (1 << 13) /* Ring bell when input queue is full. */ | |
130 | #endif | |
131 | #ifdef __USE_GNU | |
132 | # define IUCLC (1 << 14) /* Translate upper case input to lower case. */ | |
28f540f4 RM |
133 | #endif |
134 | ||
135 | /* Output modes. */ | |
136 | tcflag_t c_oflag; | |
137 | #define OPOST (1 << 0) /* Perform output processing. */ | |
138 | #ifdef __USE_BSD | |
f4017d20 | 139 | # define ONLCR (1 << 1) /* Map NL to CR-NL on output. */ |
45d5ac9c | 140 | # define OXTABS TAB3 /* Expand tabs to spaces. */ |
5f0b70fe RM |
141 | # define ONOEOT (1 << 3) /* Discard EOT (^D) on output. */ |
142 | #endif | |
45d5ac9c RM |
143 | #if defined __USE_BSD || defined __USE_XOPEN |
144 | # define OCRNL (1 << 4) /* Map CR to NL. */ | |
145 | # define ONOCR (1 << 5) /* Discard CR's when on column 0. */ | |
146 | # define ONLRET (1 << 6) /* Move to column 0 on NL. */ | |
147 | #endif | |
148 | #if defined __USE_MISC || defined __USE_XOPEN | |
149 | # define NLDLY (3 << 8) /* NL delay. */ | |
150 | # define NL0 (0 << 8) /* NL type 0. */ | |
151 | # define NL1 (1 << 8) /* NL type 1. */ | |
152 | # define TABDLY (3 << 10) /* TAB delay. */ | |
153 | # define TAB0 (0 << 10) /* TAB delay type 0. */ | |
154 | # define TAB1 (1 << 10) /* TAB delay type 1. */ | |
155 | # define TAB2 (2 << 10) /* TAB delay type 2. */ | |
156 | # define TAB3 (1 << 2) /* Expand tabs to spaces. */ | |
157 | # define CRDLY (3 << 12) /* CR delay. */ | |
158 | # define CR0 (0 << 12) /* CR delay type 0. */ | |
159 | # define CR1 (1 << 12) /* CR delay type 1. */ | |
160 | # define CR2 (2 << 12) /* CR delay type 2. */ | |
161 | # define CR3 (3 << 12) /* CR delay type 3. */ | |
162 | # define FFDLY (1 << 14) /* FF delay. */ | |
163 | # define FF0 (0 << 14) /* FF delay type 0. */ | |
164 | # define FF1 (1 << 14) /* FF delay type 1. */ | |
165 | # define BSDLY (1 << 15) /* BS delay. */ | |
166 | # define BS0 (0 << 15) /* BS delay type 0. */ | |
167 | # define BS1 (1 << 15) /* BS delay type 1. */ | |
168 | # define VTDLY (1 << 16) /* VT delay. */ | |
169 | # define VT0 (0 << 16) /* VT delay type 0. */ | |
170 | # define VT1 (1 << 16) /* VT delay type 1. */ | |
171 | #endif /* __USE_MISC || __USE_XOPEN */ | |
5f0b70fe | 172 | #ifdef __USE_GNU |
45d5ac9c RM |
173 | # define OLCUC (1 << 17) /* Translate lower case output to upper case */ |
174 | #endif | |
175 | #ifdef __USE_XOPEN | |
176 | # define OFILL (1 << 18) /* Send fill characters for delays. */ | |
28f540f4 RM |
177 | #endif |
178 | ||
179 | /* Control modes. */ | |
180 | tcflag_t c_cflag; | |
181 | #ifdef __USE_BSD | |
f4017d20 | 182 | # define CIGNORE (1 << 0) /* Ignore these control flags. */ |
28f540f4 RM |
183 | #endif |
184 | #define CSIZE (CS5|CS6|CS7|CS8) /* Number of bits per byte (mask). */ | |
185 | #define CS5 0 /* 5 bits per byte. */ | |
186 | #define CS6 (1 << 8) /* 6 bits per byte. */ | |
187 | #define CS7 (1 << 9) /* 7 bits per byte. */ | |
188 | #define CS8 (CS6|CS7) /* 8 bits per byte. */ | |
189 | #define CSTOPB (1 << 10) /* Two stop bits instead of one. */ | |
190 | #define CREAD (1 << 11) /* Enable receiver. */ | |
191 | #define PARENB (1 << 12) /* Parity enable. */ | |
192 | #define PARODD (1 << 13) /* Odd parity instead of even. */ | |
193 | #define HUPCL (1 << 14) /* Hang up on last close. */ | |
194 | #define CLOCAL (1 << 15) /* Ignore modem status lines. */ | |
195 | #ifdef __USE_BSD | |
45d5ac9c RM |
196 | # define CRTSCTS (1 << 16) /* RTS/CTS flow control. */ |
197 | # define CRTS_IFLOW CRTSCTS /* Compatibility. */ | |
198 | # define CCTS_OFLOW CRTSCTS /* Compatibility. */ | |
199 | # define CDTRCTS (1 << 17) /* DTR/CTS flow control. */ | |
200 | # define MDMBUF (1 << 20) /* DTR/DCD flow control. */ | |
201 | # define CHWFLOW (MDMBUF|CRTSCTS|CDTRCTS) /* All types of flow control. */ | |
28f540f4 RM |
202 | #endif |
203 | ||
204 | /* Local modes. */ | |
205 | tcflag_t c_lflag; | |
206 | #ifdef __USE_BSD | |
f4017d20 | 207 | # define ECHOKE (1 << 0) /* Visual erase for KILL. */ |
28f540f4 RM |
208 | #endif |
209 | #define _ECHOE (1 << 1) /* Visual erase for ERASE. */ | |
210 | #define ECHOE _ECHOE | |
211 | #define _ECHOK (1 << 2) /* Echo NL after KILL. */ | |
212 | #define ECHOK _ECHOK | |
213 | #define _ECHO (1 << 3) /* Enable echo. */ | |
214 | #define ECHO _ECHO | |
215 | #define _ECHONL (1 << 4) /* Echo NL even if ECHO is off. */ | |
216 | #define ECHONL _ECHONL | |
217 | #ifdef __USE_BSD | |
f4017d20 UD |
218 | # define ECHOPRT (1 << 5) /* Hardcopy visual erase. */ |
219 | # define ECHOCTL (1 << 6) /* Echo control characters as ^X. */ | |
28f540f4 RM |
220 | #endif |
221 | #define _ISIG (1 << 7) /* Enable signals. */ | |
222 | #define ISIG _ISIG | |
223 | #define _ICANON (1 << 8) /* Do erase and kill processing. */ | |
224 | #define ICANON _ICANON | |
225 | #ifdef __USE_BSD | |
f4017d20 | 226 | # define ALTWERASE (1 << 9) /* Alternate WERASE algorithm. */ |
28f540f4 RM |
227 | #endif |
228 | #define _IEXTEN (1 << 10) /* Enable DISCARD and LNEXT. */ | |
229 | #define IEXTEN _IEXTEN | |
230 | #define EXTPROC (1 << 11) /* External processing. */ | |
231 | #define _TOSTOP (1 << 22) /* Send SIGTTOU for background output. */ | |
232 | #define TOSTOP _TOSTOP | |
233 | #ifdef __USE_BSD | |
f4017d20 UD |
234 | # define FLUSHO (1 << 23) /* Output being flushed (state). */ |
235 | # define NOKERNINFO (1 << 25) /* Disable VSTATUS. */ | |
236 | # define PENDIN (1 << 29) /* Retype pending input (state). */ | |
28f540f4 RM |
237 | #endif |
238 | #define _NOFLSH (1 << 31) /* Disable flush after interrupt. */ | |
239 | #define NOFLSH _NOFLSH | |
240 | ||
241 | /* Control characters. */ | |
242 | #define VEOF 0 /* End-of-file character [ICANON]. */ | |
243 | #define VEOL 1 /* End-of-line character [ICANON]. */ | |
244 | #ifdef __USE_BSD | |
f4017d20 | 245 | # define VEOL2 2 /* Second EOL character [ICANON]. */ |
28f540f4 RM |
246 | #endif |
247 | #define VERASE 3 /* Erase character [ICANON]. */ | |
248 | #ifdef __USE_BSD | |
f4017d20 | 249 | # define VWERASE 4 /* Word-erase character [ICANON]. */ |
28f540f4 RM |
250 | #endif |
251 | #define VKILL 5 /* Kill-line character [ICANON]. */ | |
252 | #ifdef __USE_BSD | |
f4017d20 | 253 | # define VREPRINT 6 /* Reprint-line character [ICANON]. */ |
28f540f4 RM |
254 | #endif |
255 | #define VINTR 8 /* Interrupt character [ISIG]. */ | |
256 | #define VQUIT 9 /* Quit character [ISIG]. */ | |
257 | #define VSUSP 10 /* Suspend character [ISIG]. */ | |
258 | #ifdef __USE_BSD | |
f4017d20 | 259 | # define VDSUSP 11 /* Delayed suspend character [ISIG]. */ |
28f540f4 RM |
260 | #endif |
261 | #define VSTART 12 /* Start (X-ON) character [IXON, IXOFF]. */ | |
262 | #define VSTOP 13 /* Stop (X-OFF) character [IXON, IXOFF]. */ | |
263 | #ifdef __USE_BSD | |
f4017d20 UD |
264 | # define VLNEXT 14 /* Literal-next character [IEXTEN]. */ |
265 | # define VDISCARD 15 /* Discard character [IEXTEN]. */ | |
28f540f4 RM |
266 | #endif |
267 | #define VMIN 16 /* Minimum number of bytes read at once [!ICANON]. */ | |
268 | #define VTIME 17 /* Time-out value (tenths of a second) [!ICANON]. */ | |
269 | #ifdef __USE_BSD | |
f4017d20 | 270 | # define VSTATUS 18 /* Status character [ICANON]. */ |
28f540f4 RM |
271 | #endif |
272 | #define NCCS 20 /* Value duplicated in <hurd/tioctl.defs>. */ | |
273 | cc_t c_cc[NCCS]; | |
274 | ||
275 | /* Input and output baud rates. */ | |
276 | speed_t __ispeed, __ospeed; | |
277 | #define B0 0 /* Hang up. */ | |
278 | #define B50 50 /* 50 baud. */ | |
279 | #define B75 75 /* 75 baud. */ | |
280 | #define B110 110 /* 110 baud. */ | |
281 | #define B134 134 /* 134.5 baud. */ | |
282 | #define B150 150 /* 150 baud. */ | |
283 | #define B200 200 /* 200 baud. */ | |
284 | #define B300 300 /* 300 baud. */ | |
285 | #define B600 600 /* 600 baud. */ | |
286 | #define B1200 1200 /* 1200 baud. */ | |
287 | #define B1800 1800 /* 1800 baud. */ | |
288 | #define B2400 2400 /* 2400 baud. */ | |
289 | #define B4800 4800 /* 4800 baud. */ | |
290 | #define B9600 9600 /* 9600 baud. */ | |
45d5ac9c RM |
291 | #define B7200 7200 /* 7200 baud. */ |
292 | #define B14400 14400 /* 14400 baud. */ | |
28f540f4 | 293 | #define B19200 19200 /* 19200 baud. */ |
45d5ac9c | 294 | #define B28800 28800 /* 28800 baud. */ |
28f540f4 | 295 | #define B38400 38400 /* 38400 baud. */ |
15c64502 | 296 | #ifdef __USE_MISC |
f4017d20 UD |
297 | # define EXTA 19200 |
298 | # define EXTB 38400 | |
28f540f4 | 299 | #endif |
15c64502 | 300 | #define B57600 57600 |
45d5ac9c | 301 | #define B76800 76800 |
15c64502 RM |
302 | #define B115200 115200 |
303 | #define B230400 230400 | |
304 | #define B460800 460800 | |
305 | #define B500000 500000 | |
306 | #define B576000 576000 | |
307 | #define B921600 921600 | |
308 | #define B1000000 1000000 | |
309 | #define B1152000 1152000 | |
310 | #define B1500000 1500000 | |
311 | #define B2000000 2000000 | |
312 | #define B2500000 2500000 | |
313 | #define B3000000 3000000 | |
314 | #define B3500000 3500000 | |
315 | #define B4000000 4000000 | |
28f540f4 RM |
316 | }; |
317 | ||
318 | #define _IOT_termios /* Hurd ioctl type field. */ \ | |
319 | _IOT (_IOTS (tcflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) | |
320 | ||
321 | /* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */ | |
322 | #define TCSANOW 0 /* Change immediately. */ | |
323 | #define TCSADRAIN 1 /* Change when pending output is written. */ | |
324 | #define TCSAFLUSH 2 /* Flush pending input before changing. */ | |
325 | #ifdef __USE_BSD | |
f4017d20 | 326 | # define TCSASOFT 0x10 /* Flag: Don't alter hardware state. */ |
28f540f4 RM |
327 | #endif |
328 | ||
329 | /* Values for the QUEUE_SELECTOR argument to `tcflush'. */ | |
330 | #define TCIFLUSH 1 /* Discard data received but not yet read. */ | |
331 | #define TCOFLUSH 2 /* Discard data written but not yet sent. */ | |
332 | #define TCIOFLUSH 3 /* Discard all pending data. */ | |
333 | ||
334 | /* Values for the ACTION argument to `tcflow'. */ | |
335 | #define TCOOFF 1 /* Suspend output. */ | |
336 | #define TCOON 2 /* Restart suspended output. */ | |
337 | #define TCIOFF 3 /* Send a STOP character. */ | |
338 | #define TCION 4 /* Send a START character. */ |