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