termio.7 (2010 09)

t
termio(7) termio(7)
When the MAX_CANON limit is reached, all characters in the current undelimited line are discarded
without notice.
Erase and kill processing occur when any of three special characters, the ERASE, WERASE, or KILL
characters (see Special Characters ), is received. This processing affects data in the input queue that has
not yet been delimited by a NL, EOF, EOL, or EOL2 character. This undelimited data makes up the
current line. The ERASE character deletes the last character in the current line, if one exists. The
WERASE character deletes the last word in the current line, if one exists. A word is defined as a series of
non-blank characters (tabs are equivalent to blanks). The KILL character deletes all data in the current
line, if any, and optionally outputs a new-line (NL) character. These characters operate on a key-stroke
basis, independent of any backspacing or tabbing that may have preceded them. ERASE, WERASE, and
KILL characters have no effect if the current line is empty. ERASE, WERASE, and KILL characters are
not placed in the input queue.
Non-Canonical Mode Input Processing (MIN/TIME Interaction)
In non-canonical mode input processing, input characters are not assembled into lines, and erase and kill
processing does not occur. The values of the
MIN and TIME members of the c_cc array (see termios
Structure ) are used to determine how to process the characters received.
MIN represents the minimum
number of characters that should be received before
read() successfully returns. TIME is a timer of
0.10 second granularity that is used to timeout bursty and short term data transmissions. The four possi-
ble cases for MIN and TIME and their interactions are described below.
Case A: MIN > 0, TIME > 0
In this case, TIME serves as an inter-character timer and is activated after the first character is received.
Since it is an inter-character timer, it is reset after each character is received. The interaction between
MIN and TIME is as follows:
• As soon as one character is received, the inter-character timer is started.
• If MIN characters are received before the inter-character timer expires (remember that the timer is
reset upon receipt of each character), the read is satisfied. If the timer expires before MIN charac-
ters are received, the characters received to that point are returned to the user.
• Note that if TIME expires, at least one character will be returned because the timer would not have
been enabled unless a character was received. In this case ( MIN > 0, TIME > 0 ) the read blocks
until the MIN and TIME mechanisms are activated by the receipt of the first character, or a signal
is received.
Case B: MIN > 0, TIME = 0
In this case, since the value of TIME is zero, the timer plays no role and only MIN is significant. A pend-
ing read is not satisfied until MIN characters are received after any previous read completes (that is, the
pending read blocks until MIN characters are received), or a signal is received. A program that uses this
case to handle record-based terminal I/O can block indefinitely in the read operation.
Case C: MIN = 0, TIME > 0
In this case, since the value of MIN is zero, TIME no longer represents an inter-character timer. It now
serves as a read timer that is activated as soon as the
read() function is processed. A read is satisfied
as soon as a single character is received or the read timer expires. If the timer expires, no character is
returned. If the timer does not expire, the only way the read can be satisfied is by a character being
received. A read cannot block indefinitely waiting for a character because if no character is received
within TIME × 0.10 seconds after the read is initiated, read() returns a value of zero, having read no
data.
Case D: MIN = 0, TIME = 0
The number of characters requested or the number of characters currently available, whichever is less, is
returned without waiting for more characters to be input. If no characters are available,
read()
returns a value of zero, having read no data.
Some points to note about MIN and TIME:
1. In the above explanations, the interactions of MIN and TIME are not symmetric. For example,
when MIN > 0 and TIME = 0, TIME has no effect. However, in the opposite case where MIN = 0
and TIME > 0, both MIN and TIME play a role in that MIN is satisfied with the receipt of a single
character.
HP-UX 11i Version 3: September 2010 − 3 − Hewlett-Packard Company 3