1termios(3) Library Functions 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 Standard C library (libc, -lc)
13
15 #include <termios.h>
16 #include <unistd.h>
17
18 int tcgetattr(int fd, struct termios *termios_p);
19 int tcsetattr(int fd, int optional_actions,
20 const struct termios *termios_p);
21
22 int tcsendbreak(int fd, int duration);
23 int tcdrain(int fd);
24 int tcflush(int fd, int queue_selector);
25 int tcflow(int fd, int action);
26
27 void cfmakeraw(struct termios *termios_p);
28
29 speed_t cfgetispeed(const struct termios *termios_p);
30 speed_t cfgetospeed(const struct termios *termios_p);
31
32 int cfsetispeed(struct termios *termios_p, speed_t speed);
33 int cfsetospeed(struct termios *termios_p, speed_t speed);
34 int cfsetspeed(struct termios *termios_p, speed_t speed);
35
36 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
37
38 cfsetspeed(), cfmakeraw():
39 Since glibc 2.19:
40 _DEFAULT_SOURCE
41 glibc 2.19 and earlier:
42 _BSD_SOURCE
43
45 The termios functions describe a general terminal interface that is
46 provided to control asynchronous communications ports.
47
48 The termios structure
49 Many of the functions described here have a termios_p argument that is
50 a pointer to a termios structure. This structure contains at least the
51 following members:
52
53 tcflag_t c_iflag; /* input modes */
54 tcflag_t c_oflag; /* output modes */
55 tcflag_t c_cflag; /* control modes */
56 tcflag_t c_lflag; /* local modes */
57 cc_t c_cc[NCCS]; /* special characters */
58
59 The values that may be assigned to these fields are described below.
60 In the case of the first four bit-mask fields, the definitions of some
61 of the associated flags that may be set are exposed only if a specific
62 feature test macro (see feature_test_macros(7)) is defined, as noted in
63 brackets ("[]").
64
65 In the descriptions below, "not in POSIX" means that the value is not
66 specified in POSIX.1-2001, and "XSI" means that the value is specified
67 in POSIX.1-2001 as part of the XSI extension.
68
69 c_iflag flag constants:
70
71 IGNBRK Ignore BREAK condition on input.
72
73 BRKINT If IGNBRK is set, a BREAK is ignored. If it is not set but
74 BRKINT is set, then a BREAK causes the input and output queues
75 to be flushed, and if the terminal is the controlling terminal
76 of a foreground process group, it will cause a SIGINT to be sent
77 to this foreground process group. When neither IGNBRK nor
78 BRKINT