IO_GET_TERM_REASON(3I) — HP-UX
NAME
io_get_term_reason − determine how last read terminated
SYNOPSIS
int io_get_term_reason (eid);
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 or GPIO device file obtained from an open(2), dup(2), fcntl(2), or creat(2) call.
All entity ids descending from an open(2) request (such as from dup(2) or fork(2)) set this status. For example, if the calling process had opened this entity id, 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 id 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 in square brackets:
[EBADF] eid does not refer to an open file.
[ENOTTY] eid does not refer to a channel device file.
DEPENDENCIES
Series 300
For the GPIO interface, PSTS is checked only at the beginning of a transfer. An interrupt caused by an EIR will also terminate a transfer. The value of the termination reason in this case is also 4.
AUTHOR
Io_get_term_reason was developed by HP.
SEE ALSO
Hewlett-Packard Company — May 11, 2021