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

📄 posix_fallocate.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 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-2003 The Open Group, All Rights Reserved --><title>posix_fallocate</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="posix_fallocate"></a> <a name="tag_03_422"></a><!-- posix_fallocate --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright &copy; 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_422_01"></a>NAME</h4><blockquote>posix_fallocate - file space control (<b>ADVANCED REALTIME</b>)</blockquote><h4><a name="tag_03_422_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('ADV')">ADV</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> #include &lt;<a href="../basedefs/fcntl.h.html">fcntl.h</a>&gt;<br><br> int posix_fallocate(int</tt> <i>fd</i><tt>, off_t</tt> <i>offset</i><tt>, size_t</tt> <i>len</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_422_03"></a>DESCRIPTION</h4><blockquote><p>The <i>posix_fallocate</i>() function shall ensure that any required storage for regular file data starting at <i>offset</i> andcontinuing for <i>len</i> bytes is allocated on the file system storage media. If <i>posix_fallocate</i>() returns successfully,subsequent writes to the specified file data shall not fail due to the lack of free space on the file system storage media.</p><p>If the <i>offset</i>+ <i>len</i> is beyond the current file size, then <i>posix_fallocate</i>() shall adjust the file size to<i>offset</i>+ <i>len</i>. Otherwise, the file size shall not be changed.</p><p>It is implementation-defined whether a previous <a href="../functions/posix_fadvise.html"><i>posix_fadvise</i>()</a> callinfluences allocation strategy.</p><p>Space allocated via <i>posix_fallocate</i>() shall be freed by a successful call to <a href="../functions/creat.html"><i>creat</i>()</a> or <a href="../functions/open.html"><i>open</i>()</a> that truncates the size of thefile. Space allocated via <i>posix_fallocate</i>() may be freed by a successful call to <a href="../functions/ftruncate.html"><i>ftruncate</i>()</a> that reduces the file size to a size smaller than <i>offset</i>+<i>len</i>.</p></blockquote><h4><a name="tag_03_422_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, <i>posix_fallocate</i>() shall return zero; otherwise, an error number shall be returned to indicatethe error.</p></blockquote><h4><a name="tag_03_422_05"></a>ERRORS</h4><blockquote><p>The <i>posix_fallocate</i>() function shall fail if:</p><dl compact><dt>[EBADF]</dt><dd>The <i>fd</i> argument is not a valid file descriptor.</dd><dt>[EBADF]</dt><dd>The <i>fd</i> argument references a file that was opened without write permission.</dd><dt>[EFBIG]</dt><dd>The value of <i>offset</i>+ <i>len</i> is greater than the maximum file size.</dd><dt>[EINTR]</dt><dd>A signal was caught during execution.</dd><dt>[EINVAL]</dt><dd>The <i>len</i> argument was zero or the <i>offset</i> argument was less than zero.</dd><dt>[EIO]</dt><dd>An I/O error occurred while reading from or writing to a file system.</dd><dt>[ENODEV]</dt><dd>The <i>fd</i> argument does not refer to a regular file.</dd><dt>[ENOSPC]</dt><dd>There is insufficient free space remaining on the file system storage media.</dd><dt>[ESPIPE]</dt><dd>The <i>fd</i> argument is associated with a pipe or FIFO.</dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_422_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_422_07"></a>APPLICATION USAGE</h4><blockquote><p>The <i>posix_fallocate</i>() function is part of the Advisory Information option and need not be provided on allimplementations.</p></blockquote><h4><a name="tag_03_422_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_422_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_422_10"></a>SEE ALSO</h4><blockquote><p><a href="creat.html"><i>creat</i>()</a> , <a href="ftruncate.html"><i>ftruncate</i>()</a> , <a href="open.html"><i>open</i>()</a> , <a href="unlink.html"><i>unlink</i>()</a> , the Base Definitions volume ofIEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/fcntl.h.html"><i>&lt;fcntl.h&gt;</i></a></p></blockquote><h4><a name="tag_03_422_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 6. Derived from IEEE&nbsp;Std&nbsp;1003.1d-1999.</p><p>In the SYNOPSIS, the inclusion of <a href="../basedefs/sys/types.h.html"><i>&lt;sys/types.h&gt;</i></a> is no longerrequired.</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>

⌨️ 快捷键说明

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