172 lines
5.2 KiB
HTML
172 lines
5.2 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>readv</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="readv"></a> <a name="tag_03_597"></a><!-- readv -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_03_597_01"></a>NAME</h4>
|
|
|
|
<blockquote>readv - read a vector</blockquote>
|
|
|
|
<h4><a name="tag_03_597_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> #include <<a href="../basedefs/sys/uio.h.html">sys/uio.h</a>><br>
|
|
<br>
|
|
ssize_t readv(int</tt> <i>fildes</i><tt>, const struct iovec *</tt><i>iov</i><tt>, int</tt> <i>iovcnt</i><tt>); <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
|
|
|
|
<tt><br>
|
|
</tt></blockquote>
|
|
|
|
<h4><a name="tag_03_597_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>readv</i>() function shall be equivalent to <a href="../functions/read.html"><i>read</i>()</a>, except as described
|
|
below. The <i>readv</i>() function shall place the input data into the <i>iovcnt</i> buffers specified by the members of the
|
|
<i>iov</i> array: <i>iov</i>[0], <i>iov</i>[1], ..., <i>iov</i>[ <i>iovcnt</i>-1]. The <i>iovcnt</i> argument is valid if greater
|
|
than 0 and less than or equal to {IOV_MAX}.</p>
|
|
|
|
<p>Each <i>iovec</i> entry specifies the base address and length of an area in memory where data should be placed. The
|
|
<i>readv</i>() function shall always fill an area completely before proceeding to the next.</p>
|
|
|
|
<p>Upon successful completion, <i>readv</i>() shall mark for update the <i>st_atime</i> field of the file.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_597_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>Refer to <a href="read.html"><i>read</i>()</a> .</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_597_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>Refer to <a href="read.html"><i>read</i>()</a> .</p>
|
|
|
|
<p>In addition, the <i>readv</i>() function shall fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[EINVAL]</dt>
|
|
|
|
<dd>The sum of the <i>iov_len</i> values in the <i>iov</i> array overflowed an <b>ssize_t</b>.</dd>
|
|
</dl>
|
|
|
|
<p>The <i>readv</i>() function may fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[EINVAL]</dt>
|
|
|
|
<dd>The <i>iovcnt</i> argument was less than or equal to 0, or greater than {IOV_MAX}.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_03_597_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<h5><a name="tag_03_597_06_01"></a>Reading Data into an Array</h5>
|
|
|
|
<p>The following example reads data from the file associated with the file descriptor <i>fd</i> into the buffers specified by
|
|
members of the <i>iov</i> array.</p>
|
|
|
|
<pre>
|
|
<tt>#include <sys/types.h>
|
|
#include <sys/uio.h>
|
|
#include <unistd.h>
|
|
...
|
|
ssize_t bytes_read;
|
|
int fd;
|
|
char buf0[20];
|
|
char buf1[30];
|
|
char buf2[40];
|
|
int iovcnt;
|
|
struct iovec iov[3];
|
|
<br>
|
|
iov[0].iov_base = buf0;
|
|
iov[0].iov_len = sizeof(buf0);
|
|
iov[1].iov_base = buf1;
|
|
iov[1].iov_len = sizeof(buf1);
|
|
iov[2].iov_base = buf2;
|
|
iov[2].iov_len = sizeof(buf2);
|
|
...
|
|
iovcnt = sizeof(iov) / sizeof(struct iovec);
|
|
<br>
|
|
bytes_read = readv(fd, iov, iovcnt);
|
|
...
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_597_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_597_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>Refer to <a href="read.html"><i>read</i>()</a> .</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_597_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_597_10"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="read.html"><i>read</i>()</a> , <a href="writev.html"><i>writev</i>()</a> , the Base Definitions volume of
|
|
IEEE Std 1003.1-2001, <a href="../basedefs/sys/uio.h.html"><i><sys/uio.h></i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_597_11"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 4, Version 2.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_597_12"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>Split out from the <a href="../functions/read.html"><i>read</i>()</a> reference page.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|