1READV(3P)                  POSIX Programmer's Manual                 READV(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       readv — read a vector
14

SYNOPSIS

16       #include <sys/uio.h>
17
18       ssize_t readv(int fildes, const struct iovec *iov, int iovcnt);
19

DESCRIPTION

21       The readv() function shall be equivalent to read(), except as described
22       below.  The readv() function shall place the input data into the iovcnt
23       buffers specified by the members of the iov array: iov[0], iov[1], ...,
24       iov[iovcnt−1].  The iovcnt argument is valid if greater than 0 and less
25       than or equal to {IOV_MAX}.
26
27       Each iovec entry specifies the base address and length of  an  area  in
28       memory  where  data should be placed. The readv() function shall always
29       fill an area completely before proceeding to the next.
30
31       Upon successful completion, readv() shall mark for update the last data
32       access timestamp of the file.
33

RETURN VALUE

35       Refer to read().
36

ERRORS

38       Refer to read().
39
40       In addition, the readv() function shall fail if:
41
42       EINVAL The  sum  of  the  iov_len values in the iov array overflowed an
43              ssize_t.
44
45       The readv() function may fail if:
46
47       EINVAL The iovcnt argument was less than or equal to 0, or greater than
48              {IOV_MAX}.
49
50       The following sections are informative.
51

EXAMPLES

53   Reading Data into an Array
54       The following example reads data from the file associated with the file
55       descriptor fd into the buffers specified by members of the iov array.
56
57           #include <sys/types.h>
58           #include <sys/uio.h>
59           #include <unistd.h>
60           ...
61           ssize_t bytes_read;
62           int fd;
63           char buf0[20];
64           char buf1[30];
65           char buf2[40];
66           int iovcnt;
67           struct iovec iov[3];
68
69           iov[0].iov_base = buf0;
70           iov[0].iov_len = sizeof(buf0);
71           iov[1].iov_base = buf1;
72           iov[1].iov_len = sizeof(buf1);
73           iov[2].iov_base = buf2;
74           iov[2].iov_len = sizeof(buf2);
75           ...
76           iovcnt = sizeof(iov) / sizeof(struct iovec);
77
78           bytes_read = readv(fd, iov, iovcnt);
79           ...
80

APPLICATION USAGE

82       None.
83

RATIONALE

85       Refer to read().
86

FUTURE DIRECTIONS

88       None.
89

SEE ALSO

91       read(), writev()
92
93       The Base Definitions volume of POSIX.1‐2008, <sys_uio.h>
94
96       Portions of this text are reprinted and reproduced in  electronic  form
97       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
98       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
99       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
100       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
101       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
102       event of any discrepancy between this version and the original IEEE and
103       The  Open Group Standard, the original IEEE and The Open Group Standard
104       is the referee document. The original Standard can be  obtained  online
105       at http://www.unix.org/online.html .
106
107       Any  typographical  or  formatting  errors that appear in this page are
108       most likely to have been introduced during the conversion of the source
109       files  to  man page format. To report such errors, see https://www.ker
110       nel.org/doc/man-pages/reporting_bugs.html .
111
112
113
114IEEE/The Open Group                  2013                            READV(3P)
Impressum