]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (c) 1993 Michael Haardt |
2 | .\" (michael@moria.de) | |
3 | .\" Fri Apr 2 11:32:09 MET DST 1993 | |
4 | .\" | |
1dd72f9c | 5 | .\" %%%LICENSE_START(GPLv2+_DOC_FULL) |
fea681da MK |
6 | .\" This is free documentation; you can redistribute it and/or |
7 | .\" modify it under the terms of the GNU General Public License as | |
8 | .\" published by the Free Software Foundation; either version 2 of | |
9 | .\" the License, or (at your option) any later version. | |
10 | .\" | |
11 | .\" The GNU General Public License's references to "object code" | |
12 | .\" and "executables" are to be interpreted as the output of any | |
13 | .\" document formatting or typesetting system, including | |
14 | .\" intermediate and printed output. | |
15 | .\" | |
16 | .\" This manual is distributed in the hope that it will be useful, | |
17 | .\" but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | .\" GNU General Public License for more details. | |
20 | .\" | |
21 | .\" You should have received a copy of the GNU General Public | |
c715f741 MK |
22 | .\" License along with this manual; if not, see |
23 | .\" <http://www.gnu.org/licenses/>. | |
6a8d8745 | 24 | .\" %%%LICENSE_END |
fea681da MK |
25 | .\" |
26 | .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu> | |
27 | .\" Modified 1995-02-25 by Jim Van Zandt <jrv@vanzandt.mv.com> | |
28 | .\" Modified 1995-09-02 by Jim Van Zandt <jrv@vanzandt.mv.com> | |
29 | .\" moved to man3, aeb, 950919 | |
c11b1abf | 30 | .\" Modified 2001-09-22 by Michael Kerrisk <mtk.manpages@gmail.com> |
fea681da MK |
31 | .\" Modified 2001-12-17, aeb |
32 | .\" Modified 2004-10-31, aeb | |
19ab0376 MK |
33 | .\" 2006-12-28, mtk: |
34 | .\" Added .SS headers to give some structure to this page; and a | |
35 | .\" small amount of reordering. | |
a6712802 | 36 | .\" Added a section on canonical and noncanonical mode. |
19ab0376 MK |
37 | .\" Enhanced the discussion of "raw" mode for cfmakeraw(). |
38 | .\" Document CMSPAR. | |
fea681da | 39 | .\" |
4b8c67d9 | 40 | .TH TERMIOS 3 2017-09-15 "Linux" "Linux Programmer's Manual" |
fea681da MK |
41 | .SH NAME |
42 | termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow, | |
43 | cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed, cfsetspeed \- | |
44 | get and set terminal attributes, line control, get and set baud rate | |
45 | .SH SYNOPSIS | |
04bb6cc0 | 46 | .nf |
c91e381d | 47 | .B #include <termios.h> |
c91e381d | 48 | .B #include <unistd.h> |
68e4db0a | 49 | .PP |
fea681da | 50 | .BI "int tcgetattr(int " fd ", struct termios *" termios_p ); |
68e4db0a | 51 | .PP |
04bb6cc0 MK |
52 | .BI "int tcsetattr(int " fd ", int " optional_actions , |
53 | .BI " const struct termios *" termios_p ); | |
68e4db0a | 54 | .PP |
fea681da | 55 | .BI "int tcsendbreak(int " fd ", int " duration ); |
68e4db0a | 56 | .PP |
fea681da | 57 | .BI "int tcdrain(int " fd ); |
68e4db0a | 58 | .PP |
fea681da | 59 | .BI "int tcflush(int " fd ", int " queue_selector ); |
68e4db0a | 60 | .PP |
fea681da | 61 | .BI "int tcflow(int " fd ", int " action ); |
68e4db0a | 62 | .PP |
fea681da | 63 | .BI "void cfmakeraw(struct termios *" termios_p ); |
68e4db0a | 64 | .PP |
fea681da | 65 | .BI "speed_t cfgetispeed(const struct termios *" termios_p ); |
68e4db0a | 66 | .PP |
fea681da | 67 | .BI "speed_t cfgetospeed(const struct termios *" termios_p ); |
68e4db0a | 68 | .PP |
fea681da | 69 | .BI "int cfsetispeed(struct termios *" termios_p ", speed_t " speed ); |
68e4db0a | 70 | .PP |
fea681da | 71 | .BI "int cfsetospeed(struct termios *" termios_p ", speed_t " speed ); |
68e4db0a | 72 | .PP |
52dab97a | 73 | .BI "int cfsetspeed(struct termios *" termios_p ", speed_t " speed ); |
04bb6cc0 | 74 | .fi |
68e4db0a | 75 | .PP |
cc4615cc MK |
76 | .in -4n |
77 | Feature Test Macro Requirements for glibc (see | |
78 | .BR feature_test_macros (7)): | |
79 | .in | |
68e4db0a | 80 | .PP |
cc4615cc MK |
81 | .BR cfsetspeed (), |
82 | .BR cfmakeraw (): | |
51c612fb MK |
83 | Since glibc 2.19: |
84 | _DEFAULT_SOURCE | |
85 | Glibc 2.19 and earlier: | |
86 | _BSD_SOURCE | |
fea681da MK |
87 | .SH DESCRIPTION |
88 | The termios functions describe a general terminal interface that is | |
89 | provided to control asynchronous communications ports. | |
73d8cece | 90 | .SS The termios structure |
dd3568a1 | 91 | .PP |
fea681da | 92 | Many of the functions described here have a \fItermios_p\fP argument |
c13182ef MK |
93 | that is a pointer to a \fItermios\fP structure. |
94 | This structure contains at least the following members: | |
51f5698d | 95 | .PP |
a6e2f128 | 96 | .in +4n |
bdd915e2 | 97 | .EX |
bd9b2a9c MK |
98 | tcflag_t c_iflag; /* input modes */ |
99 | tcflag_t c_oflag; /* output modes */ | |
100 | tcflag_t c_cflag; /* control modes */ | |
101 | tcflag_t c_lflag; /* local modes */ | |
d8b24e6e | 102 | cc_t c_cc[NCCS]; /* special characters */ |
bdd915e2 | 103 | .EE |
a6e2f128 | 104 | .in |
fea681da | 105 | .PP |
869ebe5b | 106 | The values that may be assigned to these fields are described below. |
c13182ef MK |
107 | In the case of the first four bit-mask fields, |
108 | the definitions of some of the associated flags that may be set are | |
33a0ccb2 | 109 | exposed only if a specific feature test macro (see |
a8e7c990 | 110 | .BR feature_test_macros (7)) |
869ebe5b MK |
111 | is defined, as noted in brackets ("[]"). |
112 | .PP | |
42b09930 | 113 | In the descriptions below, "not in POSIX" means that the |
c13182ef MK |
114 | value is not specified in POSIX.1-2001, |
115 | and "XSI" means that the value is specified in POSIX.1-2001 | |
42b09930 MK |
116 | as part of the XSI extension. |
117 | .PP | |
fea681da MK |
118 | \fIc_iflag\fP flag constants: |
119 | .TP | |
120 | .B IGNBRK | |
121 | Ignore BREAK condition on input. | |
122 | .TP | |
123 | .B BRKINT | |
c13182ef MK |
124 | If \fBIGNBRK\fP is set, a BREAK is ignored. |
125 | If it is not set | |
fea681da MK |
126 | but \fBBRKINT\fP is set, then a BREAK causes the input and output |
127 | queues to be flushed, and if the terminal is the controlling | |
128 | terminal of a foreground process group, it will cause a | |
129 | \fBSIGINT\fP to be sent to this foreground process group. | |
130 | When neither \fBIGNBRK\fP nor \fBBRKINT\fP are set, a BREAK | |
f81fb444 | 131 | reads as a null byte (\(aq\\0\(aq), except when \fBPARMRK\fP is set, |
fea681da MK |
132 | in which case it reads as the sequence \\377 \\0 \\0. |
133 | .TP | |
134 | .B IGNPAR | |
135 | Ignore framing errors and parity errors. | |
136 | .TP | |
137 | .B PARMRK | |
2d7c8f1f | 138 | If this bit is set, input bytes with parity or framing errors are |
a0262e27 MK |
139 | marked when passed to the program. |
140 | This bit is meaningful only when | |
2d7c8f1f OT |
141 | \fBINPCK\fP is set and \fBIGNPAR\fP is not set. |
142 | The way erroneous bytes are marked is with two preceding bytes, | |
a0262e27 MK |
143 | \\377 and \\0. |
144 | Thus, the program actually reads three bytes for one | |
2d7c8f1f | 145 | erroneous byte received from the terminal. |
a0262e27 MK |
146 | If a valid byte has the value \\377, |
147 | and \fBISTRIP\fP (see below) is not set, | |
148 | the program might confuse it with the prefix that marks a | |
149 | parity error. | |
150 | Therefore, a valid byte \\377 is passed to the program as two | |
2d7c8f1f | 151 | bytes, \\377 \\377, in this case. |
847e0d88 | 152 | .IP |
c13182ef | 153 | If neither \fBIGNPAR\fP nor \fBPARMRK\fP |
fea681da MK |
154 | is set, read a character with a parity error or framing error |
155 | as \\0. | |
156 | .TP | |
157 | .B INPCK | |
158 | Enable input parity checking. | |
159 | .TP | |
160 | .B ISTRIP | |
161 | Strip off eighth bit. | |
162 | .TP | |
163 | .B INLCR | |
164 | Translate NL to CR on input. | |
165 | .TP | |
166 | .B IGNCR | |
167 | Ignore carriage return on input. | |
168 | .TP | |
169 | .B ICRNL | |
170 | Translate carriage return to newline on input (unless \fBIGNCR\fP is set). | |
171 | .TP | |
172 | .B IUCLC | |
173 | (not in POSIX) Map uppercase characters to lowercase on input. | |
174 | .TP | |
175 | .B IXON | |
176 | Enable XON/XOFF flow control on output. | |
177 | .TP | |
178 | .B IXANY | |
c13182ef | 179 | (XSI) Typing any character will restart stopped output. |
42b09930 | 180 | (The default is to allow just the START character to restart output.) |
fea681da MK |
181 | .TP |
182 | .B IXOFF | |
183 | Enable XON/XOFF flow control on input. | |
184 | .TP | |
185 | .B IMAXBEL | |
186 | (not in POSIX) Ring bell when input queue is full. | |
187 | Linux does not implement this bit, and acts as if it is always set. | |
225c76e9 MK |
188 | .TP |
189 | .BR IUTF8 " (since Linux 2.6.4)" | |
c13182ef | 190 | (not in POSIX) Input is UTF8; |
225c76e9 | 191 | this allows character-erase to be correctly performed in cooked mode. |
fea681da | 192 | .PP |
73da3537 MK |
193 | .I c_oflag |
194 | flag constants: | |
fea681da MK |
195 | .TP |
196 | .B OPOST | |
197 | Enable implementation-defined output processing. | |
fea681da MK |
198 | .TP |
199 | .B OLCUC | |
200 | (not in POSIX) Map lowercase characters to uppercase on output. | |
201 | .TP | |
202 | .B ONLCR | |
203 | (XSI) Map NL to CR-NL on output. | |
204 | .TP | |
205 | .B OCRNL | |
206 | Map CR to NL on output. | |
207 | .TP | |
208 | .B ONOCR | |
209 | Don't output CR at column 0. | |
210 | .TP | |
211 | .B ONLRET | |
212 | Don't output CR. | |
213 | .TP | |
214 | .B OFILL | |
215 | Send fill characters for a delay, rather than using a timed delay. | |
216 | .TP | |
217 | .B OFDEL | |
ffcffad6 | 218 | Fill character is ASCII DEL (0177). |
f81fb444 | 219 | If unset, fill character is ASCII NUL (\(aq\\0\(aq). |
42b09930 | 220 | (Not implemented on Linux.) |
fea681da MK |
221 | .TP |
222 | .B NLDLY | |
c13182ef MK |
223 | Newline delay mask. |
224 | Values are \fBNL0\fP and \fBNL1\fP. | |
db4e96b7 MK |
225 | [requires |
226 | .B _BSD_SOURCE | |
227 | or | |
228 | .B _SVID_SOURCE | |
c90511a6 MK |
229 | or |
230 | .BR _XOPEN_SOURCE ] | |
fea681da MK |
231 | .TP |
232 | .B CRDLY | |
233 | Carriage return delay mask. | |
234 | Values are \fBCR0\fP, \fBCR1\fP, \fBCR2\fP, or \fBCR3\fP. | |
db4e96b7 MK |
235 | [requires |
236 | .B _BSD_SOURCE | |
237 | or | |
238 | .B _SVID_SOURCE | |
c90511a6 MK |
239 | or |
240 | .BR _XOPEN_SOURCE ] | |
fea681da MK |
241 | .TP |
242 | .B TABDLY | |
243 | Horizontal tab delay mask. | |
499eb81f ES |
244 | Values are \fBTAB0\fP, \fBTAB1\fP, \fBTAB2\fP, \fBTAB3\fP (or \fBXTABS\fP, |
245 | but see the | |
246 | .B BUGS | |
247 | section). | |
fea681da MK |
248 | A value of TAB3, that is, XTABS, expands tabs to spaces |
249 | (with tab stops every eight columns). | |
db4e96b7 MK |
250 | [requires |
251 | .B _BSD_SOURCE | |
252 | or | |
253 | .B _SVID_SOURCE | |
c90511a6 MK |
254 | or |
255 | .BR _XOPEN_SOURCE ] | |
fea681da MK |
256 | .TP |
257 | .B BSDLY | |
c13182ef MK |
258 | Backspace delay mask. |
259 | Values are \fBBS0\fP or \fBBS1\fP. | |
fea681da | 260 | (Has never been implemented.) |
db4e96b7 MK |
261 | [requires |
262 | .B _BSD_SOURCE | |
263 | or | |
264 | .B _SVID_SOURCE | |
c90511a6 MK |
265 | or |
266 | .BR _XOPEN_SOURCE ] | |
fea681da MK |
267 | .TP |
268 | .B VTDLY | |
c13182ef MK |
269 | Vertical tab delay mask. |
270 | Values are \fBVT0\fP or \fBVT1\fP. | |
fea681da MK |
271 | .TP |
272 | .B FFDLY | |
c13182ef MK |
273 | Form feed delay mask. |
274 | Values are \fBFF0\fP or \fBFF1\fP. | |
db4e96b7 MK |
275 | [requires |
276 | .B _BSD_SOURCE | |
277 | or | |
278 | .B _SVID_SOURCE | |
c90511a6 MK |
279 | or |
280 | .BR _XOPEN_SOURCE ] | |
fea681da MK |
281 | .PP |
282 | \fIc_cflag\fP flag constants: | |
283 | .TP | |
284 | .B CBAUD | |
285 | (not in POSIX) Baud speed mask (4+1 bits). | |
db4e96b7 MK |
286 | [requires |
287 | .B _BSD_SOURCE | |
c90511a6 MK |
288 | or |
289 | .BR _SVID_SOURCE ] | |
fea681da MK |
290 | .TP |
291 | .B CBAUDEX | |
097585ed MK |
292 | (not in POSIX) Extra baud speed mask (1 bit), included in |
293 | .BR CBAUD . | |
db4e96b7 MK |
294 | [requires |
295 | .B _BSD_SOURCE | |
c90511a6 MK |
296 | or |
297 | .BR _SVID_SOURCE ] | |
bdd915e2 | 298 | .IP |
c13182ef MK |
299 | (POSIX says that the baud speed is stored in the |
300 | .I termios | |
42b09930 | 301 | structure without specifying where precisely, and provides |
63aa9df0 | 302 | .BR cfgetispeed () |
fea681da | 303 | and |
63aa9df0 | 304 | .BR cfsetispeed () |
c13182ef | 305 | for getting at it. |
097585ed MK |
306 | Some systems use bits selected by |
307 | .B CBAUD | |
308 | in | |
fea681da | 309 | .IR c_cflag , |
75b94dc3 | 310 | other systems use separate fields, for example, |
fea681da MK |
311 | .I sg_ispeed |
312 | and | |
313 | .IR sg_ospeed .) | |
314 | .TP | |
315 | .B CSIZE | |
316 | Character size mask. | |
317 | Values are \fBCS5\fP, \fBCS6\fP, \fBCS7\fP, or \fBCS8\fP. | |
318 | .TP | |
319 | .B CSTOPB | |
320 | Set two stop bits, rather than one. | |
321 | .TP | |
322 | .B CREAD | |
323 | Enable receiver. | |
324 | .TP | |
325 | .B PARENB | |
326 | Enable parity generation on output and parity checking for input. | |
327 | .TP | |
328 | .B PARODD | |
c13182ef | 329 | If set, then parity for input and output is odd; |
19ab0376 | 330 | otherwise even parity is used. |
fea681da MK |
331 | .TP |
332 | .B HUPCL | |
333 | Lower modem control lines after last process closes the device (hang up). | |
334 | .TP | |
335 | .B CLOCAL | |
336 | Ignore modem control lines. | |
337 | .TP | |
338 | .B LOBLK | |
24b74457 | 339 | (not in POSIX) Block output from a noncurrent shell layer. |
42b09930 | 340 | For use by \fBshl\fP (shell layers). (Not implemented on Linux.) |
fea681da MK |
341 | .TP |
342 | .B CIBAUD | |
4a837837 | 343 | (not in POSIX) Mask for input speeds. |
097585ed MK |
344 | The values for the |
345 | .B CIBAUD | |
346 | bits are | |
347 | the same as the values for the | |
348 | .B CBAUD | |
349 | bits, shifted left | |
350 | .B IBSHIFT | |
351 | bits. | |
db4e96b7 MK |
352 | [requires |
353 | .B _BSD_SOURCE | |
c90511a6 MK |
354 | or |
355 | .BR _SVID_SOURCE ] | |
42b09930 | 356 | (Not implemented on Linux.) |
fea681da | 357 | .TP |
adab6032 | 358 | .B CMSPAR |
ad715af9 | 359 | (not in POSIX) |
c13182ef | 360 | Use "stick" (mark/space) parity (supported on certain serial |
4a837837 | 361 | devices): if |
c13182ef | 362 | .B PARODD |
adab6032 | 363 | is set, the parity bit is always 1; if |
c13182ef | 364 | .B PARODD |
69ef1f65 | 365 | is not set, then the parity bit is always 0. |
db4e96b7 MK |
366 | [requires |
367 | .B _BSD_SOURCE | |
c90511a6 MK |
368 | or |
369 | .BR _SVID_SOURCE ] | |
adab6032 | 370 | .TP |
fea681da MK |
371 | .B CRTSCTS |
372 | (not in POSIX) Enable RTS/CTS (hardware) flow control. | |
db4e96b7 MK |
373 | [requires |
374 | .B _BSD_SOURCE | |
c90511a6 MK |
375 | or |
376 | .BR _SVID_SOURCE ] | |
fea681da MK |
377 | .PP |
378 | \fIc_lflag\fP flag constants: | |
379 | .TP | |
380 | .B ISIG | |
381 | When any of the characters INTR, QUIT, SUSP, or DSUSP are received, | |
382 | generate the corresponding signal. | |
383 | .TP | |
384 | .B ICANON | |
c13182ef | 385 | Enable canonical mode (described below). |
fea681da MK |
386 | .TP |
387 | .B XCASE | |
388 | (not in POSIX; not supported under Linux) | |
389 | If \fBICANON\fP is also set, terminal is uppercase only. | |
390 | Input is converted to lowercase, except for characters preceded by \\. | |
391 | On output, uppercase characters are preceded by \\ and lowercase | |
392 | characters are converted to uppercase. | |
6d1f5ca5 YK |
393 | [requires |
394 | .B _BSD_SOURCE | |
395 | or | |
396 | .B _SVID_SOURCE | |
397 | or | |
398 | .BR _XOPEN_SOURCE ] | |
c3dfd2c8 | 399 | .\" glibc is probably now wrong to allow |
eee28e75 MK |
400 | .\" Define |
401 | .\" .B _XOPEN_SOURCE | |
402 | .\" to expose | |
403 | .\" .BR XCASE . | |
fea681da MK |
404 | .TP |
405 | .B ECHO | |
406 | Echo input characters. | |
407 | .TP | |
408 | .B ECHOE | |
409 | If \fBICANON\fP is also set, the ERASE character erases the preceding | |
410 | input character, and WERASE erases the preceding word. | |
411 | .TP | |
412 | .B ECHOK | |
413 | If \fBICANON\fP is also set, the KILL character erases the current line. | |
414 | .TP | |
415 | .B ECHONL | |
416 | If \fBICANON\fP is also set, echo the NL character even if ECHO is not set. | |
417 | .TP | |
418 | .B ECHOCTL | |
d8b24e6e MK |
419 | (not in POSIX) If \fBECHO\fP is also set, |
420 | terminal special characters other than | |
8bb93cd4 MK |
421 | TAB, NL, START, and STOP are echoed as \fB^X\fP, |
422 | where X is the character with | |
d8b24e6e | 423 | ASCII code 0x40 greater than the special character. |
c13182ef | 424 | For example, character |
8bb93cd4 | 425 | 0x08 (BS) is echoed as \fB^H\fP. |
db4e96b7 MK |
426 | [requires |
427 | .B _BSD_SOURCE | |
c90511a6 MK |
428 | or |
429 | .BR _SVID_SOURCE ] | |
fea681da MK |
430 | .TP |
431 | .B ECHOPRT | |
96da8065 | 432 | (not in POSIX) If \fBICANON\fP and \fBECHO\fP are also set, characters |
fea681da | 433 | are printed as they are being erased. |
db4e96b7 MK |
434 | [requires |
435 | .B _BSD_SOURCE | |
c90511a6 MK |
436 | or |
437 | .BR _SVID_SOURCE ] | |
fea681da MK |
438 | .TP |
439 | .B ECHOKE | |
440 | (not in POSIX) If \fBICANON\fP is also set, KILL is echoed by erasing | |
441 | each character on the line, as specified by \fBECHOE\fP and \fBECHOPRT\fP. | |
db4e96b7 MK |
442 | [requires |
443 | .B _BSD_SOURCE | |
c90511a6 MK |
444 | or |
445 | .BR _SVID_SOURCE ] | |
fea681da MK |
446 | .TP |
447 | .B DEFECHO | |
448 | (not in POSIX) Echo only when a process is reading. | |
42b09930 | 449 | (Not implemented on Linux.) |
fea681da MK |
450 | .TP |
451 | .B FLUSHO | |
452 | (not in POSIX; not supported under Linux) | |
c13182ef MK |
453 | Output is being flushed. |
454 | This flag is toggled by typing | |
fea681da | 455 | the DISCARD character. |
db4e96b7 MK |
456 | [requires |
457 | .B _BSD_SOURCE | |
c90511a6 MK |
458 | or |
459 | .BR _SVID_SOURCE ] | |
fea681da MK |
460 | .TP |
461 | .B NOFLSH | |
6e502d47 MK |
462 | Disable flushing the input and output queues when generating signals for the |
463 | INT, QUIT, and SUSP characters. | |
464 | .\" Stevens lets SUSP only flush the input queue | |
fea681da MK |
465 | .TP |
466 | .B TOSTOP | |
8bd58774 MK |
467 | Send the |
468 | .B SIGTTOU | |
469 | signal to the process group of a background process | |
fea681da MK |
470 | which tries to write to its controlling terminal. |
471 | .TP | |
472 | .B PENDIN | |
473 | (not in POSIX; not supported under Linux) | |
474 | All characters in the input queue are reprinted when | |
c13182ef | 475 | the next character is read. |
5852aba2 MK |
476 | .RB ( bash (1) |
477 | handles typeahead this way.) | |
db4e96b7 MK |
478 | [requires |
479 | .B _BSD_SOURCE | |
c90511a6 MK |
480 | or |
481 | .BR _SVID_SOURCE ] | |
fea681da MK |
482 | .TP |
483 | .B IEXTEN | |
484 | Enable implementation-defined input processing. | |
0425de01 | 485 | This flag, as well as \fBICANON\fP must be enabled for the |
fea681da MK |
486 | special characters EOL2, LNEXT, REPRINT, WERASE to be interpreted, |
487 | and for the \fBIUCLC\fP flag to be effective. | |
488 | .PP | |
d8b24e6e | 489 | The \fIc_cc\fP array defines the terminal special characters. |
fea681da MK |
490 | The symbolic indices (initial values) and meaning are: |
491 | .TP | |
91e2779f MK |
492 | .B VDISCARD |
493 | (not in POSIX; not supported under Linux; 017, SI, Ctrl-O) | |
494 | Toggle: start/stop discarding pending output. | |
097585ed | 495 | Recognized when |
91e2779f | 496 | .B IEXTEN |
097585ed | 497 | is set, and then not passed as input. |
fea681da | 498 | .TP |
91e2779f MK |
499 | .B VDSUSP |
500 | (not in POSIX; not supported under Linux; 031, EM, Ctrl-Y) | |
489e425d | 501 | Delayed suspend character (DSUSP): |
91e2779f MK |
502 | send |
503 | .B SIGTSTP | |
504 | signal when the character is read by the user program. | |
097585ed | 505 | Recognized when |
91e2779f MK |
506 | .B IEXTEN |
507 | and | |
097585ed | 508 | .B ISIG |
91e2779f MK |
509 | are set, and the system supports |
510 | job control, and then not passed as input. | |
fea681da MK |
511 | .TP |
512 | .B VEOF | |
513 | (004, EOT, Ctrl-D) | |
489e425d | 514 | End-of-file character (EOF). |
fea681da MK |
515 | More precisely: this character causes the pending tty buffer to be sent |
516 | to the waiting user program without waiting for end-of-line. | |
d9c1ae64 MK |
517 | If it is the first character of the line, the |
518 | .BR read (2) | |
519 | in the user program returns 0, which signifies end-of-file. | |
097585ed MK |
520 | Recognized when |
521 | .B ICANON | |
522 | is set, and then not passed as input. | |
fea681da | 523 | .TP |
fea681da MK |
524 | .B VEOL |
525 | (0, NUL) | |
489e425d | 526 | Additional end-of-line character (EOL). |
097585ed MK |
527 | Recognized when |
528 | .B ICANON | |
529 | is set. | |
fea681da | 530 | .TP |
fea681da MK |
531 | .B VEOL2 |
532 | (not in POSIX; 0, NUL) | |
489e425d | 533 | Yet another end-of-line character (EOL2). |
097585ed MK |
534 | Recognized when |
535 | .B ICANON | |
536 | is set. | |
fea681da | 537 | .TP |
91e2779f MK |
538 | .B VERASE |
539 | (0177, DEL, rubout, or 010, BS, Ctrl-H, or also #) | |
489e425d | 540 | Erase character (ERASE). |
91e2779f MK |
541 | This erases the previous not-yet-erased character, |
542 | but does not erase past EOF or beginning-of-line. | |
097585ed | 543 | Recognized when |
91e2779f | 544 | .B ICANON |
097585ed | 545 | is set, and then not passed as input. |
fea681da | 546 | .TP |
91e2779f MK |
547 | .B VINTR |
548 | (003, ETX, Ctrl-C, or also 0177, DEL, rubout) | |
489e425d | 549 | Interrupt character (INTR). |
91e2779f MK |
550 | Send a |
551 | .B SIGINT | |
8bd58774 | 552 | signal. |
097585ed MK |
553 | Recognized when |
554 | .B ISIG | |
555 | is set, and then not passed as input. | |
fea681da | 556 | .TP |
91e2779f MK |
557 | .B VKILL |
558 | (025, NAK, Ctrl-U, or Ctrl-X, or also @) | |
489e425d | 559 | Kill character (KILL). |
91e2779f | 560 | This erases the input since the last EOF or beginning-of-line. |
097585ed | 561 | Recognized when |
91e2779f MK |
562 | .B ICANON |
563 | is set, and then not passed as input. | |
fea681da MK |
564 | .TP |
565 | .B VLNEXT | |
566 | (not in POSIX; 026, SYN, Ctrl-V) | |
489e425d | 567 | Literal next (LNEXT). |
c13182ef | 568 | Quotes the next input character, depriving it of |
fea681da | 569 | a possible special meaning. |
097585ed MK |
570 | Recognized when |
571 | .B IEXTEN | |
572 | is set, and then not passed as input. | |
fea681da | 573 | .TP |
91e2779f | 574 | .B VMIN |
489e425d | 575 | Minimum number of characters for noncanonical read (MIN). |
91e2779f MK |
576 | .TP |
577 | .B VQUIT | |
31a6818e | 578 | (034, FS, Ctrl-\e) |
489e425d | 579 | Quit character (QUIT). |
91e2779f MK |
580 | Send |
581 | .B SIGQUIT | |
582 | signal. | |
097585ed | 583 | Recognized when |
91e2779f MK |
584 | .B ISIG |
585 | is set, and then not passed as input. | |
fea681da MK |
586 | .TP |
587 | .B VREPRINT | |
588 | (not in POSIX; 022, DC2, Ctrl-R) | |
489e425d | 589 | Reprint unread characters (REPRINT). |
097585ed MK |
590 | Recognized when |
591 | .B ICANON | |
592 | and | |
593 | .B IEXTEN | |
594 | are set, and then not passed as input. | |
fea681da | 595 | .TP |
91e2779f MK |
596 | .B VSTART |
597 | (021, DC1, Ctrl-Q) | |
489e425d | 598 | Start character (START). |
91e2779f | 599 | Restarts output stopped by the Stop character. |
097585ed | 600 | Recognized when |
91e2779f | 601 | .B IXON |
097585ed | 602 | is set, and then not passed as input. |
fea681da MK |
603 | .TP |
604 | .B VSTATUS | |
605 | (not in POSIX; not supported under Linux; | |
606 | status request: 024, DC4, Ctrl-T). | |
a6639d09 MK |
607 | Status character (STATUS). |
608 | Display status information at terminal, | |
609 | including state of foreground process and amount of CPU time it has consumed. | |
610 | Also sends a | |
611 | .BR SIGINFO | |
612 | signal (not supported on Linux) to the foreground process group. | |
91e2779f MK |
613 | .TP |
614 | .B VSTOP | |
615 | (023, DC3, Ctrl-S) | |
489e425d | 616 | Stop character (STOP). |
91e2779f MK |
617 | Stop output until Start character typed. |
618 | Recognized when | |
619 | .B IXON | |
620 | is set, and then not passed as input. | |
621 | .TP | |
622 | .B VSUSP | |
623 | (032, SUB, Ctrl-Z) | |
489e425d | 624 | Suspend character (SUSP). |
91e2779f MK |
625 | Send |
626 | .B SIGTSTP | |
627 | signal. | |
628 | Recognized when | |
629 | .B ISIG | |
630 | is set, and then not passed as input. | |
631 | .TP | |
632 | .B VSWTCH | |
633 | (not in POSIX; not supported under Linux; 0, NUL) | |
489e425d | 634 | Switch character (SWTCH). |
33b7fff5 MK |
635 | Used in System V to switch shells in |
636 | .IR "shell layers" , | |
5aaf78b7 | 637 | a predecessor to shell job control. |
91e2779f MK |
638 | .TP |
639 | .B VTIME | |
489e425d | 640 | Timeout in deciseconds for noncanonical read (TIME). |
91e2779f MK |
641 | .TP |
642 | .B VWERASE | |
643 | (not in POSIX; 027, ETB, Ctrl-W) | |
489e425d | 644 | Word erase (WERASE). |
91e2779f MK |
645 | Recognized when |
646 | .B ICANON | |
647 | and | |
648 | .B IEXTEN | |
649 | are set, and then not passed as input. | |
dd3568a1 | 650 | .PP |
d51529b8 MK |
651 | An individual terminal special character can be disabled by setting |
652 | the value of the corresponding | |
653 | .I c_cc | |
654 | element to | |
655 | .BR _POSIX_VDISABLE . | |
dd3568a1 | 656 | .PP |
d51529b8 | 657 | The above symbolic subscript values are all different, except that |
097585ed | 658 | .BR VTIME , |
0daa9e92 | 659 | .B VMIN |
097585ed | 660 | may have the same value as |
3cf81850 | 661 | .BR VEOL , |
097585ed MK |
662 | .BR VEOF , |
663 | respectively. | |
a6712802 | 664 | In noncanonical mode the special character meaning is replaced |
c13182ef | 665 | by the timeout meaning. |
097585ed MK |
666 | For an explanation of |
667 | .B VMIN | |
668 | and | |
669 | .BR VTIME , | |
670 | see the description of | |
a6712802 | 671 | noncanonical mode below. |
73d8cece | 672 | .SS Retrieving and changing terminal settings |
fea681da | 673 | .PP |
63aa9df0 | 674 | .BR tcgetattr () |
fea681da | 675 | gets the parameters associated with the object referred by \fIfd\fP and |
869ebe5b | 676 | stores them in the \fItermios\fP structure referenced by |
c13182ef MK |
677 | \fItermios_p\fP. |
678 | This function may be invoked from a background process; | |
fea681da MK |
679 | however, the terminal attributes may be subsequently changed by a |
680 | foreground process. | |
dd3568a1 | 681 | .PP |
63aa9df0 | 682 | .BR tcsetattr () |
fea681da MK |
683 | sets the parameters associated with the terminal (unless support is |
684 | required from the underlying hardware that is not available) from the | |
c13182ef | 685 | \fItermios\fP structure referred to by \fItermios_p\fP. |
fea681da MK |
686 | \fIoptional_actions\fP specifies when the changes take effect: |
687 | .IP \fBTCSANOW\fP | |
688 | the change occurs immediately. | |
689 | .IP \fBTCSADRAIN\fP | |
690 | the change occurs after all output written to | |
691 | .I fd | |
c13182ef | 692 | has been transmitted. |
d1c2e0f2 | 693 | This option should be used when changing |
fea681da MK |
694 | parameters that affect output. |
695 | .IP \fBTCSAFLUSH\fP | |
696 | the change occurs after all output written to the object referred by | |
697 | .I fd | |
698 | has been transmitted, and all input that has been received but not read | |
699 | will be discarded before the change is made. | |
73d8cece | 700 | .SS Canonical and noncanonical mode |
19ab0376 MK |
701 | The setting of the |
702 | .B ICANON | |
703 | canon flag in | |
704 | .I c_lflag | |
705 | determines whether the terminal is operating in canonical mode | |
706 | .RB ( ICANON | |
707 | set) or | |
a6712802 | 708 | noncanonical mode |
c13182ef | 709 | .RB ( ICANON |
19ab0376 MK |
710 | unset). |
711 | By default, | |
712 | .B ICANON | |
8d48cea3 | 713 | is set. |
847e0d88 | 714 | .PP |
19ab0376 MK |
715 | In canonical mode: |
716 | .IP * 2 | |
717 | Input is made available line by line. | |
718 | An input line is available when one of the line delimiters | |
719 | is typed (NL, EOL, EOL2; or EOF at the start of line). | |
720 | Except in the case of EOF, the line delimiter is included | |
721 | in the buffer returned by | |
722 | .BR read (2). | |
723 | .IP * 2 | |
c13182ef MK |
724 | Line editing is enabled (ERASE, KILL; |
725 | and if the | |
19ab0376 MK |
726 | .B IEXTEN |
727 | flag is set: WERASE, REPRINT, LNEXT). | |
c13182ef | 728 | A |
fb186734 | 729 | .BR read (2) |
19ab0376 | 730 | returns at most one line of input; if the |
fb186734 | 731 | .BR read (2) |
19ab0376 MK |
732 | requested fewer bytes than are available in the current line of input, |
733 | then only as many bytes as requested are read, | |
734 | and the remaining characters will be available for a future | |
fb186734 | 735 | .BR read (2). |
5ad8a9d7 | 736 | .IP * 2 |
7a727dc4 MK |
737 | The maximum line length is 4096 chars |
738 | (including the terminating newline character); | |
739 | lines longer than 4096 chars are truncated. | |
988c4c42 MK |
740 | After 4095 characters, input processing (e.g., |
741 | .B ISIG | |
742 | and | |
743 | .B ECHO* | |
744 | processing) continues, but any input data after 4095 characters up to | |
745 | (but not including) any terminating newline is discarded. | |
7a727dc4 MK |
746 | This ensures that the terminal can always receive |
747 | more input until at least one line can be read. | |
19ab0376 | 748 | .PP |
a6712802 | 749 | In noncanonical mode input is available immediately (without |
19ab0376 | 750 | the user having to type a line-delimiter character), |
764d3de3 | 751 | no input processing is performed, |
19ab0376 | 752 | and line editing is disabled. |
5ad8a9d7 DTQ |
753 | The read buffer will only accept 4095 chars; this provides the |
754 | necessary space for a newline char if the input mode is switched | |
755 | to canonical. | |
c13182ef | 756 | The settings of MIN |
19ab0376 | 757 | .RI ( c_cc[VMIN] ) |
0f8b10eb | 758 | and TIME |
19ab0376 MK |
759 | .RI ( c_cc[VTIME] ) |
760 | determine the circumstances in which a | |
761 | .BR read (2) | |
762 | completes; there are four distinct cases: | |
959c4b25 | 763 | .TP |
f8f8b9c1 | 764 | MIN == 0, TIME == 0 (polling read) |
19ab0376 | 765 | If data is available, |
fb186734 | 766 | .BR read (2) |
19ab0376 MK |
767 | returns immediately, with the lesser of the number of bytes |
768 | available, or the number of bytes requested. | |
769 | If no data is available, | |
fb186734 | 770 | .BR read (2) |
19ab0376 | 771 | returns 0. |
959c4b25 | 772 | .TP |
f8f8b9c1 | 773 | MIN > 0, TIME == 0 (blocking read) |
fb186734 | 774 | .BR read (2) |
4b985dd6 MK |
775 | blocks until MIN bytes are available, |
776 | and returns up to the number of bytes requested. | |
959c4b25 | 777 | .TP |
f8f8b9c1 | 778 | MIN == 0, TIME > 0 (read with timeout) |
19ab0376 | 779 | TIME specifies the limit for a timer in tenths of a second. |
c13182ef | 780 | The timer is started when |
fb186734 | 781 | .BR read (2) |
19ab0376 | 782 | is called. |
fb186734 | 783 | .BR read (2) |
19ab0376 MK |
784 | returns either when at least one byte of data is available, |
785 | or when the timer expires. | |
786 | If the timer expires without any input becoming available, | |
fb186734 | 787 | .BR read (2) |
19ab0376 | 788 | returns 0. |
e764d1b7 | 789 | If data is already available at the time of the call to |
8563c249 | 790 | .BR read (2), |
e764d1b7 | 791 | the call behaves as though the data was received immediately after the call. |
959c4b25 | 792 | .TP |
f8f8b9c1 | 793 | MIN > 0, TIME > 0 (read with interbyte timeout) |
19ab0376 MK |
794 | TIME specifies the limit for a timer in tenths of a second. |
795 | Once an initial byte of input becomes available, | |
796 | the timer is restarted after each further byte is received. | |
fb186734 | 797 | .BR read (2) |
a9f0126f MK |
798 | returns when any of the following conditions is met: |
799 | .RS | |
800 | .IP * 3 | |
801 | MIN bytes have been received. | |
802 | .IP * | |
803 | The interbyte timer expires. | |
804 | .IP * | |
805 | The number of bytes requested by | |
806 | .BR read (2) | |
807 | has been received. | |
808 | (POSIX does not specify this termination condition, | |
809 | and on some other implementations | |
810 | .\" e.g., Solaris | |
8563c249 | 811 | .BR read (2) |
a9f0126f MK |
812 | does not return in this case.) |
813 | .RE | |
814 | .IP | |
33a0ccb2 | 815 | Because the timer is started only after the initial byte |
19ab0376 | 816 | becomes available, at least one byte will be read. |
e764d1b7 | 817 | If data is already available at the time of the call to |
8563c249 | 818 | .BR read (2), |
e764d1b7 | 819 | the call behaves as though the data was received immediately after the call. |
5ee2d3c5 MK |
820 | .PP |
821 | POSIX | |
822 | .\" POSIX.1-2008 XBD 11.1.7 | |
823 | does not specify whether the setting of the | |
824 | .B O_NONBLOCK | |
825 | file status flag takes precedence over the MIN and TIME settings. | |
826 | If | |
827 | .B O_NONBLOCK | |
828 | is set, a | |
8563c249 | 829 | .BR read (2) |
5ee2d3c5 MK |
830 | in noncanonical mode may return immediately, |
831 | regardless of the setting of MIN or TIME. | |
832 | Furthermore, if no data is available, | |
833 | POSIX permits a | |
8563c249 | 834 | .BR read (2) |
5ee2d3c5 MK |
835 | in noncanonical mode to return either 0, or \-1 with |
836 | .I errno | |
837 | set to | |
838 | .BR EAGAIN . | |
73d8cece | 839 | .SS Raw mode |
dd3568a1 | 840 | .PP |
60a90ecd MK |
841 | .BR cfmakeraw () |
842 | sets the terminal to something like the | |
1954b6a9 | 843 | "raw" mode of the old Version 7 terminal driver: |
19ab0376 | 844 | input is available character by character, |
c13182ef | 845 | echoing is disabled, and all special processing of |
19ab0376 MK |
846 | terminal input and output characters is disabled. |
847 | The terminal attributes are set as follows: | |
a2b7a144 MK |
848 | .PP |
849 | .in +4n | |
850 | .EX | |
851 | termios_p\->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | |
852 | | INLCR | IGNCR | ICRNL | IXON); | |
853 | termios_p\->c_oflag &= ~OPOST; | |
854 | termios_p\->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); | |
855 | termios_p\->c_cflag &= ~(CSIZE | PARENB); | |
856 | termios_p\->c_cflag |= CS8; | |
857 | .EE | |
858 | .in | |
859 | .\" | |
73d8cece | 860 | .SS Line control |
dd3568a1 | 861 | .PP |
63aa9df0 | 862 | .BR tcsendbreak () |
fea681da MK |
863 | transmits a continuous stream of zero-valued bits for a specific |
864 | duration, if the terminal is using asynchronous serial data | |
c13182ef MK |
865 | transmission. |
866 | If \fIduration\fP is zero, it transmits zero-valued bits | |
867 | for at least 0.25 seconds, and not more that 0.5 seconds. | |
868 | If \fIduration\fP is not zero, it sends zero-valued bits for some | |
fea681da | 869 | implementation-defined length of time. |
dd3568a1 | 870 | .PP |
fea681da | 871 | If the terminal is not using asynchronous serial data transmission, |
60a90ecd MK |
872 | .BR tcsendbreak () |
873 | returns without taking any action. | |
dd3568a1 | 874 | .PP |
63aa9df0 | 875 | .BR tcdrain () |
fea681da MK |
876 | waits until all output written to the object referred to by |
877 | .I fd | |
878 | has been transmitted. | |
dd3568a1 | 879 | .PP |
63aa9df0 | 880 | .BR tcflush () |
fea681da MK |
881 | discards data written to the object referred to by |
882 | .I fd | |
883 | but not transmitted, or data received but not read, depending on the | |
884 | value of | |
885 | .IR queue_selector : | |
886 | .IP \fBTCIFLUSH\fP | |
887 | flushes data received but not read. | |
888 | .IP \fBTCOFLUSH\fP | |
889 | flushes data written but not transmitted. | |
890 | .IP \fBTCIOFLUSH\fP | |
891 | flushes both data received but not read, and data written but not | |
892 | transmitted. | |
dd3568a1 | 893 | .PP |
63aa9df0 | 894 | .BR tcflow () |
fea681da MK |
895 | suspends transmission or reception of data on the object referred to by |
896 | .IR fd , | |
897 | depending on the value of | |
898 | .IR action : | |
899 | .IP \fBTCOOFF\fP | |
900 | suspends output. | |
901 | .IP \fBTCOON\fP | |
902 | restarts suspended output. | |
903 | .IP \fBTCIOFF\fP | |
c13182ef | 904 | transmits a STOP character, which stops the terminal device from |
35478399 | 905 | transmitting data to the system. |
fea681da | 906 | .IP \fBTCION\fP |
c13182ef | 907 | transmits a START character, which starts the terminal device |
35478399 | 908 | transmitting data to the system. |
dd3568a1 | 909 | .PP |
fea681da MK |
910 | The default on open of a terminal file is that neither its input nor its |
911 | output is suspended. | |
73d8cece | 912 | .SS Line speed |
87d1fd87 | 913 | The baud rate functions are provided for getting and setting the values |
c13182ef MK |
914 | of the input and output baud rates in the \fItermios\fP structure. |
915 | The new values do not take effect | |
60a90ecd MK |
916 | until |
917 | .BR tcsetattr () | |
918 | is successfully called. | |
847e0d88 | 919 | .PP |
87d1fd87 MK |
920 | Setting the speed to \fBB0\fP instructs the modem to "hang up". |
921 | The actual bit rate corresponding to \fBB38400\fP may be altered with | |
60a90ecd | 922 | .BR setserial (8). |
dd3568a1 | 923 | .PP |
87d1fd87 MK |
924 | The input and output baud rates are stored in the \fItermios\fP |
925 | structure. | |
dd3568a1 | 926 | .PP |
63aa9df0 | 927 | .BR cfgetospeed () |
869ebe5b | 928 | returns the output baud rate stored in the \fItermios\fP structure |
fea681da MK |
929 | pointed to by |
930 | .IR termios_p . | |
dd3568a1 | 931 | .PP |
63aa9df0 | 932 | .BR cfsetospeed () |
869ebe5b | 933 | sets the output baud rate stored in the \fItermios\fP structure pointed |
fea681da | 934 | to by \fItermios_p\fP to \fIspeed\fP, which must be one of these constants: |
a2b7a144 | 935 | .PP |
fea681da MK |
936 | .nf |
937 | .ft B | |
938 | B0 | |
939 | B50 | |
940 | B75 | |
941 | B110 | |
942 | B134 | |
943 | B150 | |
944 | B200 | |
945 | B300 | |
946 | B600 | |
947 | B1200 | |
948 | B1800 | |
949 | B2400 | |
950 | B4800 | |
951 | B9600 | |
952 | B19200 | |
953 | B38400 | |
954 | B57600 | |
955 | B115200 | |
956 | B230400 | |
957 | .ft P | |
958 | .fi | |
a2b7a144 | 959 | .PP |
fea681da | 960 | The zero baud rate, \fBB0\fP, |
c13182ef MK |
961 | is used to terminate the connection. |
962 | If B0 is specified, the modem control lines shall no longer be asserted. | |
be7fff26 MK |
963 | Normally, this will disconnect the line. |
964 | \fBCBAUDEX\fP is a mask | |
fea681da | 965 | for the speeds beyond those defined in POSIX.1 (57600 and above). |
c7094399 | 966 | Thus, \fBB57600\fP & \fBCBAUDEX\fP is nonzero. |
dd3568a1 | 967 | .PP |
63aa9df0 | 968 | .BR cfgetispeed () |
869ebe5b | 969 | returns the input baud rate stored in the \fItermios\fP structure. |
dd3568a1 | 970 | .PP |
63aa9df0 | 971 | .BR cfsetispeed () |
869ebe5b | 972 | sets the input baud rate stored in the \fItermios\fP structure to |
c13182ef | 973 | .IR speed , |
869ebe5b MK |
974 | which must be specified as one of the \fBBnnn\fP constants listed above for |
975 | .BR cfsetospeed (). | |
fea681da MK |
976 | If the input baud rate is set to zero, the input baud rate will be |
977 | equal to the output baud rate. | |
dd3568a1 | 978 | .PP |
63aa9df0 | 979 | .BR cfsetspeed () |
c13182ef MK |
980 | is a 4.4BSD extension. |
981 | It takes the same arguments as | |
869ebe5b MK |
982 | .BR cfsetispeed (), |
983 | and sets both input and output speed. | |
47297adb | 984 | .SH RETURN VALUE |
dd3568a1 | 985 | .PP |
63aa9df0 | 986 | .BR cfgetispeed () |
fea681da | 987 | returns the input baud rate stored in the |
869ebe5b | 988 | \fItermios\fP |
fea681da | 989 | structure. |
dd3568a1 | 990 | .PP |
63aa9df0 | 991 | .BR cfgetospeed () |
869ebe5b | 992 | returns the output baud rate stored in the \fItermios\fP structure. |
dd3568a1 | 993 | .PP |
fea681da MK |
994 | All other functions return: |
995 | .IP 0 | |
996 | on success. | |
997 | .IP \-1 | |
998 | on failure and set | |
999 | .I errno | |
1000 | to indicate the error. | |
dd3568a1 | 1001 | .PP |
fea681da | 1002 | Note that |
f87925c6 | 1003 | .BR tcsetattr () |
fea681da | 1004 | returns success if \fIany\fP of the requested changes could be |
c13182ef MK |
1005 | successfully carried out. |
1006 | Therefore, when making multiple changes | |
fea681da | 1007 | it may be necessary to follow this call with a further call to |
f87925c6 | 1008 | .BR tcgetattr () |
fea681da | 1009 | to check that all changes have been performed successfully. |
2be8b1b2 | 1010 | .SH ATTRIBUTES |
146c2ef3 PH |
1011 | For an explanation of the terms used in this section, see |
1012 | .BR attributes (7). | |
1013 | .nh | |
1014 | .ad l | |
1015 | .TS | |
1016 | allbox; | |
b2a64861 | 1017 | lbw36 lb lb |
84a15261 | 1018 | l l l. |
146c2ef3 PH |
1019 | Interface Attribute Value |
1020 | T{ | |
2be8b1b2 PH |
1021 | .BR tcgetattr (), |
1022 | .BR tcsetattr (), | |
2be8b1b2 PH |
1023 | .BR tcdrain (), |
1024 | .BR tcflush (), | |
ff548faa | 1025 | .BR tcflow (), |
b2a64861 | 1026 | .BR tcsendbreak (), |
2be8b1b2 PH |
1027 | .BR cfmakeraw (), |
1028 | .BR cfgetispeed (), | |
1029 | .BR cfgetospeed (), | |
1030 | .BR cfsetispeed (), | |
1031 | .BR cfsetospeed (), | |
2be8b1b2 | 1032 | .BR cfsetspeed () |
7a075792 MK |
1033 | T} Thread safety MT-Safe |
1034 | .TE | |
1035 | .\" FIXME: The markings are different from that in the glibc manual. | |
1036 | .\" markings in glibc manual are more detailed: | |
1037 | .\" | |
1038 | .\" tcsendbreak: MT-Unsafe race:tcattr(filedes)/bsd | |
1039 | .\" tcflow: MT-Unsafe race:tcattr(filedes)/bsd | |
1040 | .\" | |
b6c73e0b | 1041 | .\" glibc manual says /bsd indicate the preceding marker only applies |
6e8ccc0d | 1042 | .\" when the underlying kernel is a BSD kernel. |
b6c73e0b | 1043 | .\" So, it is safety in Linux kernel. |
146c2ef3 PH |
1044 | .ad |
1045 | .hy | |
dfb631a8 MK |
1046 | .SH CONFORMING TO |
1047 | .BR tcgetattr (), | |
1048 | .BR tcsetattr (), | |
1049 | .BR tcsendbreak (), | |
1050 | .BR tcdrain (), | |
1051 | .BR tcflush (), | |
1052 | .BR tcflow (), | |
1053 | .BR cfgetispeed (), | |
1054 | .BR cfgetospeed (), | |
1055 | .BR cfsetispeed (), | |
1056 | and | |
1057 | .BR cfsetospeed () | |
1058 | are specified in POSIX.1-2001. | |
847e0d88 | 1059 | .PP |
dfb631a8 | 1060 | .BR cfmakeraw () |
01d5d366 MK |
1061 | and |
1062 | .BR cfsetspeed () | |
c8f2dd47 | 1063 | are nonstandard, but available on the BSDs. |
fea681da | 1064 | .SH NOTES |
b4112efb | 1065 | UNIX\ V7 and several later systems have a list of baud rates |
fea681da MK |
1066 | where after the fourteen values B0, ..., B9600 one finds the |
1067 | two constants EXTA, EXTB ("External A" and "External B"). | |
1068 | Many systems extend the list with much higher baud rates. | |
dd3568a1 | 1069 | .PP |
c7094399 | 1070 | The effect of a nonzero \fIduration\fP with |
60a90ecd MK |
1071 | .BR tcsendbreak () |
1072 | varies. | |
c13182ef | 1073 | SunOS specifies a break of |
8b8d0001 | 1074 | .I "duration\ *\ N" |
fea681da MK |
1075 | seconds, where \fIN\fP is at least 0.25, and not more than 0.5. |
1076 | Linux, AIX, DU, Tru64 send a break of | |
1077 | .I duration | |
1078 | milliseconds. | |
1079 | FreeBSD and NetBSD and HP-UX and MacOS ignore the value of | |
1080 | .IR duration . | |
1f409d5d | 1081 | Under Solaris and UnixWare, |
e511ffb6 | 1082 | .BR tcsendbreak () |
c7094399 | 1083 | with nonzero |
fea681da MK |
1084 | .I duration |
1085 | behaves like | |
e511ffb6 | 1086 | .BR tcdrain (). |
fea681da MK |
1087 | .\" libc4 until 4.7.5, glibc for sysv: EINVAL for duration > 0. |
1088 | .\" libc4.7.6, libc5, glibc for unix: duration in ms. | |
1089 | .\" glibc for bsd: duration in us | |
1090 | .\" glibc for sunos4: ignore duration | |
499eb81f ES |
1091 | .SH BUGS |
1092 | .\" kernel 77e5bff1640432f28794a00800955e646dcd7455 | |
1093 | .\" glibc 573963e32ffac46d9891970ddebde2ac3212c5c0 | |
ff2c4618 | 1094 | On the Alpha architecture before Linux 4.16 (and glibc before 2.28), the |
499eb81f | 1095 | .B XTABS |
ff2c4618 | 1096 | value was different from |
499eb81f ES |
1097 | .B TAB3 |
1098 | and it was ignored by the | |
1099 | .B N_TTY | |
ff2c4618 MK |
1100 | line discipline code of the terminal driver as a result |
1101 | (because as it wasn't part of the | |
499eb81f ES |
1102 | .B TABDLY |
1103 | mask). | |
47297adb | 1104 | .SH SEE ALSO |
c04700fb MK |
1105 | .BR reset (1), |
1106 | .BR setterm (1), | |
fea681da | 1107 | .BR stty (1), |
c04700fb | 1108 | .BR tput (1), |
ca8c33fc | 1109 | .BR tset (1), |
271ee1bf | 1110 | .BR tty (1), |
d49a2220 | 1111 | .BR ioctl_console (2), |
a9168840 | 1112 | .BR ioctl_tty (2), |
fea681da | 1113 | .BR setserial (8) |