blob: 4584e06f5ac389df50d7763a42a5fffbc825c903 [file] [log] [blame]
<html lang="en">
<head>
<title>Status of AIO Operations - The GNU C Library</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="The GNU C Library">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Asynchronous-I_002fO.html#Asynchronous-I_002fO" title="Asynchronous I/O">
<link rel="prev" href="Asynchronous-Reads_002fWrites.html#Asynchronous-Reads_002fWrites" title="Asynchronous Reads/Writes">
<link rel="next" href="Synchronizing-AIO-Operations.html#Synchronizing-AIO-Operations" title="Synchronizing AIO Operations">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU C library.
This is Edition 0.12, last updated 2007-10-27,
of `The GNU C Library Reference Manual', for version
2.8 (Sourcery G++ Lite 2011.03-41).
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002,
2003, 2007, 2008, 2010 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software Needs Free Documentation''
and ``GNU Lesser General Public License'', the Front-Cover texts being
``A GNU Manual'', and with the Back-Cover Texts as in (a) below. A
copy of the license is included in the section entitled "GNU Free
Documentation License".
(a) The FSF's Back-Cover Text is: ``You have the freedom to
copy and modify this GNU manual. Buying copies from the FSF
supports it in developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
<link rel="stylesheet" type="text/css" href="../cs.css">
</head>
<body>
<div class="node">
<a name="Status-of-AIO-Operations"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Synchronizing-AIO-Operations.html#Synchronizing-AIO-Operations">Synchronizing AIO Operations</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Asynchronous-Reads_002fWrites.html#Asynchronous-Reads_002fWrites">Asynchronous Reads/Writes</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Asynchronous-I_002fO.html#Asynchronous-I_002fO">Asynchronous I/O</a>
<hr>
</div>
<h4 class="subsection">13.10.2 Getting the Status of AIO Operations</h4>
<p>As already described in the documentation of the functions in the last
section, it must be possible to get information about the status of an I/O
request. When the operation is performed truly asynchronously (as with
<code>aio_read</code> and <code>aio_write</code> and with <code>lio_listio</code> when the
mode is <code>LIO_NOWAIT</code>), one sometimes needs to know whether a
specific request already terminated and if so, what the result was.
The following two functions allow you to get this kind of information.
<!-- aio.h -->
<!-- POSIX.1b -->
<div class="defun">
&mdash; Function: int <b>aio_error</b> (<var>const struct aiocb *aiocbp</var>)<var><a name="index-aio_005ferror-1298"></a></var><br>
<blockquote><p>This function determines the error state of the request described by the
<code>struct aiocb</code> variable pointed to by <var>aiocbp</var>. If the
request has not yet terminated the value returned is always
<code>EINPROGRESS</code>. Once the request has terminated the value
<code>aio_error</code> returns is either 0 if the request completed
successfully or it returns the value which would be stored in the
<code>errno</code> variable if the request would have been done using
<code>read</code>, <code>write</code>, or <code>fsync</code>.
<p>The function can return <code>ENOSYS</code> if it is not implemented. It
could also return <code>EINVAL</code> if the <var>aiocbp</var> parameter does not
refer to an asynchronous operation whose return status is not yet known.
<p>When the sources are compiled with <code>_FILE_OFFSET_BITS == 64</code> this
function is in fact <code>aio_error64</code> since the LFS interface
transparently replaces the normal implementation.
</p></blockquote></div>
<!-- aio.h -->
<!-- Unix98 -->
<div class="defun">
&mdash; Function: int <b>aio_error64</b> (<var>const struct aiocb64 *aiocbp</var>)<var><a name="index-aio_005ferror64-1299"></a></var><br>
<blockquote><p>This function is similar to <code>aio_error</code> with the only difference
that the argument is a reference to a variable of type <code>struct
aiocb64</code>.
<p>When the sources are compiled with <code>_FILE_OFFSET_BITS == 64</code> this
function is available under the name <code>aio_error</code> and so
transparently replaces the interface for small files on 32 bit
machines.
</p></blockquote></div>
<!-- aio.h -->
<!-- POSIX.1b -->
<div class="defun">
&mdash; Function: ssize_t <b>aio_return</b> (<var>const struct aiocb *aiocbp</var>)<var><a name="index-aio_005freturn-1300"></a></var><br>
<blockquote><p>This function can be used to retrieve the return status of the operation
carried out by the request described in the variable pointed to by
<var>aiocbp</var>. As long as the error status of this request as returned
by <code>aio_error</code> is <code>EINPROGRESS</code> the return of this function is
undefined.
<p>Once the request is finished this function can be used exactly once to
retrieve the return value. Following calls might lead to undefined
behavior. The return value itself is the value which would have been
returned by the <code>read</code>, <code>write</code>, or <code>fsync</code> call.
<p>The function can return <code>ENOSYS</code> if it is not implemented. It
could also return <code>EINVAL</code> if the <var>aiocbp</var> parameter does not
refer to an asynchronous operation whose return status is not yet known.
<p>When the sources are compiled with <code>_FILE_OFFSET_BITS == 64</code> this
function is in fact <code>aio_return64</code> since the LFS interface
transparently replaces the normal implementation.
</p></blockquote></div>
<!-- aio.h -->
<!-- Unix98 -->
<div class="defun">
&mdash; Function: int <b>aio_return64</b> (<var>const struct aiocb64 *aiocbp</var>)<var><a name="index-aio_005freturn64-1301"></a></var><br>
<blockquote><p>This function is similar to <code>aio_return</code> with the only difference
that the argument is a reference to a variable of type <code>struct
aiocb64</code>.
<p>When the sources are compiled with <code>_FILE_OFFSET_BITS == 64</code> this
function is available under the name <code>aio_return</code> and so
transparently replaces the interface for small files on 32 bit
machines.
</p></blockquote></div>
</body></html>