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

249 lines
7.8 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>fstatvfs</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="fstatvfs"></a> <a name="tag_03_194"></a><!-- fstatvfs -->
<!--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_194_01"></a>NAME</h4>
<blockquote>fstatvfs, statvfs - get file system information</blockquote>
<h4><a name="tag_03_194_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
"[Option Start]" border="0"> #include &lt;<a href="../basedefs/sys/statvfs.h.html">sys/statvfs.h</a>&gt;<br>
<br>
int fstatvfs(int</tt> <i>fildes</i><tt>, struct statvfs *</tt><i>buf</i><tt>);<br>
int statvfs(const char *restrict</tt> <i>path</i><tt>, struct statvfs *restrict</tt> <i>buf</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_194_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>fstatvfs</i>() function shall obtain information about the file system containing the file referenced by
<i>fildes</i>.</p>
<p>The <i>statvfs</i>() function shall obtain information about the file system containing the file named by <i>path</i>.</p>
<p>For both functions, the <i>buf</i> argument is a pointer to a <b>statvfs</b> structure that shall be filled. Read, write, or
execute permission of the named file is not required.</p>
<p>The following flags can be returned in the <i>f_flag</i> member:</p>
<dl compact>
<dt>ST_RDONLY</dt>
<dd>Read-only file system.</dd>
<dt>ST_NOSUID</dt>
<dd>Setuid/setgid bits ignored by <i><a href="../functions/exec.html">exec</a></i>.</dd>
</dl>
<p>It is unspecified whether all members of the <b>statvfs</b> structure have meaningful values on all file systems.</p>
</blockquote>
<h4><a name="tag_03_194_04"></a>RETURN VALUE</h4>
<blockquote>
<p>Upon successful completion, <i>statvfs</i>() shall return 0. Otherwise, it shall return -1 and set <i>errno</i> to indicate the
error.</p>
</blockquote>
<h4><a name="tag_03_194_05"></a>ERRORS</h4>
<blockquote>
<p>The <i>fstatvfs</i>() and <i>statvfs</i>() functions shall fail if:</p>
<dl compact>
<dt>[EIO]</dt>
<dd>An I/O error occurred while reading the file system.</dd>
<dt>[EINTR]</dt>
<dd>A signal was caught during execution of the function.</dd>
<dt>[EOVERFLOW]</dt>
<dd>One of the values to be returned cannot be represented correctly in the structure pointed to by <i>buf</i>.</dd>
</dl>
<p>The <i>fstatvfs</i>() function shall fail if:</p>
<dl compact>
<dt>[EBADF]</dt>
<dd>The <i>fildes</i> argument is not an open file descriptor.</dd>
</dl>
<p>The <i>statvfs</i>() function shall fail if:</p>
<dl compact>
<dt>[EACCES]</dt>
<dd>Search permission is denied on a component of the path prefix.</dd>
<dt>[ELOOP]</dt>
<dd>A loop exists in symbolic links encountered during resolution of the <i>path</i> argument.</dd>
<dt>[ENAMETOOLONG]</dt>
<dd>
The length of a pathname exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.</dd>
<dt>[ENOENT]</dt>
<dd>A component of <i>path</i> does not name an existing file or <i>path</i> is an empty string.</dd>
<dt>[ENOTDIR]</dt>
<dd>A component of the path prefix of <i>path</i> is not a directory.</dd>
</dl>
<p>The <i>statvfs</i>() function may fail if:</p>
<dl compact>
<dt>[ELOOP]</dt>
<dd>More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the <i>path</i> argument.</dd>
<dt>[ENAMETOOLONG]</dt>
<dd>
Pathname resolution of a symbolic link produced an intermediate result whose length exceeds {PATH_MAX}.</dd>
</dl>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_03_194_06"></a>EXAMPLES</h4>
<blockquote>
<h5><a name="tag_03_194_06_01"></a>Obtaining File System Information Using fstatvfs()</h5>
<p>The following example shows how to obtain file system information for the file system upon which the file named
<b>/home/cnd/mod1</b> resides, using the <i>fstatvfs</i>() function. The <b>/home/cnd/mod1</b> file is opened with read/write
privileges and the open file descriptor is passed to the <i>fstatvfs</i>() function.</p>
<pre>
<tt>#include &lt;statvfs.h&gt;
#include &lt;fcntl.h&gt;
<br>
struct statvfs buffer;
int status;
...
fildes = open("/home/cnd/mod1", O_RDWR);
status = fstatvfs(fildes, &amp;buffer);
</tt>
</pre>
<h5><a name="tag_03_194_06_02"></a>Obtaining File System Information Using statvfs()</h5>
<p>The following example shows how to obtain file system information for the file system upon which the file named
<b>/home/cnd/mod1</b> resides, using the <i>statvfs</i>() function.</p>
<pre>
<tt>#include &lt;statvfs.h&gt;
<br>
struct statvfs buffer;
int status;
...
status = statvfs("/home/cnd/mod1", &amp;buffer);
</tt>
</pre>
</blockquote>
<h4><a name="tag_03_194_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_194_08"></a>RATIONALE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_194_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_194_10"></a>SEE ALSO</h4>
<blockquote>
<p><a href="chmod.html"><i>chmod</i>()</a> , <a href="chown.html"><i>chown</i>()</a> , <a href="creat.html"><i>creat</i>()</a> , <a
href="dup.html"><i>dup</i>()</a> , <a href="exec.html"><i><a href="../functions/exec.html">exec</a></i>()</a> , <a href=
"fcntl.html"><i>fcntl</i>()</a> , <a href="link.html"><i>link</i>()</a> , <a href="mknod.html"><i>mknod</i>()</a> , <a href=
"open.html"><i>open</i>()</a> , <a href="pipe.html"><i>pipe</i>()</a> , <a href="read.html"><i>read</i>()</a> , <a href=
"time.html"><i>time</i>()</a> , <a href="unlink.html"><i>unlink</i>()</a> , <a href="utime.html"><i>utime</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/sys/statvfs.h.html"><i>&lt;sys/statvfs.h&gt;</i></a></p>
</blockquote>
<h4><a name="tag_03_194_11"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 4, Version 2.</p>
</blockquote>
<h4><a name="tag_03_194_12"></a>Issue 5</h4>
<blockquote>
<p>Moved from X/OPEN UNIX extension to BASE.</p>
<p>Large File Summit extensions are added.</p>
</blockquote>
<h4><a name="tag_03_194_13"></a>Issue 6</h4>
<blockquote>
<p>The DESCRIPTION is updated to avoid use of the term &quot;must&quot; for application requirements.</p>
<p>The <b>restrict</b> keyword is added to the <i>statvfs</i>() prototype for alignment with the ISO/IEC&nbsp;9899:1999
standard.</p>
<p>The wording of the mandatory [ELOOP] error condition is updated, and a second optional [ELOOP] error condition 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>