Open System Services System Calls Reference Manual (G06.28+)

read(2) OSS System Calls Reference Manual
If no process has the pipe open for writing, the read() function returns the value 0 (zero)
to indicate EOF.
If some process has the pipe open for writing:
If the O_NONBLOCK ag is not set, the read() function blocks until either
some data is written or the pipe is closed by all processes that had opened the
pipe for writing.
If the O_NONBLOCK ag is set, the read() function returns the value -1 and
sets errno to [EAGAIN].
When attempting to read from a socket and no data is currently available:
If the O_NONBLOCK ag is not set, the read() function blocks until data becomes
available or an error occurs.
If the O_NONBLOCK ag is set, the read() function returns the value -1 and sets errno
to [EWOULDBLOCK].
When attempting to read from a character special le that supports nonblocking reads, such as a
terminal, and no data is currently available:
If the O_NONBLOCK ag is not set, the read() function blocks until data becomes
available or an error occurs.
If the O_NONBLOCK ag is set, the read() function returns the value -1 and sets errno
to [EAGAIN].
If it is interrupted by a signal before it reads any data, the read() function returns the value -1
with errno set to [EINTR]. If it is interrupted by a signal after it has successfully read some
data, the read() function returns the number of bytes read.
The read() function returns the number of bytes with the value 0 (zero) for any unwritten portion
of a regular le prior to EOF.
When reading from a device special le, the return of EOF has no effect on subsequent calls to
the read() function. When modem disconnect is detected, an EOF is returned. The errno vari-
able is not set to [EIO].
Upon successful completion, the read() function marks the st_atime eld of the le for update.
Use on Guardian Objects
After a call to the fork(), tdm_fork( ),ortdm_spawn( ) function, the initial position within a
Guardian EDIT le (a le in /G with le code 101) is the same for both parent and child
processes. However, the position is not shared. Moving the current position from within one
process does not move it in the other process.
RETURN VALUES
Upon successful completion, the read() function returns the number of bytes actually read and
placed into the buffer. The function guarantees to read the number of bytes requested only if the
descriptor references a regular le that has at least that number of bytes left before EOF.
If the read otherwise fails, the value -1 is returned, errno is set to indicate the error, and the con-
tents of the buffer pointed to by the buffer parameter are indeterminate.
ERRORS
If any of these conditions occurs, the read() function sets errno to the corresponding value:
64 Hewlett-Packard Company 527186-005