The purpose of this procedure is to “normalise” the queries associated with a particular terminal. Its effect is to terminate transmission to the terminal forthwith and to throw away any accumulated input characters.
Throw away everything in the “cooked” input queue;
ditto for the output queue;
Wakeup any process waiting to extract a character from the “raw” input queue;
ditto for the output queue;
Raise the processor priority to prevent an interrupt from the terminal while ...
the “raw” input queue is flushed,
the “delimiter count” is properly set to zero.
“flushtty” is called by “wflushtty” (see below) and “ttyinput” (8346, 8350) when either:
the terminal is not operating in “raw” mode and a “quit” or “delete” character is received from the terminal; or
the “raw” input queue has grown unreasonably large (presumably because no process is reading input from the terminal);