1 |
perry |
1 |
READV |
|
|
2 |
!!!READV |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
ERRORS |
|
|
8 |
CONFORMING TO |
|
|
9 |
BUGS |
|
|
10 |
SEE ALSO |
|
|
11 |
---- |
|
|
12 |
!!NAME |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
readv, writev - read or write data into multiple buffers |
|
|
16 |
!!SYNOPSIS |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
__#include |
|
|
20 |
__ ''filedes''__, const struct iovec *__''vector''__, |
|
|
21 |
size_t__ ''count''__); |
|
|
22 |
int writev(int__ ''filedes''__, const struct iovec *__''vector''__, |
|
|
23 |
size_t__ ''count''__); |
|
|
24 |
__ |
|
|
25 |
!!DESCRIPTION |
|
|
26 |
|
|
|
27 |
|
|
|
28 |
The __readv()__ function reads ''count'' blocks from |
|
|
29 |
the file associated with the file descriptor ''filedes'' |
|
|
30 |
into the multiple buffers described by |
|
|
31 |
''vector''. |
|
|
32 |
|
|
|
33 |
|
|
|
34 |
The __writev()__ function writes at most ''count'' |
|
|
35 |
blocks described by ''vector'' to the file associated |
|
|
36 |
with the file descriptor ''filedes''. |
|
|
37 |
|
|
|
38 |
|
|
|
39 |
The pointer ''vector'' points to a __struct iovec__ |
|
|
40 |
defined in ____ as |
|
|
41 |
|
|
|
42 |
|
|
|
43 |
struct iovec { |
|
|
44 |
void *iov_base; /* Starting address */ |
|
|
45 |
size_t iov_len; /* Number of bytes */ |
|
|
46 |
}; |
|
|
47 |
Buffers are processed in the order ''vector[[0]'', ''vector[[1]'', ... ''vector[[count]''. |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
The __readv()__ function works just like read(2) |
|
|
51 |
except that multiple buffers are filled. |
|
|
52 |
|
|
|
53 |
|
|
|
54 |
The __writev()__ function works just like write(2) |
|
|
55 |
except that multiple buffers are written out. |
|
|
56 |
!!RETURN VALUE |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
The __readv()__ function returns the number of bytes or |
|
|
60 |
-1 on error; the __writev()__ function returns the number |
|
|
61 |
of bytes written. |
|
|
62 |
!!ERRORS |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
The __readv()__ and __writev()__ functions can fail |
|
|
66 |
and set ''errno'' to the following values: |
|
|
67 |
|
|
|
68 |
|
|
|
69 |
__EBADF__ |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
''fd'' is not a valid file descriptor. |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
__EINVAL__ |
|
|
76 |
|
|
|
77 |
|
|
|
78 |
''fd'' is unsuitable for reading (for __readv()__) or |
|
|
79 |
writing (for __writev()__). |
|
|
80 |
|
|
|
81 |
|
|
|
82 |
__EFAULT__ |
|
|
83 |
|
|
|
84 |
|
|
|
85 |
''buf'' is outside the processes' address |
|
|
86 |
space. |
|
|
87 |
|
|
|
88 |
|
|
|
89 |
__EAGAIN__ |
|
|
90 |
|
|
|
91 |
|
|
|
92 |
Non-blocking I/O had been selected in the __open()__ |
|
|
93 |
call, and reading or writing could not be done |
|
|
94 |
immediately. |
|
|
95 |
|
|
|
96 |
|
|
|
97 |
__EINTR__ |
|
|
98 |
|
|
|
99 |
|
|
|
100 |
Reading or writing was interrupted before any data was |
|
|
101 |
transferred. |
|
|
102 |
!!CONFORMING TO |
|
|
103 |
|
|
|
104 |
|
|
|
105 |
unknown |
|
|
106 |
!!BUGS |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
It is not advisable to mix calls to functions like |
|
|
110 |
__readv()__ or __writev()__, which operate on file |
|
|
111 |
descriptors, with the functions from the stdio library; the |
|
|
112 |
results will be undefined and probably not what you |
|
|
113 |
want. |
|
|
114 |
!!SEE ALSO |
|
|
115 |
|
|
|
116 |
|
|
|
117 |
read(2), write(2) |
|
|
118 |
---- |