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