File: readv.3

package info (click to toggle)
manpages 1.70-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,704 kB
  • ctags: 7
  • sloc: perl: 162; sh: 94; makefile: 70; lisp: 22
file content (136 lines) | stat: -rw-r--r-- 3,373 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
.\" (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  1993-04-25 "GNU" "Linux Programmer's Manual"
.SH NAME
readv, writev \- read or write data into multiple buffers
.SH SYNOPSIS
.nf
.B #include <sys/uio.h>
.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 <sys/uio.h>
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 VALUE"
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),
.BR write (2)