.\" (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" License. .\" Modified Sat Jul 24 18:34:44 1993 by Rik Faith (faith@cs.unc.edu) .TH READV 3 "April 25, 1993" "GNU" "Linux Programmer's Manual" .SH NAME readv, writev \- read or write data into multiple buffers .SH SYNOPSIS .nf .B #include .sp .BI "int readv(int " filedes ", const struct iovec *" vector "," .BI " size_t " count ");" .sp .BI "int writev(int " filedes ", const struct iovec *" vector "," .BI " size_t " count ");" .fi .SH DESCRIPTION The .B readv() function reads .I count blocks from the file associated with the file descriptor .I filedes into the multiple buffers described by .IR vector . .PP The .B writev() function writes at most .I count blocks described by .I vector to the file associated with the file descriptor .IR filedes . .PP The pointer .I vector points to a .B struct iovec defined in .B as .PP .br .nf .in 10 struct iovec { .in 14 void *iov_base; /* Starting address */ size_t iov_len; /* Number of bytes */ .in 10 }; .fi .PP Buffers are processed in the order .IR "vector[0]" ", " vector[1] ", ... " "vector[count]" . .PP The .B readv() function works just like .BR read (2) except that multiple buffers are filled. .PP The .B writev() function works just like .BR write (2) except that multiple buffers are written out. .PP .SH "RETURN VALUES" The .B readv() function returns the number of bytes or \-1 on error; the .B writev() function returns the number of bytes written. .SH "ERRORS" The .B readv() and .B writev() functions can fail and set .I errno to the following values: .TP .B EBADF .I fd is not a valid file descriptor. .TP .B EINVAL .I fd is unsuitable for reading (for .BR readv() ) or writing (for .BR writev() ). .TP .B EFAULT .I buf is outside the processes' address space. .TP .B EAGAIN Non-blocking I/O had been selected in the .B open() call, and reading or writing could not be done immediately. .TP .B EINTR Reading or writing was interrupted before any data was transferred. .SH "CONFORMING TO" unknown .SH "BUGS" It is not advisable to mix calls to functions like .BR readv() " or " writev() , which operate on file descriptors, with the functions from the stdio library; the results will be undefined and probably not what you want. .SH "SEE ALSO" .BR read "(2), " write (2)