DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Terminal device control

Input processing and reading data

A terminal-device accessed through an open terminal-device-file ordinarily operates in full-duplex mode. This means data may arrive at any time, even while output is occurring. Each terminal-device-file has associated with it an ``input-queue'', into which the system stores incoming data before the process reads that data. The system imposes a limit of MAX_INPUT, the maximum allowable number of bytes of input data, on the number of bytes of data that it stores in the input-queue. Data is lost only when the input-queue becomes completely full, or when an input line exceeds MAX_INPUT. The behavior of the system when this limit is exceeded is implementation-dependent.

In UNIX System V, if the data in the terminal-device-file input-queue exceeds MAX_INPUT and IMAXBEL is clear, all the bytes of data saved up to that point are discarded without any notice, but if IMAXBEL is set and the data in the terminal-device-file input-queue exceeds MAX_INPUT, the ASCII BEL character is echoed. Further input is not stored, and any data already present in the input-queue remains undisturbed.

Two general kinds of input processing are available, determined by whether the terminal-device-file is operating in canonical mode or non-canonical mode. These modes are described in ``Canonical mode input processing'' and ``Non-canonical mode input processing''. Additionally, input is processed according to the c_iflag and c_lflag fields (see ``Input modes'' and ``Local modes and line disciplines'' in termio(M)). Such processing can include ``echoing'', which in general means transmitting input data bytes immediately back to the terminal when they are received from the terminal. This is useful for terminals that can operate in full-duplex mode.

The way a process reading from a terminal-device-file gets data depends on whether the terminal-device-file is operating in canonical mode or non-canonical mode. How read operates on a terminal-device-file also depends on how open(S) or fcntl(S) sets the flag O_NONBLOCK for the file:

When data become available depends on whether the input-processing mode is canonical or non-canonical. The following sections, ``Canonical mode input processing'' and ``Non-canonical mode input processing'', describe each of these input-processing modes.


Next topic: Canonical mode input processing
Previous topic: Opening a terminal device file

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005