467
Appendix A HIF Service Calls
quest will immediately return after passing the buffer address and file descriptor to
the operating system, leaving the scheduling of the operation up to the HIF imple-
mentation.
lseek
operations can also be serviced in ASYNC mode. The completion
status of these operations can be tested by issuing an
iowait
service request (HIF ser-
vice number 25). When a
read
or
write
operation is issued for a file descriptor whose
operating mode is ASYNC, the
count
returned in
gr96
will be 0 if the operation was
accepted, or less than 0 if the operation was rejected. An
iowait
service should be
issued to ascertain the number of bytes that have been transferred upon completion of
the operation.
The default I/O processing mode is COOKED (0x0000), which implies that the
HIF implementation examines input and output data characters as they are received,
or before they are sent, and may perform some alteration of the data. Specific alter-
ations are not explicitly indicated in this specification; however, it is common to per-
form end-of-line processing for files whose operating mode is COOKED. ASCII car-
riage-return and line-feed translations are common, as may be the translation of
ASCII TAB characters to a number of equivalent spaces. When RAW mode is se-
lected, no translation of input or output characters will be performed by HIF-con-
forming implementations.
Normally, when a
read
operation is issued for a terminal-like device by the ap-
plication program, the processor will block any further execution of the subject pro-
gram until the data has been transferred. The NBLOCK mode is intended to specify
for terminal-like devices that subsequent
read
operations be executed without sus-
pending (blocking) further CPU operation. This is particularly relevant to
read
op-
erations when RAW mode is also selected. If NBLOCK mode has been specified, a
subsequent
read
operation will return (in
gr96
) the number of characters currently
available, or –1 if none are available. NBLOCK mode is not meaningful for
write
operations, but they are handled in the same fashion as synchronous or asynchronous
operations, depending on whether ASYNC mode was specified.
RAW mode delivers the characters to/from the I/O device without conversion or
interpretation of any kind.
If COOKED mode has been selected, line-buffering is implied. If NBLOCK is
also selected, a subsequent
read
operation will return –1 for the
count
, unless an en-
tire line of input is available.
The ECHO mode applies only to the standard input device (file descriptor = 0),
and makes provision to automatically echo data received from that device to the stan-
dard output device (file descriptor = 1). ECHO mode is undefined for any other file
descriptor.
The CBREAK mode is intended for file descriptors that refer to serial commu-
nication channels. CBREAK mode specifies that I/O signal inputs will be processed,
which could alter the data stream.