termio.7 (2010 09)

t
termio(7) termio(7)
function performs the same functions (see tcflow(3C)).
TCFLSH If arg is 0, flush the input queue; if 1, flush the output queue; if 2, flush both the
input and output queues. If any other value is given for arg, the call returns 1
with
errno set to [EINVAL]. The
tcflush() function performs the same func-
tions (see tcflush(3C)).
Sending a BREAK is accomplished by holding the data transmit line at a SPACE or
logical zero condition for at least 0.25 seconds. During this interval, data can be
sent to the device, but because of serial data interface limitations, the BREAK takes
precedence over all data. Thus, all data sent to a device during a BREAK is lost.
This includes system-generated XON/XOFF characters used for input flow control.
Note also that a delay in transmission of the XOFF flow control character until after
the BREAK is terminated could still result in data overflow because the flow control
character may not be sent soon enough.
Other calls have the form:
ioctl (fildes, command, arg)
int *arg;
Commands using this form are:
FIONREAD Returns in the integer referenced by arg the number of characters immediately
readable from the terminal device file. This command is allowed from a background
process; however, the data itself cannot be read from a background process.
Non-blocking I/O IOCTL Commands
Non-blocking I/O is easily provided via the
O_NONBLOCK and O_NDELAY flags available in both
open(2) and fcntl (2). The commands in this section are provided for backward compatibility with previ-
ously developed applications. ioctl() system calls that provide a style of non-blocking I/O different
from
O_NONBLOCK and O_NDELAY have the form:
ioctl (fildes, command, arg)
int *arg;
Commands using this form are:
FIOSNBIO If the integer referenced by arg is non-zero, FIOSNBIO-style non-blocking I/O is
enabled; that is, subsequent reads and writes to the terminal device file are handled
in a non-blocking manner (see below). If the integer referenced by arg is 0,
FIOSNBIO-style non-blocking I/O is disabled.
For reads,
FIOSNBIO-style non-blocking I/O prevents all read requests to that
device file from blocking, whether the requests succeed or fail. Such a read request
completes in one of three ways:
If there is enough data available to satisfy the entire request, the read com-
pletes successfully, having read all of the data, and returns the number of
characters read;
If there is not enough data available to satisfy the entire request, the read
completes successfully, having read as much data as possible, and returns the
number of characters read;
If there is no data available, the read returns 1 with
errno set to
[EWOULDBLOCK].
For writes,
FIOSNBIO-style non-blocking I/O prevents all write requests to that
device file from blocking, whether the requests succeed or fail. Such a write request
completes in one of three ways:
If there is enough space available in the system to buffer all the data, the write
completes successfully, having written out all of the data, and returns the
number of characters written;
If there is not enough space in the buffer to write out the entire request, the
write completes successfully, having written as much data as possible, and
returns the number of characters written;
HP-UX 11i Version 3: September 2010 15 Hewlett-Packard Company 15