TERMIOS(3) Linux Programmer's Manual TERMIOS(3)
NAME
termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow, cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed, cfset-
speed - get and set terminal attributes, line control, get and set baud rate
SYNOPSIS
#include <termios.h>
#include <unistd.h>
int tcgetattr(int fd, struct termios *termios_p);
int tcsetattr(int fd, int optional_actions,
const struct termios *termios_p);
int tcsendbreak(int fd, int duration);
int tcdrain(int fd);
int tcflush(int fd, int queue_selector);
int tcflow(int fd, int action);
void cfmakeraw(struct termios *termios_p);
speed_t cfgetispeed(const struct termios *termios_p);
speed_t cfgetospeed(const struct termios *termios_p);
int cfsetispeed(struct termios *termios_p, speed_t speed);
int cfsetospeed(struct termios *termios_p, speed_t speed);
int cfsetspeed(struct termios *termios_p, speed_t speed);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
cfsetspeed(), cfmakeraw():
Since glibc 2.19:
_DEFAULT_SOURCE
Glibc 2.19 and earlier:
_BSD_SOURCE
DESCRIPTION
The termios functions describe a general terminal interface that is provided to control asynchronous communications ports.
The termios structure
Many of the functions described here have a termios_p argument that is a pointer to a termios structure. This structure contains at least
the following members:
tcflag_t c_iflag; /* input modes */
tcflag_t c_oflag; /* output modes */
tcflag_t c_cflag; /* control modes */
tcflag_t c_lflag; /* local modes */
cc_t c_cc[NCCS]; /* special characters */
The values that may be assigned to these fields are described below. In the case of the first four bit-mask fields, the definitions of
some of the associated flags that may be set are exposed only if a specific feature test macro (see feature_test_macros(7)) is defined, as
noted in brackets ("[]").
In the descriptions below, "not in POSIX" means that the value is not specified in POSIX.1-2001, and "XSI" means that the value is speci-
fied in POSIX.1-2001 as part of the XSI extension.
c_iflag flag constants:
IGNBRK Ignore BREAK condition on input.
BRKINT If IGNBRK is set, a BREAK is ignored. If it is not set but BRKINT is set, then a BREAK causes the input and output queues to be
flushed, and if the terminal is the controlling terminal of a foreground process group, it will cause a SIGINT to be sent to this
foreground process group. When neither IGNBRK nor BRKINT are set, a BREAK reads as a null byte ('