System Calls statvfs(2)
NAME
statvfs, fstatvfs - get file system information
SYNOPSIS
#include
#include
int statvfs(const char *restrict path, struct statvfs *restrict buf);
int fstatvfs(int fildes, struct statvfs *buf);
DESCRIPTION
The statvfs() function returns a "generic superblock"
describing a file system; it can be used to acquire informa-
tion about mounted file systems. The buf argument is a
pointer to a structure (described below) that is filled by
the function.
The path argument should name a file that resides on that
file system. The file system type is known to the operating
system. Read, write, or execute permission for the named
file is not required, but all directories listed in the path
name leading to the file must be searchable.
The statvfs structure pointed to by buf includes the follow-
ing members:
ulong fbsize; /* preferred file system block size */
ulong ffrsize; /* fundamental filesystem block
(size if supported) */
fsblkcntt fblocks; /* total # of blocks on file system
in units of ffrsize */
fsblkcntt fbfree; /* total # of free blocks */
fsblkcntt fbavail; /* # of free blocks avail to
non-privileged user */
fsfilcntt ffiles; /* total # of file nodes (inodes) */
fsfilcntt fffree; /* total # of free file nodes */
fsfilcntt ffavail; /* # of inodes avail to
non-privileged user*/
ulong ffsid; /* file system id (dev for now) */
char fbasetype[FSTYPSZ]; /* target fs type name,
null-terminated */
ulong fflag; /* bit mask of flags */
ulong fnamemax; /* maximum file name length */
char ffstr[32]; /* file system specific string */
ulong ffiller[16]; /* reserved for future expansion */
SunOS 5.11 Last change: 22 Mar 2004 1
System Calls statvfs(2)
The fbasetype member contains a null-terminated FSType name
of the mounted target.
The following values can be returned in the fflag field:
STRDONLY 0x01 /* read-only file system */
STNOSUID 0x02 /* does not support setuid/setgid semantics */
STNOTRUNC 0x04 /* does not truncate file names longer than
NAMEMAX */
The fstatvfs() function is similar to statvfs(), except that
the file named by path in statvfs() is instead identified by
an open file descriptor fildes obtained from a successful
open(2), creat(2), dup(2), fcntl(2), or pipe(2) function
call.
RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is
returned and errno is set to indicate the error.
ERORS
The statvfs() and fstatvfs() functions will fail if:
EOVERFLOW One of the values to be returned cannot be
represented correctly in the structure pointed
to by buf.
The statvfs() function will fail if:
EACES Search permission is denied on a component
of the path prefix.
EFAULT The path or buf argument points to an ille-
gal address.
EINTR A signal was caught during the execution of
the statvfs() function.
EIO An I/O error occurred while reading the file
system.
ELOP Too many symbolic links were encountered in
translating path.
SunOS 5.11 Last change: 22 Mar 2004 2
System Calls statvfs(2)
ENAMETOLONG The length of a path component exceeds
NAMEMAX characters, or the length of path
The exceeds PATHMAX characters.
ENOENT Either a component of the path prefix or the
file referred to by path does not exist.
ENOLINK The path argument points to a remote machine
and the link to that machine is no longer
active.
ENOTDIR A component of the path prefix of path is
not a directory.
The fstatvfs() function will fail if:
EBADF The fildes argument is not an open file descrip-
tor.
EFAULT The buf argument points to an illegal address.
EINTR A signal was caught during the execution of the
fstatvfs() function.
EIO An I/O error occurred while reading the file sys-
tem.
USAGE
The statvfs() and fstatvfs() functions have transitional
interfaces for 64-bit file offsets. See lf64(5).
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 22 Mar 2004 3
System Calls statvfs(2)
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Standard
SEE ALSO
chmod(2), chown(2), creat(2), dup(2), fcntl(2), link(2),
mknod(2), open(2), pipe(2), read(2), time(2), unlink(2),
utime(2), write(2), attributes(5), lf64(5), standards(5)
BUGS
The values returned for ffiles, fffree, and ffavail may
not be valid for NFS mounted file systems.
SunOS 5.11 Last change: 22 Mar 2004 4
|