Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ io_get_term(3I) — HP-UX 6.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

read(2)

io_eol_ctl(3I)

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.

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(3I)),  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 value of the termination reason is 0. 

The GPIO interface does not support this function. 

AUTHOR

Io_get_term_reason was developed by HP. 

SEE ALSO

read(2), io_eol_ctl(3I). 

Hewlett-Packard Company  —  Version B.1,  May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026