tcsetattr(3)tcsetattr(3)NAMEtcsetattr - Set the parameters associated with the terminal
SYNOPSIS
#include <termios.h>
int tcsetattr(
int filedes,
int optional_actions,
struct termios *termios_p );
LIBRARY
Standard C Library (libc)
STANDARDS
Interfaces documented on this reference page conform to industry stan‐
dards as follows:
tcsetattr(): XPG4, XPG4-UNIX
Refer to the standards(5) reference page for more information about
industry standards and associated tags.
PARAMETERS
Specifies an open file descriptor associated with a terminal. Speci‐
fies the options defining how the parameters will be set. Points to a
termios structure containing the terminal parameters.
DESCRIPTION
The tcsetattr() function sets the parameters associated with the termi‐
nal referred to by the open file descriptor filedes from the termios
structure referenced by termios_p as follows: If optional_actions is
TCSANOW, the change will occur immediately. If optional_actions is
TCSADRAIN, the change will occur after all output written to filedes
has been transmitted. This function should be used when changing param‐
eters that affect output. If optional_actions is TCSAFLUSH, the change
will occur after all output written to filedes has been transmitted,
and all input so far received but not read will be discarded before the
change is made.
If the output baud rate stored in the termios structure pointed to by
the termios_p parameter is the zero baud rate, B0, the modem control
lines will no longer be asserted. Normally, this will disconnect the
line.
If the input baud rate stored in the termios structure pointed to by
the termios_p parameter is 0 (zero), the input baud rate given to the
hardware will be the same as the output baud rate stored in the termios
structure.
Attempts to use the tcsetattr() function from a process which is a mem‐
ber of a background process group on a filedes associated with its con‐
trolling terminal causes the process group to be sent a SIGTTOU signal.
If the calling process is blocking or ignoring SIGTTOU signals, the
process is allowed to perform the operation and no signal is sent.
RETURN VALUES
Upon successful completion, 0 (zero) is returned. Otherwise, -1 is
returned and errno is set to indicate the error.
ERRORS
The tcsetattr() function sets errno to the specified values for the
following conditions:
The filedes parameter is not a valid file descriptor. A signal inter‐
rupted tcsetattr(). The optional_actions parameter is not a proper
value, or an attempt was made to change an attribute represented in the
termios structure to an unsupported value. The file associated with
the filedes parameter is not a terminal.
SEE ALSO
Functions: cfgetispeed(3)tcgetattr(3)
Standards: standards(5)tcsetattr(3)