Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/aio_fsync.html
2024-02-19 00:21:47 -05:00

178 lines
7.7 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>aio_fsync</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="aio_fsync"></a> <a name="tag_03_16"></a><!-- aio_fsync -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_16_01"></a>NAME</h4>
<blockquote>aio_fsync - asynchronous file synchronization (<b>REALTIME</b>)</blockquote>
<h4><a name="tag_03_16_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_fsync(int</tt> <i>op</i><tt>, 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_16_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>aio_fsync</i>() function shall asynchronously force all I/O operations associated with the file indicated by the file
descriptor <i>aio_fildes</i> member of the <b>aiocb</b> structure referenced by the <i>aiocbp</i> argument and queued at the time
of the call to <i>aio_fsync</i>() to the synchronized I/O completion state. The function call shall return when the synchronization
request has been initiated or queued to the file or device (even when the data cannot be synchronized immediately).</p>
<p>If <i>op</i> is O_DSYNC, all currently queued I/O operations shall be completed as if by a call to <a href=
"../functions/fdatasync.html"><i>fdatasync</i>()</a>; that is, as defined for synchronized I/O data integrity completion. If
<i>op</i> is O_SYNC, all currently queued I/O operations shall be completed as if by a call to <a href=
"../functions/fsync.html"><i>fsync</i>()</a>; that is, as defined for synchronized I/O file integrity completion. If the
<i>aio_fsync</i>() function fails, or if the operation queued by <i>aio_fsync</i>() fails, then, as for <a href=
"../functions/fsync.html"><i>fsync</i>()</a> and <a href="../functions/fdatasync.html"><i>fdatasync</i>()</a>, outstanding I/O
operations are not guaranteed to have been completed.</p>
<p>If <i>aio_fsync</i>() succeeds, then it is only the I/O that was queued at the time of the call to <i>aio_fsync</i>() that is
guaranteed to be forced to the relevant completion state. The completion of subsequent I/O on the file descriptor is not guaranteed
to be completed in a synchronized fashion.</p>
<p>The <i>aiocbp</i> argument refers to an asynchronous I/O control block. 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, of the asynchronous operation while it is proceeding. When the
request is queued, the error status for the operation is [EINPROGRESS]. When all data has been successfully transferred, the error
status shall be reset to reflect the success or failure of the operation. If the operation does not complete successfully, the
error status for the operation shall be set to indicate the error. The <i>aio_sigevent</i> member determines the asynchronous
notification to occur as specified in <a href="xsh_chap02_04.html#tag_02_04_01"><i>Signal Generation and Delivery</i></a> when all
operations have achieved synchronized I/O completion. All other members of the structure referenced by <i>aiocbp</i> are ignored.
If the control block referenced by <i>aiocbp</i> becomes an illegal address prior to asynchronous I/O completion, then the behavior
is undefined.</p>
<p>If the <i>aio_fsync</i>() function fails or <i>aiocbp</i> indicates an error condition, data is not guaranteed to have been
successfully transferred.</p>
</blockquote>
<h4><a name="tag_03_16_04"></a>RETURN VALUE</h4>
<blockquote>
<p>The <i>aio_fsync</i>() function shall return the value 0 to the calling process if the I/O operation is successfully queued;
otherwise, the function shall return the value -1 and set <i>errno</i> to indicate the error.</p>
</blockquote>
<h4><a name="tag_03_16_05"></a>ERRORS</h4>
<blockquote>
<p>The <i>aio_fsync</i>() function shall fail if:</p>
<dl compact>
<dt>[EAGAIN]</dt>
<dd>The requested asynchronous operation was not queued due to temporary resource limitations.</dd>
<dt>[EBADF]</dt>
<dd>The <i>aio_fildes</i> member of the <b>aiocb</b> structure referenced by the <i>aiocbp</i> argument is not a valid file
descriptor open for writing.</dd>
<dt>[EINVAL]</dt>
<dd>This implementation does not support synchronized I/O for this file.</dd>
<dt>[EINVAL]</dt>
<dd>A value of <i>op</i> other than O_DSYNC or O_SYNC was specified.</dd>
</dl>
<p>In the event that any of the queued I/O operations fail, <i>aio_fsync</i>() shall return the error condition defined for <a
href="../functions/read.html"><i>read</i>()</a> and <a href="../functions/write.html"><i>write</i>()</a>. The error is returned in
the error status for the asynchronous <a href="../functions/fsync.html"><i>fsync</i>()</a> operation, which can be retrieved using
<a href="../functions/aio_error.html"><i>aio_error</i>()</a>.</p>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_03_16_06"></a>EXAMPLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_16_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>The <i>aio_fsync</i>() function is part of the Asynchronous Input and Output option and need not be available on all
implementations.</p>
</blockquote>
<h4><a name="tag_03_16_08"></a>RATIONALE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_16_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_16_10"></a>SEE ALSO</h4>
<blockquote>
<p><a href="fcntl.html"><i>fcntl</i>()</a> , <a href="fdatasync.html"><i>fdatasync</i>()</a> , <a href=
"fsync.html"><i>fsync</i>()</a> , <a href="open.html"><i>open</i>()</a> , <a href="read.html"><i>read</i>()</a> , <a href=
"write.html"><i>write</i>()</a> , the Base Definitions volume of IEEE&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_16_11"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 5. Included for alignment with the POSIX Realtime Extension.</p>
</blockquote>
<h4><a name="tag_03_16_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 APPLICATION USAGE section is added.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<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>