READV
NAME SYNOPSIS DESCRIPTION RETURN VALUE ERRORS CONFORMING TO SEE ALSO
readv, writev - read or write a vector
#include
int readv(int fd, const struct iovec * vector, int count);
int writev(int fd, const struct iovec * vector, int count);
struct iovec { ptr_t iov_base;__ /* Starting address.
size_t iov_len;__ /* Length in bytes.
};__
readv reads data from file descriptor fd, and puts the result in the buffers described by vector. The number of buffers is specified by count. The buffers are filled in the order specified. Operates just like read except that data is put in vector instead of a contiguous buffer.
writev writes data to file descriptor fd, and from the buffers described by vector. The number of buffers is specified by count. The buffers are used in the order specified. Operates just like write except that data is taken from vector instead of a contiguous buffer.
On success readv returns the number of bytes read. On success writev returns the number of bytes written. On error, -1 is returned, and errno is set appropriately.
EINVAL
An invalid argument was given. For instance count might be greater than MAX_IOVEC, or zero. fd could also be attached to an object which is unsuitable for reading (for readv) or writing (for writev).
EFAULT
vector or some of the iov_base'' pointers points to memory that is not properly allocated.
EBADF
The file descriptor fd is not valid.
EINTR
The call was interrupted by a signal before any data was read/written.
EAGAIN
Non-blocking I/O has been selected using O_NONBLOCK and no data was immediately available for reading. (Or the file descriptor fd is for an object that is locked.)
EISDIR
fd refers to a directory.
EOPNOTSUP
fd refers to a socket or device that does not support reading/writing.
ENOMEM
Insufficient kernel memory was available.
Other errors may occur, depending on the object connected to fd.
4.4BSD (the readv and writev functions first appeared in BSD 4.2), Unix98. Linux libc5 uses size_t as the type of the count parameter, which is logical but non-standard.
read(2), write(2), fprintf(3), fscanf(3)
3 pages link to writev(2):
lib/main.php:944: Notice: PageInfo: Cannot find action page