Open System Services System Calls Reference Manual (G06.25+, H06.03+)
System Functions (r) readv(2)
NAME
readv - Reads from a file into scattered buffers
LIBRARY
G-series native OSS processes: /G/system/sysnn/zossesrl
H-series OSS processes: /G/system/zdllnnn/zossedll
SYNOPSIS
#include <sys/types.h>
#include <sys/uio.h>
int readv(
int filedes,
struct iovec *iov,
int iov_count);
PARAMETERS
filedes Specifies an open file descriptor obtained from a successful call to the accept(),
creat(), dup( ), dup2( ), fcntl( ), open(), pipe( ), socket(),orsocketpair() func-
tion.
iov Points to an iovec structure that identifies the buffers into which the data is to be
placed.
iov_count Specifies the number of entries in the iovec structure pointed to by the iov
parameter.
DESCRIPTION
The readv() function attempts to read data from the file associated with the filedes parameter
into a set of buffers. The readv() function performs the same action as the read() function, but
it scatters the input data into the buffers specified by the array of iovec structure entries pointed
to by the iov parameter.
On regular files and devices capable of seeking, the readv() function starts at a position in the
file given by the file pointer associated with the filedes parameter. Upon return from the readv()
function, the file pointer is incremented by the number of bytes actually read.
Devices that are incapable of seeking always read from the current position. For such devices,
the value of the file pointer after a call to the readv() function is always 0 (zero).
Upon successful completion, the readv() function returns the number of bytes actually read and
placed in the buffers.
No data transfer occurs past the current end-of-file (EOF). If the starting position is at or after the
end-of-file, 0 (zero) is returned.
If a write( ) or writev( ) call contains so much data that the file system needs to resize a pipe or
FIFO buffer, a read from that pipe or FIFO file can return up to 52 kilobytes of data, regardless of
the size of PIPE_BUF. If the buffer cannot be resized for the write operation, a subsequent read
from the pipe or FIFO file does not return more than 8192 bytes per call, regardless of the setting
of O_NONBLOCK.
When attempting to read from an empty pipe (or FIFO file):
• If no process has the pipe open for writing, the readv() function returns the value 0
(zero) to indicate EOF.
• If some process has the pipe open for writing:
527186-003 Hewlett-Packard Company 6−9