📄 fsync.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>fsync</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_005_320"> </a>NAME</h4><blockquote>fsync - synchronise changes to a file</blockquote><h4><a name = "tag_000_005_321"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="unistd.h.html">unistd.h</a>>int fsync(int <i>fildes</i>);</code></pre></blockquote><h4><a name = "tag_000_005_322"> </a>DESCRIPTION</h4><blockquote>The<i>fsync()</i>function can be used by an application to indicate that alldata for the open file description named by<i>fildes</i>is to be transferred to the storage device associated withthe file described by<i>fildes</i>in an implementation-dependent manner.The<i>fsync()</i>function does not return until the system has completed that actionor until an error is detected.<p>The<i>fsync()</i>function forces all currently queued I/O operations associated with the file indicated by file descriptor<i>fildes</i>to the synchronised I/O completion state.All I/O operations are completed as defined forsynchronised I/O file integrity completion.</blockquote><h4><a name = "tag_000_005_323"> </a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>fsync()</i>returns 0. Otherwise, -1 is returned and<i>errno</i>is set to indicate the error.If the<i>fsync()</i>function fails,outstanding I/O operations are not guaranteed to have been completed.</blockquote><h4><a name = "tag_000_005_324"> </a>ERRORS</h4><blockquote>The<i>fsync()</i>function will fail if:<dl compact><dt>[EBADF]<dd>The<i>fildes</i>argument is not a valid descriptor.<dt>[EINTR]<dd>The<i>fsync()</i>function was interrupted by a signal.<dt>[EINVAL]<dd>The<i>fildes</i>argument does not refer to a file on which this operationis possible.<dt>[EIO]<dd>An I/O error occurred while reading from or writing to the file system.</dl><p>In the event that any of the queued I/O operations fail,<i>fsync()</i>returns the error conditions defined for<i><a href="read.html">read()</a></i>and<i><a href="write.html">write()</a></i>.</blockquote><h4><a name = "tag_000_005_325"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_005_326"> </a>APPLICATION USAGE</h4><blockquote>The<i>fsync()</i>functionshould be used by programs which require modifications to a fileto be completed before continuing; for example, a program which containsa simple transaction facility might use it to ensure that allmodifications to a file or files caused by a transaction arerecorded.</blockquote><h4><a name = "tag_000_005_327"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_005_328"> </a>SEE ALSO</h4><blockquote><i><a href="sync.html">sync()</a></i>,<i><a href="unistd.h.html"><unistd.h></a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -