1TERMIOS(3) Linux Programmer's Manual TERMIOS(3)
2
3
4
6 termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow,
7 cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed, cfset‐
8 speed - get and set terminal attributes, line control, get and set baud
9 rate
10
12 #include <termios.h>
13 #include <unistd.h>
14
15 int tcgetattr(int fd, struct termios *termios_p);
16
17 int tcsetattr(int fd, int optional_actions,
18 const struct termios *termios_p);
19
20 int tcsendbreak(int fd, int duration);
21
22 int tcdrain(int fd);
23
24 int tcflush(int fd, int queue_selector);
25
26 int tcflow(int fd, int action);
27
28 void cfmakeraw(struct termios *termios_p);
29
30 speed_t cfgetispeed(const struct termios *termios_p);
31
32 speed_t cfgetospeed(const struct termios *termios_p);
33
34 int cfsetispeed(struct termios *termios_p, speed_t speed);
35
36 int cfsetospeed(struct termios *termios_p, speed_t speed);
37
38 int cfsetspeed(struct termios *termios_p, speed_t speed);
39
40 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
41
42 cfsetspeed(), cfmakeraw():
43 Since glibc 2.19:
44 _DEFAULT_SOURCE
45 Glibc 2.19 and earlier:
46 _BSD_SOURCE
47
49 The termios functions describe a general terminal interface that is
50 provided to control asynchronous communications ports.
51
52 The termios structure
53 Many of the functions described here have a termios_p argument that is
54 a pointer to a termios structure. This structure contains at least the
55 following members:
56
57 tcflag_t c_iflag; /* input modes */
58 tcflag_t c_oflag; /* output modes */
59 tcflag_t c_cflag; /* control modes */
60 tcflag_t c_lflag; /* local modes */
61 cc_t c_cc[NCCS]; /* special characters */
62
63 The values that may be assigned to these fields are described below.
64 In the case of the first four bit-mask fields, the definitions of some
65 of the associated flags that may be set are exposed only if a specific
66 feature test macro (see feature_test_macros(7)) is defined, as noted in
67 brackets ("[]").
68
69 In the descriptions below, "not in POSIX" means that the value is not
70 specified in POSIX.1-2001, and "XSI" means that the value is specified
71 in POSIX.1-2001 as part of the XSI extension.
72
73 c_iflag flag constants:
74
75 IGNBRK Ignore BREAK condition on input.
76
77 BRKINT If IGNBRK is set, a BREAK is ignored. If it is not set but
78 BRKINT is set, then a BREAK causes the input and output queues
79 to be flushed, and if the terminal is the controlling terminal
80 of a foreground process group, it will cause a SIGINT to be sent
81 to this foreground process group. When neither IGNBRK nor
82 BRKINT are set, a BREAK reads as a null byte ('\0'), except when
83 PARMRK is set, in which case it reads as the sequence \377 \0
84 \0.
85
86 IGNPAR Ignore framing errors and parity errors.
87
88 PARMRK If this bit is set, input bytes with parity or framing errors
89 are marked when passed to the program. This bit is meaningful
90 only when INPCK is set and IGNPAR is not set. The way erroneous
91 bytes are marked is with two preceding bytes, \377 and \0.
92 Thus, the program actually reads three bytes for one erroneous
93 byte received from the terminal. If a valid byte has the value
94 \377, and ISTRIP (see below) is not set, the program might con‐
95 fuse it with the prefix that marks a parity error. Therefore, a
96 valid byte \377 is passed to the program as two bytes, \377
97 \377, in this case.
98
99 If neither IGNPAR nor PARMRK is set, read a character with a
100 parity error or framing error as \0.
101
102 INPCK Enable input parity checking.
103
104 ISTRIP Strip off eighth bit.
105
106 INLCR Translate NL to CR on input.
107
108 IGNCR Ignore carriage return on input.
109
110 ICRNL Translate carriage return to newline on input (unless IGNCR is
111 set).
112
113 IUCLC (not in POSIX) Map uppercase characters to lowercase on input.
114
115 IXON Enable XON/XOFF flow control on output.
116
117 IXANY (XSI) Typing any character will restart stopped output. (The
118 default is to allow just the START character to restart output.)
119
120 IXOFF Enable XON/XOFF flow control on input.
121
122 IMAXBEL
123 (not in POSIX) Ring bell when input queue is full. Linux does
124 not implement this bit, and acts as if it is always set.
125
126 IUTF8 (since Linux 2.6.4)
127 (not in POSIX) Input is UTF8; this allows character-erase to be
128 correctly performed in cooked mode.
129
130 c_oflag flag constants:
131
132 OPOST Enable implementation-defined output processing.
133
134 OLCUC (not in POSIX) Map lowercase characters to uppercase on output.
135
136 ONLCR (XSI) Map NL to CR-NL on output.
137
138 OCRNL Map CR to NL on output.
139
140 ONOCR Don't output CR at column 0.
141
142 ONLRET Don't output CR.
143
144 OFILL Send fill characters for a delay, rather than using a timed de‐
145 lay.
146
147 OFDEL Fill character is ASCII DEL (0177). If unset, fill character is
148 ASCII NUL ('\0'). (Not implemented on Linux.)
149
150 NLDLY Newline delay mask. Values are NL0 and NL1. [requires
151 _BSD_SOURCE or _SVID_SOURCE or _XOPEN_SOURCE]
152
153 CRDLY Carriage return delay mask. Values are CR0, CR1, CR2, or CR3.
154 [requires _BSD_SOURCE or _SVID_SOURCE or _XOPEN_SOURCE]
155
156 TABDLY Horizontal tab delay mask. Values are TAB0, TAB1, TAB2, TAB3
157 (or XTABS, but see the BUGS section). A value of TAB3, that is,
158 XTABS, expands tabs to spaces (with tab stops every eight col‐
159 umns). [requires _BSD_SOURCE or _SVID_SOURCE or _XOPEN_SOURCE]
160
161 BSDLY Backspace delay mask. Values are BS0 or BS1. (Has never been
162 implemented.) [requires _BSD_SOURCE or _SVID_SOURCE or
163 _XOPEN_SOURCE]
164
165 VTDLY Vertical tab delay mask. Values are VT0 or VT1.
166
167 FFDLY Form feed delay mask. Values are FF0 or FF1. [requires
168 _BSD_SOURCE or _SVID_SOURCE or _XOPEN_SOURCE]
169
170 c_cflag flag constants:
171
172 CBAUD (not in POSIX) Baud speed mask (4+1 bits). [requires
173 _BSD_SOURCE or _SVID_SOURCE]
174
175 CBAUDEX
176 (not in POSIX) Extra baud speed mask (1 bit), included in CBAUD.
177 [requires _BSD_SOURCE or _SVID_SOURCE]
178
179 (POSIX says that the baud speed is stored in the termios struc‐
180 ture without specifying where precisely, and provides
181 cfgetispeed() and cfsetispeed() for getting at it. Some systems
182 use bits selected by CBAUD in c_cflag, other systems use sepa‐
183 rate fields, for example, sg_ispeed and sg_ospeed.)
184
185 CSIZE Character size mask. Values are CS5, CS6, CS7, or CS8.
186
187 CSTOPB Set two stop bits, rather than one.
188
189 CREAD Enable receiver.
190
191 PARENB Enable parity generation on output and parity checking for in‐
192 put.
193
194 PARODD If set, then parity for input and output is odd; otherwise even
195 parity is used.
196
197 HUPCL Lower modem control lines after last process closes the device
198 (hang up).
199
200 CLOCAL Ignore modem control lines.
201
202 LOBLK (not in POSIX) Block output from a noncurrent shell layer. For
203 use by shl (shell layers). (Not implemented on Linux.)
204
205 CIBAUD (not in POSIX) Mask for input speeds. The values for the CIBAUD
206 bits are the same as the values for the CBAUD bits, shifted left
207 IBSHIFT bits. [requires _BSD_SOURCE or _SVID_SOURCE] (Not im‐
208 plemented on Linux.)
209
210 CMSPAR (not in POSIX) Use "stick" (mark/space) parity (supported on
211 certain serial devices): if PARODD is set, the parity bit is al‐
212 ways 1; if PARODD is not set, then the parity bit is always 0.
213 [requires _BSD_SOURCE or _SVID_SOURCE]
214
215 CRTSCTS
216 (not in POSIX) Enable RTS/CTS (hardware) flow control. [re‐
217 quires _BSD_SOURCE or _SVID_SOURCE]
218
219 c_lflag flag constants:
220
221 ISIG When any of the characters INTR, QUIT, SUSP, or DSUSP are re‐
222 ceived, generate the corresponding signal.
223
224 ICANON Enable canonical mode (described below).
225
226 XCASE (not in POSIX; not supported under Linux) If ICANON is also set,
227 terminal is uppercase only. Input is converted to lowercase,
228 except for characters preceded by \. On output, uppercase char‐
229 acters are preceded by \ and lowercase characters are converted
230 to uppercase. [requires _BSD_SOURCE or _SVID_SOURCE or
231 _XOPEN_SOURCE]
232
233 ECHO Echo input characters.
234
235 ECHOE If ICANON is also set, the ERASE character erases the preceding
236 input character, and WERASE erases the preceding word.
237
238 ECHOK If ICANON is also set, the KILL character erases the current
239 line.
240
241 ECHONL If ICANON is also set, echo the NL character even if ECHO is not
242 set.
243
244 ECHOCTL
245 (not in POSIX) If ECHO is also set, terminal special characters
246 other than TAB, NL, START, and STOP are echoed as ^X, where X is
247 the character with ASCII code 0x40 greater than the special
248 character. For example, character 0x08 (BS) is echoed as ^H.
249 [requires _BSD_SOURCE or _SVID_SOURCE]
250
251 ECHOPRT
252 (not in POSIX) If ICANON and ECHO are also set, characters are
253 printed as they are being erased. [requires _BSD_SOURCE or
254 _SVID_SOURCE]
255
256 ECHOKE (not in POSIX) If ICANON is also set, KILL is echoed by erasing
257 each character on the line, as specified by ECHOE and ECHOPRT.
258 [requires _BSD_SOURCE or _SVID_SOURCE]
259
260 DEFECHO
261 (not in POSIX) Echo only when a process is reading. (Not imple‐
262 mented on Linux.)
263
264 FLUSHO (not in POSIX; not supported under Linux) Output is being
265 flushed. This flag is toggled by typing the DISCARD character.
266 [requires _BSD_SOURCE or _SVID_SOURCE]
267
268 NOFLSH Disable flushing the input and output queues when generating
269 signals for the INT, QUIT, and SUSP characters.
270
271 TOSTOP Send the SIGTTOU signal to the process group of a background
272 process which tries to write to its controlling terminal.
273
274 PENDIN (not in POSIX; not supported under Linux) All characters in the
275 input queue are reprinted when the next character is read.
276 (bash(1) handles typeahead this way.) [requires _BSD_SOURCE or
277 _SVID_SOURCE]
278
279 IEXTEN Enable implementation-defined input processing. This flag, as
280 well as ICANON must be enabled for the special characters EOL2,
281 LNEXT, REPRINT, WERASE to be interpreted, and for the IUCLC flag
282 to be effective.
283
284 The c_cc array defines the terminal special characters. The symbolic
285 indices (initial values) and meaning are:
286
287 VDISCARD
288 (not in POSIX; not supported under Linux; 017, SI, Ctrl-O) Tog‐
289 gle: start/stop discarding pending output. Recognized when IEX‐
290 TEN is set, and then not passed as input.
291
292 VDSUSP (not in POSIX; not supported under Linux; 031, EM, Ctrl-Y) De‐
293 layed suspend character (DSUSP): send SIGTSTP signal when the
294 character is read by the user program. Recognized when IEXTEN
295 and ISIG are set, and the system supports job control, and then
296 not passed as input.
297
298 VEOF (004, EOT, Ctrl-D) End-of-file character (EOF). More precisely:
299 this character causes the pending tty buffer to be sent to the
300 waiting user program without waiting for end-of-line. If it is
301 the first character of the line, the read(2) in the user program
302 returns 0, which signifies end-of-file. Recognized when ICANON
303 is set, and then not passed as input.
304
305 VEOL (0, NUL) Additional end-of-line character (EOL). Recognized
306 when ICANON is set.
307
308 VEOL2 (not in POSIX; 0, NUL) Yet another end-of-line character (EOL2).
309 Recognized when ICANON is set.
310
311 VERASE (0177, DEL, rubout, or 010, BS, Ctrl-H, or also #) Erase charac‐
312 ter (ERASE). This erases the previous not-yet-erased character,
313 but does not erase past EOF or beginning-of-line. Recognized
314 when ICANON is set, and then not passed as input.
315
316 VINTR (003, ETX, Ctrl-C, or also 0177, DEL, rubout) Interrupt charac‐
317 ter (INTR). Send a SIGINT signal. Recognized when ISIG is set,
318 and then not passed as input.
319
320 VKILL (025, NAK, Ctrl-U, or Ctrl-X, or also @) Kill character (KILL).
321 This erases the input since the last EOF or beginning-of-line.
322 Recognized when ICANON is set, and then not passed as input.
323
324 VLNEXT (not in POSIX; 026, SYN, Ctrl-V) Literal next (LNEXT). Quotes
325 the next input character, depriving it of a possible special
326 meaning. Recognized when IEXTEN is set, and then not passed as
327 input.
328
329 VMIN Minimum number of characters for noncanonical read (MIN).
330
331 VQUIT (034, FS, Ctrl-\) Quit character (QUIT). Send SIGQUIT signal.
332 Recognized when ISIG is set, and then not passed as input.
333
334 VREPRINT
335 (not in POSIX; 022, DC2, Ctrl-R) Reprint unread characters (RE‐
336 PRINT). Recognized when ICANON and IEXTEN are set, and then not
337 passed as input.
338
339 VSTART (021, DC1, Ctrl-Q) Start character (START). Restarts output
340 stopped by the Stop character. Recognized when IXON is set, and
341 then not passed as input.
342
343 VSTATUS
344 (not in POSIX; not supported under Linux; status request: 024,
345 DC4, Ctrl-T). Status character (STATUS). Display status infor‐
346 mation at terminal, including state of foreground process and
347 amount of CPU time it has consumed. Also sends a SIGINFO signal
348 (not supported on Linux) to the foreground process group.
349
350 VSTOP (023, DC3, Ctrl-S) Stop character (STOP). Stop output until
351 Start character typed. Recognized when IXON is set, and then
352 not passed as input.
353
354 VSUSP (032, SUB, Ctrl-Z) Suspend character (SUSP). Send SIGTSTP sig‐
355 nal. Recognized when ISIG is set, and then not passed as input.
356
357 VSWTCH (not in POSIX; not supported under Linux; 0, NUL) Switch charac‐
358 ter (SWTCH). Used in System V to switch shells in shell layers,
359 a predecessor to shell job control.
360
361 VTIME Timeout in deciseconds for noncanonical read (TIME).
362
363 VWERASE
364 (not in POSIX; 027, ETB, Ctrl-W) Word erase (WERASE). Recog‐
365 nized when ICANON and IEXTEN are set, and then not passed as in‐
366 put.
367
368 An individual terminal special character can be disabled by setting the
369 value of the corresponding c_cc element to _POSIX_VDISABLE.
370
371 The above symbolic subscript values are all different, except that
372 VTIME, VMIN may have the same value as VEOL, VEOF, respectively. In
373 noncanonical mode the special character meaning is replaced by the
374 timeout meaning. For an explanation of VMIN and VTIME, see the de‐
375 scription of noncanonical mode below.
376
377 Retrieving and changing terminal settings
378 tcgetattr() gets the parameters associated with the object referred by
379 fd and stores them in the termios structure referenced by termios_p.
380 This function may be invoked from a background process; however, the
381 terminal attributes may be subsequently changed by a foreground
382 process.
383
384 tcsetattr() sets the parameters associated with the terminal (unless
385 support is required from the underlying hardware that is not available)
386 from the termios structure referred to by termios_p. optional_actions
387 specifies when the changes take effect:
388
389 TCSANOW
390 the change occurs immediately.
391
392 TCSADRAIN
393 the change occurs after all output written to fd has been trans‐
394 mitted. This option should be used when changing parameters
395 that affect output.
396
397 TCSAFLUSH
398 the change occurs after all output written to the object re‐
399 ferred by fd has been transmitted, and all input that has been
400 received but not read will be discarded before the change is
401 made.
402
403 Canonical and noncanonical mode
404 The setting of the ICANON canon flag in c_lflag determines whether the
405 terminal is operating in canonical mode (ICANON set) or noncanonical
406 mode (ICANON unset). By default, ICANON is set.
407
408 In canonical mode:
409
410 * Input is made available line by line. An input line is available
411 when one of the line delimiters is typed (NL, EOL, EOL2; or EOF at
412 the start of line). Except in the case of EOF, the line delimiter is
413 included in the buffer returned by read(2).
414
415 * Line editing is enabled (ERASE, KILL; and if the IEXTEN flag is set:
416 WERASE, REPRINT, LNEXT). A read(2) returns at most one line of in‐
417 put; if the read(2) requested fewer bytes than are available in the
418 current line of input, then only as many bytes as requested are read,
419 and the remaining characters will be available for a future read(2).
420
421 * The maximum line length is 4096 chars (including the terminating new‐
422 line character); lines longer than 4096 chars are truncated. After
423 4095 characters, input processing (e.g., ISIG and ECHO* processing)
424 continues, but any input data after 4095 characters up to (but not
425 including) any terminating newline is discarded. This ensures that
426 the terminal can always receive more input until at least one line
427 can be read.
428
429 In noncanonical mode input is available immediately (without the user
430 having to type a line-delimiter character), no input processing is per‐
431 formed, and line editing is disabled. The read buffer will only accept
432 4095 chars; this provides the necessary space for a newline char if the
433 input mode is switched to canonical. The settings of MIN (c_cc[VMIN])
434 and TIME (c_cc[VTIME]) determine the circumstances in which a read(2)
435 completes; there are four distinct cases:
436
437 MIN == 0, TIME == 0 (polling read)
438 If data is available, read(2) returns immediately, with the
439 lesser of the number of bytes available, or the number of bytes
440 requested. If no data is available, read(2) returns 0.
441
442 MIN > 0, TIME == 0 (blocking read)
443 read(2) blocks until MIN bytes are available, and returns up to
444 the number of bytes requested.
445
446 MIN == 0, TIME > 0 (read with timeout)
447 TIME specifies the limit for a timer in tenths of a second. The
448 timer is started when read(2) is called. read(2) returns either
449 when at least one byte of data is available, or when the timer
450 expires. If the timer expires without any input becoming avail‐
451 able, read(2) returns 0. If data is already available at the
452 time of the call to read(2), the call behaves as though the data
453 was received immediately after the call.
454
455 MIN > 0, TIME > 0 (read with interbyte timeout)
456 TIME specifies the limit for a timer in tenths of a second.
457 Once an initial byte of input becomes available, the timer is
458 restarted after each further byte is received. read(2) returns
459 when any of the following conditions is met:
460
461 * MIN bytes have been received.
462
463 * The interbyte timer expires.
464
465 * The number of bytes requested by read(2) has been received.
466 (POSIX does not specify this termination condition, and on
467 some other implementations read(2) does not return in this
468 case.)
469
470 Because the timer is started only after the initial byte becomes
471 available, at least one byte will be read. If data is already
472 available at the time of the call to read(2), the call behaves
473 as though the data was received immediately after the call.
474
475 POSIX does not specify whether the setting of the O_NONBLOCK file sta‐
476 tus flag takes precedence over the MIN and TIME settings. If O_NON‐
477 BLOCK is set, a read(2) in noncanonical mode may return immediately,
478 regardless of the setting of MIN or TIME. Furthermore, if no data is
479 available, POSIX permits a read(2) in noncanonical mode to return ei‐
480 ther 0, or -1 with errno set to EAGAIN.
481
482 Raw mode
483 cfmakeraw() sets the terminal to something like the "raw" mode of the
484 old Version 7 terminal driver: input is available character by charac‐
485 ter, echoing is disabled, and all special processing of terminal input
486 and output characters is disabled. The terminal attributes are set as
487 follows:
488
489 termios_p->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP
490 | INLCR | IGNCR | ICRNL | IXON);
491 termios_p->c_oflag &= ~OPOST;
492 termios_p->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
493 termios_p->c_cflag &= ~(CSIZE | PARENB);
494 termios_p->c_cflag |= CS8;
495
496 Line control
497 tcsendbreak() transmits a continuous stream of zero-valued bits for a
498 specific duration, if the terminal is using asynchronous serial data
499 transmission. If duration is zero, it transmits zero-valued bits for
500 at least 0.25 seconds, and not more than 0.5 seconds. If duration is
501 not zero, it sends zero-valued bits for some implementation-defined
502 length of time.
503
504 If the terminal is not using asynchronous serial data transmission, tc‐
505 sendbreak() returns without taking any action.
506
507 tcdrain() waits until all output written to the object referred to by
508 fd has been transmitted.
509
510 tcflush() discards data written to the object referred to by fd but not
511 transmitted, or data received but not read, depending on the value of
512 queue_selector:
513
514 TCIFLUSH
515 flushes data received but not read.
516
517 TCOFLUSH
518 flushes data written but not transmitted.
519
520 TCIOFLUSH
521 flushes both data received but not read, and data written but
522 not transmitted.
523
524 tcflow() suspends transmission or reception of data on the object re‐
525 ferred to by fd, depending on the value of action:
526
527 TCOOFF suspends output.
528
529 TCOON restarts suspended output.
530
531 TCIOFF transmits a STOP character, which stops the terminal device from
532 transmitting data to the system.
533
534 TCION transmits a START character, which starts the terminal device
535 transmitting data to the system.
536
537 The default on open of a terminal file is that neither its input nor
538 its output is suspended.
539
540 Line speed
541 The baud rate functions are provided for getting and setting the values
542 of the input and output baud rates in the termios structure. The new
543 values do not take effect until tcsetattr() is successfully called.
544
545 Setting the speed to B0 instructs the modem to "hang up". The actual
546 bit rate corresponding to B38400 may be altered with setserial(8).
547
548 The input and output baud rates are stored in the termios structure.
549
550 cfgetospeed() returns the output baud rate stored in the termios struc‐
551 ture pointed to by termios_p.
552
553 cfsetospeed() sets the output baud rate stored in the termios structure
554 pointed to by termios_p to speed, which must be one of these constants:
555
556 B0
557 B50
558 B75
559 B110
560 B134
561 B150
562 B200
563 B300
564 B600
565 B1200
566 B1800
567 B2400
568 B4800
569 B9600
570 B19200
571 B38400
572 B57600
573 B115200
574 B230400
575
576 The zero baud rate, B0, is used to terminate the connection. If B0 is
577 specified, the modem control lines shall no longer be asserted. Nor‐
578 mally, this will disconnect the line. CBAUDEX is a mask for the speeds
579 beyond those defined in POSIX.1 (57600 and above). Thus, B57600 &
580 CBAUDEX is nonzero.
581
582 cfgetispeed() returns the input baud rate stored in the termios struc‐
583 ture.
584
585 cfsetispeed() sets the input baud rate stored in the termios structure
586 to speed, which must be specified as one of the Bnnn constants listed
587 above for cfsetospeed(). If the input baud rate is set to zero, the
588 input baud rate will be equal to the output baud rate.
589
590 cfsetspeed() is a 4.4BSD extension. It takes the same arguments as cf‐
591 setispeed(), and sets both input and output speed.
592
594 cfgetispeed() returns the input baud rate stored in the termios struc‐
595 ture.
596
597 cfgetospeed() returns the output baud rate stored in the termios struc‐
598 ture.
599
600 All other functions return:
601
602 0 on success.
603
604 -1 on failure and set errno to indicate the error.
605
606 Note that tcsetattr() returns success if any of the requested changes
607 could be successfully carried out. Therefore, when making multiple
608 changes it may be necessary to follow this call with a further call to
609 tcgetattr() to check that all changes have been performed successfully.
610
612 For an explanation of the terms used in this section, see at‐
613 tributes(7).
614
615 ┌─────────────────────────────────────┬───────────────┬─────────┐
616 │Interface │ Attribute │ Value │
617 ├─────────────────────────────────────┼───────────────┼─────────┤
618 │tcgetattr(), tcsetattr(), tcdrain(), │ Thread safety │ MT-Safe │
619 │tcflush(), tcflow(), tcsendbreak(), │ │ │
620 │cfmakeraw(), cfgetispeed(), │ │ │
621 │cfgetospeed(), cfsetispeed(), │ │ │
622 │cfsetospeed(), cfsetspeed() │ │ │
623 └─────────────────────────────────────┴───────────────┴─────────┘
625 tcgetattr(), tcsetattr(), tcsendbreak(), tcdrain(), tcflush(),
626 tcflow(), cfgetispeed(), cfgetospeed(), cfsetispeed(), and cfse‐
627 tospeed() are specified in POSIX.1-2001.
628
629 cfmakeraw() and cfsetspeed() are nonstandard, but available on the BS‐
630 Ds.
631
633 UNIX V7 and several later systems have a list of baud rates where after
634 the fourteen values B0, ..., B9600 one finds the two constants EXTA,
635 EXTB ("External A" and "External B"). Many systems extend the list
636 with much higher baud rates.
637
638 The effect of a nonzero duration with tcsendbreak() varies. SunOS
639 specifies a break of duration * N seconds, where N is at least 0.25,
640 and not more than 0.5. Linux, AIX, DU, Tru64 send a break of duration
641 milliseconds. FreeBSD and NetBSD and HP-UX and MacOS ignore the value
642 of duration. Under Solaris and UnixWare, tcsendbreak() with nonzero
643 duration behaves like tcdrain().
644
646 On the Alpha architecture before Linux 4.16 (and glibc before 2.28),
647 the XTABS value was different from TAB3 and it was ignored by the N_TTY
648 line discipline code of the terminal driver as a result (because as it
649 wasn't part of the TABDLY mask).
650
652 reset(1), setterm(1), stty(1), tput(1), tset(1), tty(1), ioctl_con‐
653 sole(2), ioctl_tty(2), setserial(8)
654
656 This page is part of release 5.10 of the Linux man-pages project. A
657 description of the project, information about reporting bugs, and the
658 latest version of this page, can be found at
659 https://www.kernel.org/doc/man-pages/.
660
661
662
663Linux 2020-08-13 TERMIOS(3)