Sets terminal state.
Standard C Library (libc.a)
#include <termios.h>
int tcsetattr (FileDescriptor, OptionalActions, TermiosPointer)
int FileDescriptor, OptionalActions;
const struct termios * TermiosPointer;
The tcsetattr subroutine sets the parameters associated with the object referred to by the FileDescriptor parameter (unless support required from the underlying hardware is unavailable), from the termios structure referenced by the TermiosPointer parameter.
The value of the OptionalActions parameter determines how the tcsetattr subroutine is handled.
The 0 baud rate (B0) is used to terminate the connection. If B0 is specified as the output baud rate when the tcsetattr subroutine is called, the modem control lines are no longer asserted. Normally, this disconnects the line.
Using 0 as the input baud rate in the termios structure to cause tcsetattr to change the input baud rate to the same value as that specified by the value of the output baud rate, is obsolete.
If an attempt is made using the tcsetattr subroutine to set:
but the tcsetattr subroutine is able to perform some of the requested actions, then the subroutine returns successfully, having set all supported attributes and leaving the above unsupported attributes unchanged.
If no part of the request can be honored, the tcsetattr subroutine returns a value of -1 and the errno global variable is set to EINVAL.
If the input and output baud rates differ and are a combination that is not supported, neither baud rate is changed. A subsequent call to the tcgetattr subroutine returns the actual state of the terminal device (reflecting both the changes made and not made in the previous tcsetattr call). The tcsetattr subroutine does not change the values in the termios structure whether or not it actually accepts them.
If the tcsetattr subroutine is called by a process which is a member of a background process group on a FileDescriptor associated with its controlling terminal, a SIGTTOU signal is sent to the background process group. If the calling process is blocking or ignoring SIGTTOU signals, the process performs the operation and no signal is sent.
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.
The tcsetattr subroutine is unsuccessful if one of the following is true:
To set the terminal state after the current output completes, enter:
rc = tcsetattr(stdout, TCSADRAIN, &my_termios);
The cfgetispeed subroutine, tcgetattr (tcgetattr Subroutine) subroutine.
The Input and Output Handling Programmer's Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.