IO_GET_TERM_REASON(3D)
NAME
io_get_term_reason − determine how last read terminated
SYNOPSIS
int io_get_term_reason (eid);
int eid;
HP-UX COMPATIBILITY
Level: Device I/O Library − HP-UX/EXTENDED
Origin: HP
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 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.
HARDWARE DEPENDENCIES
Series 500:
If the last read had multiple applicable termination reasons, such as having EOI asserted on the last byte when that byte was the termination match character (see io_eol_ctl(3)), the highest numbered reason is used (in this case, 4). Since interactive terminals are treated as record-oriented devices when they are in cooked mode, the termination reason is 4 when terminated by a new-line character. If no read has been done on the entity id since it was opened, the termination reason is 0.
SEE ALSO
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.
DIAGNOSTICS
Io_get_term_reason fails under the following circumstances, and sets errno (see errno(2)) to the value in square brackets:
eid does not refer to an open file [EBADF];
eid does not refer to a channel device file [ENOTTY].
Hewlett-Packard — last mod. May 11, 2021