io_get_term_reason(3I) — Series 300, 400, 800 Only
NAME
io_get_term_reason() − determine how last read terminated
SYNOPSIS
#include <dvio.h>
int io_get_term_reason(int eid);
DESCRIPTION
io_get_term_reason() returns the termination reason for the last read made on this entity id. eid is an entity identifier of an open HP-IB raw bus, Centronics-compatible parallel interface, or GPIO device file obtained from an open(), dup(), fcntl(), or creat() call.
All entity identifiers descending from an open() request (such as from dup() or fork()) set this status. For example, if the calling process had opened this entity identifier and later forked, the status returned would be from the last read done by either the calling process or its child.
RETURN VALUE
io_get_term_reason() returns a value indicating how the last read on the specified entity identifier was terminated. This value is interpreted as follows (note that combinations are possible):
| Value | Description |
| −1 | An error was encountered while making this function request. |
| 0 | Last read encountered some abnormal termination reason not covered by any of the other reasons. |
| 1 | Last read terminated by reading the number of bytes requested. |
| 2 | Last read terminated by detecting the specified termination character. |
| 4 | Last read terminated by detecting some device-imposed termination condition. Examples are: EOI for HP-IB, PSTS line on GPIO, or some other end-of-record condition, such as the physical end-of-record mark on a 9-track tape. |
ERRORS
io_get_term_reason() fails under the following circumstances, and sets errno (see errno(2)) to the value indicated:
[EBADF] eid does not refer to an open file.
[ENOTTY] eid does not refer to a channel device file.
DEPENDENCIES
Series 300/400:
For the GPIO interface, PSTS is checked only at the beginning of a transfer. An interrupt caused by an EIR also terminates a transfer. The value of the termination reason in this case is also 4.
For the Centronics-compatible parallel interface, a termination reason value of 4 indicates that the transfer terminated because the peripheral asserted the ACK line.
AUTHOR
io_get_term_reason() was developed by HP.
SEE ALSO
dup(2), creat(2), fcntl(2), open(2), read(2), io_eol_ctl(3I).
Hewlett-Packard Company — HP-UX Release 9.0: August 1992