82 lines · 1.4 KB · Text
RawDownload
.TH READV 2.SH NAMEreadv, writev, preadv, pwritev \- scatter/gather read and write.SH SYNOPSIS.B #include <u.h>.br.B #include <libc.h>.PP.nf.ft Ltypedefstruct IOchunk{	void		*addr;	ulong	len;} IOchunk;.fi.PP.Blong readv(int fd, IOchunk *io, int nio).PP.Blong preadv(int fd, IOchunk *io, int nio, vlong off).PP.Blong writev(int fd, IOchunk *io, int nio).PP.Blong pwritev(int fd, IOchunk *io, int nio, vlong off).SH DESCRIPTIONThese functions supplement the standard read and write operations of.IR read (2)with facilities for scatter/gather I/O.The set of I/O buffers is collected into an array of.B IOchunkstructures passed as an argument..PP.I Readvreads data from.I fdand returns the total number of bytes received.The received data is stored in the successive.I nioelements of the.B IOchunkarray, storing.IB io [0].lenbytes at.IB io [0].addr\f1,the next.IB io [1].lenat.IB io [1].addr\f1,and so on..I Preadvdoes the same, but implicitly seeks to I/O offset.I offby analogy with.IR readv ..PP.I Writevand.I pwritevare the analogous write routines..SH SOURCE.B /sys/src/libc/9sys/readv.c.br.B /sys/src/libc/9sys/writev.c.SH SEE ALSO.IR intro (2),.IR read (2).SH DIAGNOSTICSThese functions set.IR errstr ..SH BUGSThe implementations use.IR malloc (2)to build a single buffer for a standard call to.B reador.BR write .They are placeholders for possible future system calls.