Go to the previous, next section.

I/O Queues

Many of the remaining functions in this section refer to the input and output queues of a terminal device. These queues implement a form of buffering within the kernel independent of the buffering implemented by I/O streams (see section Input/Output on Streams).

The terminal input queue is also sometimes referred to as its typeahead buffer. It holds the characters that have been received from the terminal but not yet read by any process.

The size of the terminal's input queue is described by the _POSIX_MAX_INPUT and MAX_INPUT parameters; see section Limits on File System Capacity. If input flow control is enabled by setting the IXOFF input mode bit (see section Input Modes), the terminal driver transmits STOP and START characters to the terminal when necessary to prevent the queue from overflowing. Otherwise, input may be lost if it comes in too fast from the terminal. (This is unlikely if you are typing the input by hand!)

The terminal output queue is like the input queue, but for output; it contains characters that have been written by processes, but not yet transmitted to the terminal. If output flow control is enabled by setting the IXON input mode bit (see section Input Modes), the terminal driver obeys STOP and STOP characters sent by the terminal to stop and restart transmission of output.

Clearing the terminal input queue means discarding any characters that have been received but not yet read. Similarly, clearing the terminal output queue means discarding any characters that have been written but not yet transmitted.

Go to the previous, next section.