⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aio_read.html

📁 posix标准英文,html格式
💻 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-2004 IEEE and The Open Group, All Rights Reserved --><title>aio_read</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="aio_read"></a> <a name="tag_03_17"></a><!-- aio_read --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2004 Edition<br>Copyright &copy; 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_17_01"></a>NAME</h4><blockquote>aio_read - asynchronous read from a file (<b>REALTIME</b>)</blockquote><h4><a name="tag_03_17_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('AIO')">AIO</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> #include &lt;<a href="../basedefs/aio.h.html">aio.h</a>&gt;<br><br> int aio_read(struct aiocb *</tt><i>aiocbp</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_17_03"></a>DESCRIPTION</h4><blockquote><p>The <i>aio_read</i>() function shall read <i>aiocbp</i>-&gt;<i>aio_nbytes</i> from the file associated with<i>aiocbp</i>-&gt;<i>aio_fildes</i> into the buffer pointed to by <i>aiocbp</i>-&gt;<i>aio_buf</i>. The function call shall returnwhen the read request has been initiated or queued to the file or device (even when the data cannot be delivered immediately).</p><p><sup>[<a href="javascript:open_code('PIO')">PIO</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">If prioritized I/O is supported for this file, then the asynchronous operation shall be submitted at a priority equal to a basescheduling priority minus <i>aiocbp</i>-&gt;<i>aio_reqprio</i>. If Thread Execution Scheduling is not supported, then the basescheduling priority is that of the calling process; <img src="../images/opt-end.gif" alt="[Option End]" border="0"> <sup>[<a href="javascript:open_code('PIO TPS')">PIO TPS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">&nbsp;otherwise, the base scheduling priority is that of the calling thread. <img src="../images/opt-end.gif" alt="[Option End]"border="0"></p><p>The <i>aiocbp</i> value may be used as an argument to <a href="../functions/aio_error.html"><i>aio_error</i>()</a> and <a href="../functions/aio_return.html"><i>aio_return</i>()</a> in order to determine the error status and return status, respectively, ofthe asynchronous operation while it is proceeding. If an error condition is encountered during queuing, the function call shallreturn without having initiated or queued the request. The requested operation takes place at the absolute position in the file asgiven by <i>aio_offset</i>, as if <a href="../functions/lseek.html"><i>lseek</i>()</a> were called immediately prior to theoperation with an <i>offset</i> equal to <i>aio_offset</i> and a <i>whence</i> equal to SEEK_SET. After a successful call toenqueue an asynchronous I/O operation, the value of the file offset for the file is unspecified.</p><p>The <i>aiocbp</i>-&gt;<i>aio_lio_opcode</i> field shall be ignored by <i>aio_read</i>().</p><p>The <i>aiocbp</i> argument points to an <b>aiocb</b> structure. If the buffer pointed to by <i>aiocbp</i>-&gt;<i>aio_buf</i> orthe control block pointed to by <i>aiocbp</i> becomes an illegal address prior to asynchronous I/O completion, then the behavior isundefined.</p><p>Simultaneous asynchronous operations using the same <i>aiocbp</i> produce undefined results.</p><p><sup>[<a href="javascript:open_code('SIO')">SIO</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">If synchronized I/O is enabled on the file associated with <i>aiocbp</i>-&gt;<i>aio_fildes</i>, the behavior of this function shallbe according to the definitions of synchronized I/O data integrity completion and synchronized I/O file integrity completion. <imgsrc="../images/opt-end.gif" alt="[Option End]" border="0"></p><p>For any system action that changes the process memory space while an asynchronous I/O is outstanding to the address range beingchanged, the result of that action is undefined.</p><p>For regular files, no data transfer shall occur past the offset maximum established in the open file description associated with<i>aiocbp</i>-&gt;<i>aio_fildes</i>.</p></blockquote><h4><a name="tag_03_17_04"></a>RETURN VALUE</h4><blockquote><p>The <i>aio_read</i>() function shall return the value zero if the I/O operation is successfully queued; otherwise, the functionshall return the value -1 and set <i>errno</i> to indicate the error.</p></blockquote><h4><a name="tag_03_17_05"></a>ERRORS</h4><blockquote><p>The <i>aio_read</i>() function shall fail if:</p><dl compact><dt>[EAGAIN]</dt><dd>The requested asynchronous I/O operation was not queued due to system resource limitations.</dd></dl><p>Each of the following conditions may be detected synchronously at the time of the call to <i>aio_read</i>(), or asynchronously.If any of the conditions below are detected synchronously, the <i>aio_read</i>() function shall return -1 and set <i>errno</i> tothe corresponding value. If any of the conditions below are detected asynchronously, the return status of the asynchronousoperation is set to -1, and the error status of the asynchronous operation is set to the corresponding value.</p><dl compact><dt>[EBADF]</dt><dd>The <i>aiocbp</i>-&gt;<i>aio_fildes</i> argument is not a valid file descriptor open for reading.</dd><dt>[EINVAL]</dt><dd>The file offset value implied by <i>aiocbp</i>-&gt;<i>aio_offset</i> would be invalid, <sup>[<a href="javascript:open_code('PIO')">PIO</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">&nbsp;<i>aiocbp</i>-&gt;<i>aio_reqprio</i> is not a valid value, <img src="../images/opt-end.gif" alt="[Option End]" border="0">&nbsp;or <i>aiocbp</i>-&gt;<i>aio_nbytes</i> is an invalid value.</dd></dl><p>In the case that the <i>aio_read</i>() successfully queues the I/O operation but the operation is subsequently canceled orencounters an error, the return status of the asynchronous operation is one of the values normally returned by the <a href="../functions/read.html"><i>read</i>()</a> function call. In addition, the error status of the asynchronous operation is set to oneof the error statuses normally set by the <a href="../functions/read.html"><i>read</i>()</a> function call, or one of the followingvalues:</p><dl compact><dt>[EBADF]</dt><dd>The <i>aiocbp</i>-&gt;<i>aio_fildes</i> argument is not a valid file descriptor open for reading.</dd><dt>[ECANCELED]</dt><dd>The requested I/O was canceled before the I/O completed due to an explicit <a href="../functions/aio_cancel.html"><i>aio_cancel</i>()</a> request.</dd><dt>[EINVAL]</dt><dd>The file offset value implied by <i>aiocbp</i>-&gt;<i>aio_offset</i> would be invalid.</dd></dl><p>The following condition may be detected synchronously or asynchronously:</p><dl compact><dt>[EOVERFLOW]</dt><dd>The file is a regular file, <i>aiobcp</i>-&gt;<i>aio_nbytes</i> is greater than 0, and the starting offset in<i>aiobcp</i>-&gt;<i>aio_offset</i> is before the end-of-file and is at or beyond the offset maximum in the open file descriptionassociated with <i>aiocbp</i>-&gt;<i>aio_fildes</i>.</dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_17_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_17_07"></a>APPLICATION USAGE</h4><blockquote><p>The <i>aio_read</i>() function is part of the Asynchronous Input and Output option and need not be available on allimplementations.</p></blockquote><h4><a name="tag_03_17_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_17_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_17_10"></a>SEE ALSO</h4><blockquote><p><a href="aio_cancel.html"><i>aio_cancel</i>()</a>, <a href="aio_error.html"><i>aio_error</i>()</a>, <a href="lio_listio.html"><i>lio_listio</i>()</a>, <a href="aio_return.html"><i>aio_return</i>()</a>, <a href="aio_write.html"><i>aio_write</i>()</a>, <a href="close.html"><i>close</i>()</a>, <a href="exec.html"><i><a href="../functions/exec.html">exec</a></i>()</a>, <a href="exit.html"><i>exit</i>()</a>, <a href="fork.html"><i>fork</i>()</a>, <ahref="lseek.html"><i>lseek</i>()</a>, <a href="read.html"><i>read</i>()</a>, the Base Definitions volume ofIEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/aio.h.html"><i>&lt;aio.h&gt;</i></a></p></blockquote><h4><a name="tag_03_17_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 5. Included for alignment with the POSIX Realtime Extension.</p><p>Large File Summit extensions are added.</p></blockquote><h4><a name="tag_03_17_12"></a>Issue 6</h4><blockquote><p>The [ENOSYS] error condition has been removed as stubs need not be provided if an implementation does not support theAsynchronous Input and Output option.</p><p>The APPLICATION USAGE section is added.<br></p><p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p><ul><li><p>In the DESCRIPTION, text is added to indicate setting of the offset maximum in the open file description. This change is tosupport large files.</p></li><li><p>In the ERRORS section, the [EOVERFLOW] condition is added. This change is to support large files.</p></li></ul><p>IEEE&nbsp;Std&nbsp;1003.1-2001/Cor&nbsp;2-2004, item XSH/TC2/D6/12 is applied, rewording the DESCRIPTION when prioritized I/O issupported to account for threads, and removing the words ``to the calling process'' in the RETURN VALUE section.</p><p>IEEE&nbsp;Std&nbsp;1003.1-2001/Cor&nbsp;2-2004, item XSH/TC2/D6/13 is applied, updating the [EINVAL] error, so that detection ofan [EINVAL] error for an invalid value of <i>aiocbp</i>-&gt;<i>aio_reqprio</i> is only required if the Prioritized Input and Outputoption is supported.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; 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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -