NAME
readv, writev, preadv, pwritev – scatter/gather read and write

SYNOPSIS
#include <u.h>
#include <libc.h>

typedef
struct IOchunk
{
void        *addr;
ulong       len;
} IOchunk;

long readv(int fd, IOchunk *io, int nio)

long preadv(int fd, IOchunk *io, int nio, vlong off)

long writev(int fd, IOchunk *io, int nio)

long pwritev(int fd, IOchunk *io, int nio, vlong off)

DESCRIPTION
These functions supplement the standard read and write operations of read(2) with facilities for scatter/gather I/O. The set of I/O buffers is collected into an array of IOchunk structures passed as an argument.

Readv reads data from fd and returns the total number of bytes received. The received data is stored in the successive nio elements of the IOchunk array, storing io[0].len bytes at io[0].addr, the next io[1].len at io[1].addr, and so on. Preadv does the same, but implicitly seeks to I/O offset off by analogy with readv.

Writev and pwritev are the analogous write routines.

SOURCE
/sys/src/libc/9sys/readv.c
/sys/src/libc/9sys/writev.c

SEE ALSO
intro(2), read(2)

DIAGNOSTICS
These functions set errstr.

BUGS
The implementations use malloc(2) to build a single buffer for a standard call to read or write. They are placeholders for possible future system calls.