Open System Services System Calls Reference Manual (G06.25+, H06.03+)
readv(2) OSS System Calls Reference Manual
— If the O_NONBLOCK flag is not set, the readv() 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 flag is set, the readv() 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 flag is not set, the readv() function blocks until data becomes
available.
• If the O_NONBLOCK flag is set, the readv() function returns the value -1 and sets
errno to [EAGAIN]. The O_NONBLOCK flag has no effect if there is data available.
When attempting to read from a character special file that supports nonblocking reads, such as a
terminal, and no data is currently available:
• If the O_NONBLOCK flag is not set, the readv() function blocks until data becomes
available.
• If the O_NONBLOCK flag is set, the readv() function returns the value -1 and sets
errno to [EAGAIN]. The O_NONBLOCK flag has no effect if there is data available.
If it is interrupted by a signal before it reads any data, the readv() 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 readv() function returns the number of bytes read.
When reading from a device special file, the return of EOF has no effect on subsequent calls to
the readv() function. When modem disconnect is detected, an EOF is returned. The errno vari-
able is not set to [EIO].
Upon successful completion, the readv() function marks the st_atime field of the file for update.
The iov_count parameter specifies the number of entries (buffers) in the iovec structure pointed
to by the iov parameter. Each iovec entry specifies the base address and length of an area in
memory where data should be placed. The readv() function always fills a buffer completely
before proceeding to the next.
The iovec structure is defined in the sys/uio.h header file and contains entries with these
members:
caddr_t iov_base;
int iov_len;
Use on Guardian Objects
After a call to the fork(), tdm_fork( ),ortdm_spawn() function, the initial position within a
Guardian EDIT file (a file in /G with file code 101) is the same for both parent and child
processes. However, the position is not shared; moving the current position from within one pro-
cess does not move it in the other process.
RETURN VALUES
Upon successful completion, the readv() function returns the number of bytes actually read and
placed into the buffers. The function guarantees to read the number of bytes requested only if the
descriptor references a regular file that has at least that number of bytes left before EOF.
If a regular file does not contain enough bytes to satisfy the read or if the read otherwise fails, the
value -1 is returned, errno is set to indicate the error, and the contents of the buffers are indeter-
minate.
6−10 Hewlett-Packard Company 527186-003