272 lines
13 KiB
HTML
272 lines
13 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>lio_listio</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="lio_listio"></a> <a name="tag_03_334"></a><!-- lio_listio -->
|
|
<!--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_334_01"></a>NAME</h4>
|
|
|
|
<blockquote>lio_listio - list directed I/O (<b>REALTIME</b>)</blockquote>
|
|
|
|
<h4><a name="tag_03_334_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 <<a href="../basedefs/aio.h.html">aio.h</a>><br>
|
|
<br>
|
|
int lio_listio(int</tt> <i>mode</i><tt>, struct aiocb *restrict const</tt> <i>list</i><tt>[restrict],<br>
|
|
int</tt> <i>nent</i><tt>, struct sigevent *restrict</tt> <i>sig</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_334_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>lio_listio</i>() function shall initiate a list of I/O requests with a single function call.</p>
|
|
|
|
<p>The <i>mode</i> argument takes one of the values LIO_WAIT or LIO_NOWAIT declared in <a href=
|
|
"../basedefs/aio.h.html"><i><aio.h></i></a> and determines whether the function returns when the I/O operations have been
|
|
completed, or as soon as the operations have been queued. If the <i>mode</i> argument is LIO_WAIT, the function shall wait until
|
|
all I/O is complete and the <i>sig</i> argument shall be ignored.</p>
|
|
|
|
<p>If the <i>mode</i> argument is LIO_NOWAIT, the function shall return immediately, and asynchronous notification shall occur,
|
|
according to the <i>sig</i> argument, when all the I/O operations complete. If <i>sig</i> is NULL, then no asynchronous
|
|
notification shall occur. If <i>sig</i> is not NULL, asynchronous notification occurs as specified in <a href=
|
|
"xsh_chap02_04.html#tag_02_04_01"><i>Signal Generation and Delivery</i></a> when all the requests in <i>list</i> have
|
|
completed.</p>
|
|
|
|
<p>The I/O requests enumerated by <i>list</i> are submitted in an unspecified order.</p>
|
|
|
|
<p>The <i>list</i> argument is an array of pointers to <b>aiocb</b> structures. The array contains <i>nent</i> elements. The array
|
|
may contain NULL elements, which shall be ignored.</p>
|
|
|
|
<p>The <i>aio_lio_opcode</i> field of each <b>aiocb</b> structure specifies the operation to be performed. The supported operations
|
|
are LIO_READ, LIO_WRITE, and LIO_NOP; these symbols are defined in <a href="../basedefs/aio.h.html"><i><aio.h></i></a>. The
|
|
LIO_NOP operation causes the list entry to be ignored. If the <i>aio_lio_opcode</i> element is equal to LIO_READ, then an I/O
|
|
operation is submitted as if by a call to <a href="../functions/aio_read.html"><i>aio_read</i>()</a> with the <i>aiocbp</i> equal
|
|
to the address of the <b>aiocb</b> structure. If the <i>aio_lio_opcode</i> element is equal to LIO_WRITE, then an I/O operation is
|
|
submitted as if by a call to <a href="../functions/aio_write.html"><i>aio_write</i>()</a> with the <i>aiocbp</i> equal to the
|
|
address of the <b>aiocb</b> structure.</p>
|
|
|
|
<p>The <i>aio_fildes</i> member specifies the file descriptor on which the operation is to be performed.</p>
|
|
|
|
<p>The <i>aio_buf</i> member specifies the address of the buffer to or from which the data is transferred.</p>
|
|
|
|
<p>The <i>aio_nbytes</i> member specifies the number of bytes of data to be transferred.</p>
|
|
|
|
<p>The members of the <b>aiocb</b> structure further describe the I/O operation to be performed, in a manner identical to that of
|
|
the corresponding <b>aiocb</b> structure when used by the <a href="../functions/aio_read.html"><i>aio_read</i>()</a> and <a href=
|
|
"../functions/aio_write.html"><i>aio_write</i>()</a> functions.</p>
|
|
|
|
<p>The <i>nent</i> argument specifies how many elements are members of the list; that is, the length of the array.</p>
|
|
|
|
<p>The behavior of this function is altered according to the definitions of synchronized I/O data integrity completion and
|
|
synchronized I/O file integrity completion if synchronized I/O is enabled on the file associated with <i>aio_fildes</i>.</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>-><i>aio_fildes</i>.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_334_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>If the <i>mode</i> argument has the value LIO_NOWAIT, the <i>lio_listio</i>() function shall return the value zero if the I/O
|
|
operations are successfully queued; otherwise, the function shall return the value -1 and set <i>errno</i> to indicate the
|
|
error.</p>
|
|
|
|
<p>If the <i>mode</i> argument has the value LIO_WAIT, the <i>lio_listio</i>() function shall return the value zero when all the
|
|
indicated I/O has completed successfully. Otherwise, <i>lio_listio</i>() shall return a value of -1 and set <i>errno</i> to
|
|
indicate the error.</p>
|
|
|
|
<p>In either case, the return value only indicates the success or failure of the <i>lio_listio</i>() call itself, not the status of
|
|
the individual I/O requests. In some cases one or more of the I/O requests contained in the list may fail. Failure of an individual
|
|
request does not prevent completion of any other individual request. To determine the outcome of each I/O request, the application
|
|
shall examine the error status associated with each <b>aiocb</b> control block. The error statuses so returned are identical to
|
|
those returned as the result of an <a href="../functions/aio_read.html"><i>aio_read</i>()</a> or <a href=
|
|
"../functions/aio_write.html"><i>aio_write</i>()</a> function.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_334_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>lio_listio</i>() function shall fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[EAGAIN]</dt>
|
|
|
|
<dd>The resources necessary to queue all the I/O requests were not available. The application may check the error status for each
|
|
<b>aiocb</b> to determine the individual request(s) that failed.</dd>
|
|
|
|
<dt>[EAGAIN]</dt>
|
|
|
|
<dd>The number of entries indicated by <i>nent</i> would cause the system-wide limit {AIO_MAX} to be exceeded.</dd>
|
|
|
|
<dt>[EINVAL]</dt>
|
|
|
|
<dd>The <i>mode</i> argument is not a proper value, or the value of <i>nent</i> was greater than {AIO_LISTIO_MAX}.</dd>
|
|
|
|
<dt>[EINTR]</dt>
|
|
|
|
<dd>A signal was delivered while waiting for all I/O requests to complete during an LIO_WAIT operation. Note that, since each I/O
|
|
operation invoked by <i>lio_listio</i>() may possibly provoke a signal when it completes, this error return may be caused by the
|
|
completion of one (or more) of the very I/O operations being awaited. Outstanding I/O requests are not canceled, and the
|
|
application shall examine each list element to determine whether the request was initiated, canceled, or completed.</dd>
|
|
|
|
<dt>[EIO]</dt>
|
|
|
|
<dd>One or more of the individual I/O operations failed. The application may check the error status for each <b>aiocb</b> structure
|
|
to determine the individual request(s) that failed.</dd>
|
|
</dl>
|
|
|
|
<p>In addition to the errors returned by the <i>lio_listio</i>() function, if the <i>lio_listio</i>() function succeeds or fails
|
|
with errors of [EAGAIN], [EINTR], or [EIO], then some of the I/O specified by the list may have been initiated. If the
|
|
<i>lio_listio</i>() function fails with an error code other than [EAGAIN], [EINTR], or [EIO], no operations from the list shall
|
|
have been initiated. The I/O operation indicated by each list element can encounter errors specific to the individual read or write
|
|
function being performed. In this event, the error status for each <b>aiocb</b> control block contains the associated error code.
|
|
The error codes that can be set are the same as would be set by a <a href="../functions/read.html"><i>read</i>()</a> or <a href=
|
|
"../functions/write.html"><i>write</i>()</a> function, with the following additional error codes possible:</p>
|
|
|
|
<dl compact>
|
|
<dt>[EAGAIN]</dt>
|
|
|
|
<dd>The requested I/O operation was not queued due to resource limitations.</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>[EFBIG]</dt>
|
|
|
|
<dd>The <i>aiocbp</i>-><i>aio_lio_opcode</i> is LIO_WRITE, the file is a regular file, <i>aiocbp</i>-><i>aio_nbytes</i> is
|
|
greater than 0, and the <i>aiocbp</i>-><i>aio_offset</i> is greater than or equal to the offset maximum in the open file
|
|
description associated with <i>aiocbp</i>-><i>aio_fildes</i>.</dd>
|
|
|
|
<dt>[EINPROGRESS]</dt>
|
|
|
|
<dd>The requested I/O is in progress.</dd>
|
|
|
|
<dt>[EOVERFLOW]</dt>
|
|
|
|
<dd>The <i>aiocbp</i>-><i>aio_lio_opcode</i> is LIO_READ, the file is a regular file, <i>aiocbp</i>-><i>aio_nbytes</i> is
|
|
greater than 0, and the <i>aiocbp</i>-><i>aio_offset</i> is before the end-of-file and is greater than or equal to the offset
|
|
maximum in the open file description associated with <i>aiocbp</i>-><i>aio_fildes</i>.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_03_334_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_334_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_334_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>Although it may appear that there are inconsistencies in the specified circumstances for error codes, the [EIO] error condition
|
|
applies when any circumstance relating to an individual operation makes that operation fail. This might be due to a badly
|
|
formulated request (for example, the <i>aio_lio_opcode</i> field is invalid, and <a href=
|
|
"../functions/aio_error.html"><i>aio_error</i>()</a> returns [EINVAL]) or might arise from application behavior (for example, the
|
|
file descriptor is closed before the operation is initiated, and <a href="../functions/aio_error.html"><i>aio_error</i>()</a>
|
|
returns [EBADF]).</p>
|
|
|
|
<p>The limitation on the set of error codes returned when operations from the list shall have been initiated enables applications
|
|
to know when operations have been started and whether <a href="../functions/aio_error.html"><i>aio_error</i>()</a> is valid for a
|
|
specific operation.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_334_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_334_10"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="aio_read.html"><i>aio_read</i>()</a> , <a href="aio_write.html"><i>aio_write</i>()</a> , <a href=
|
|
"aio_error.html"><i>aio_error</i>()</a> , <a href="aio_return.html"><i>aio_return</i>()</a> , <a href=
|
|
"aio_cancel.html"><i>aio_cancel</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> , <a
|
|
href="lseek.html"><i>lseek</i>()</a> , <a href="read.html"><i>read</i>()</a> , the Base Definitions volume of
|
|
IEEE Std 1003.1-2001, <a href="../basedefs/aio.h.html"><i><aio.h></i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_334_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_334_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 the
|
|
Asynchronous Input and Output option.</p>
|
|
|
|
<p>The <i>lio_listio</i>() function is marked as part of the Asynchronous Input and Output option.</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 that for regular files no data transfer occurs past the offset maximum established
|
|
in the open file description associated with <i>aiocbp</i>-><i>aio_fildes</i>. This change is to support large files.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The [EBIG] and [EOVERFLOW] error conditions are defined. This change is to support large files.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>The DESCRIPTION is updated to avoid use of the term "must" for application requirements.</p>
|
|
|
|
<p>The <b>restrict</b> keyword is added to the <i>lio_listio</i>() prototype for alignment with the ISO/IEC 9899:1999
|
|
standard.</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>
|
|
|