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