These functions perform miscellaneous control actions on terminal devices. As regards terminal access, they are treated like doing output: if any of these functions is used by a background process on its controlling terminal, normally all processes in the process group are sent a SIGTTOU
signal. The exception is if the calling process itself is ignoring or blocking SIGTTOU
signals, in which case the operation is performed and no signal is sent. See Job Control.
This function does nothing if the terminal is not an asynchronous serial data port.
The return value is normally zero. In the event of an error, a value of -1
is returned. The following errno
error conditions are defined for this function:
EBADF
ENOTTY
tcdrain
function waits until all queued output to the terminal filedes has been transmitted.
The return value is normally zero. In the event of an error, a value of -1
is returned. The following errno
error conditions are defined for this function:
EBADF
ENOTTY
EINTR
tcflush
function is used to clear the input and/or output queues associated with the terminal file filedes. The queue argument specifies which queue(s) to clear, and can be one of the following values:
TCIFLUSH
Clear any input data received, but not yet read.
TCOFLUSH
Clear any output data written, but not yet transmitted.
TCIOFLUSH
Clear both queued input and output.
The return value is normally zero. In the event of an error, a value of -1
is returned. The following errno
error conditions are defined for this function:
EBADF
ENOTTY
EINVAL
It is unfortunate that this function is named tcflush
, because the term ``flush'' is normally used for quite another operation---waiting until all output is transmitted---and using it for discarding input or output would be confusing. Unfortunately, the name tcflush
comes from POSIX and we cannot change it.
tcflow
function is used to perform operations relating to XON/XOFF flow control on the terminal file specified by filedes. The action argument specifies what operation to perform, and can be one of the following values:
TCOOFF
TCOON
TCIOFF
TCION
For more information about the STOP and START characters, see Special Characters.
The return value is normally zero. In the event of an error, a value of -1
is returned. The following errno
error conditions are defined for this function:
EBADF
ENOTTY
EINVAL