1
0
Files
irix-657m-src/eoe/man/man2/statvfs.2
2022-09-29 17:59:04 +03:00

216 lines
6.4 KiB
Groff

'\"macro stdmacro
.if n .pH g2.statvfs @(#)statvfs 41.1 of 1/17/91
.\" Copyright 1991 UNIX System Laboratories, Inc.
.\" Copyright 1989, 1990 AT&T
.nr X
.if \nX=0 .ds x} statvfs 2 "" "\&"
.if \nX=1 .ds x} statvfs 2 ""
.if \nX=2 .ds x} statvfs 2 "" "\&"
.if \nX=3 .ds x} statvfs "" "" "\&"
.TH \*(x}
.SH NAME
\f4statvfs\f1, \f4fstatvfs\f1, \f4statvfs64\f1, \f4fstatvfs64\f1 \- get file system information
.SH SYNOPSIS
\f4#include <sys/types.h>\f1
.br
\f4#include <sys/statvfs.h>\f1
.PP
\f4int statvfs (const char *path, struct statvfs *buf);\f1
.PP
\f4int statvfs64 (const char *path, struct statvfs64 *buf);\f1
.PP
\f4int fstatvfs (int fildes, struct statvfs *buf);\f1
.PP
\f4int fstatvfs64 (int fildes, struct statvfs64 *buf);\f1
.SH DESCRIPTION
\f4statvfs\fP
returns a ``generic superblock'' describing a file system;
it can be used to acquire information about mounted
file systems.
.I buf\^
is a pointer to a structure (described below) that is filled by
the system call.
.PP
.I path\^
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.
.PP
The
\f4statvfs\fP
structure pointed to by
.I buf\^
includes the following members:
.PP
.Ex 19
ulong_t f_bsize; /* preferred file system block size */
ulong_t f_frsize; /* fundamental filesystem block size
(if supported) */
ulong_t f_blocks; /* total # of blocks on file system
in units of f_frsize */
ulong_t f_bfree; /* total # of free blocks */
ulong_t f_bavail; /* # of free blocks avail to
non-superuser */
ulong_t f_files; /* total # of file nodes (inodes) */
ulong_t f_ffree; /* total # of free file nodes */
ulong_t f_favail; /* # of inodes avail to
non-superuser */
ulong_t f_fsid; /* file system id (dev for now) */
char f_basetype[FSTYPSZ]; /* target file system type name,
null-terminated */
ulong_t f_flag; /* bit mask of flags */
ulong_t f_namemax; /* maximum file name length */
char f_fstr[32]; /* file system specific string */
ulong_t f_filler[16]; /* reserved for future expansion */
.Ee
.P
\f4f_basetype\f1 contains a null-terminated FSType name of the
mounted target (e.g. \f4iso9660\f1 mounted over \f4nfs\f1 will contain
\f4iso9660\f1).
.\" .P
.\" If the Enhanced Security Utilities are installed and running, and
.\" the security level of the calling process does not dominate the
.\" upper bound of the file system's level range, the structure members
.\" \f2f_bfree\fP and \f2f_ffree\fP are not returned unless the calling
.\" process has the \f4P_COMPAT\fP privilege or the \f4P_FSYSRANGE\fP
.\" privilege.
.PP
The following flags can be returned in the \f4f_flag\f1 field:
.P
.Ex 5
ST_RDONLY 0x00000001 /* read-only file system */
ST_NOSUID 0x00000002 /* does not support setuid/setgid
semantics */
ST_NOTRUNC 0x00000004 /* does not truncate file names
longer than {NAME_MAX} */
ST_NODEV 0x20000000 /* disallow opening of device files */
ST_GRPID 0x40000000 /* group-ID assigned from directory */
ST_LOCAL 0x80000000 /* local filesystem, for find */
.Ee
.PP
\f4fstatvfs\fP
is similar to \f4statvfs\f1, except that the file named by
.I path\^
in
\f4statvfs\fP
is instead identified by an open file descriptor
.I fildes\^
obtained from a successful
\f4open\fP,
\f4creat\fP,
\f4dup\fP,
\f4fcntl\fP,
or
\f4pipe\fP
system call.
.PP
\f4statvfs64\fP and \f4fstatvfs64\fP are similar
to \f4statvfs\fP and \f4fstatvfs\fP respectively,
except that the structure fields
\f4f_blocks\fP, \f4f_bfree\fP, \f4f_bavail\fP,
\f4f_files\fP, \f4f_ffree\fP, and \f4f_favail\fP
are 64-bit values instead of \f4ulong_t\fPs.
The block-count fields are of type \f4blkcnt_t\fP and
the file-count fields are of type \f4filcnt_t\fP.
These fields can normally overflow in a non-64-bit call
only in a 32-bit application on an XFS filesystem whose size
is larger than 1 terabyte.
.PP
For XFS filesystems with real-time subvolumes (see xfs(4)), the
\f4statvfs\fP(2) system call returns information concerning the
data portion of the filesystem only. The
\f4syssgi\fP(2) system call with the SGI_XFS_FSOPERATIONS request argument
can be used to acquire information concerning the size and usage
of space within the real-time portion of the filesystem.
.PP
The
.B ST_LOCAL
flag is off for regular files which are also swap files, since
they cannot be read even if permissions allow it.
This allows programs to detect this situation without trying
to read data from such files.
.PP
\f4statvfs\fP
fails if one or more of the following are true:
.TP 15
\f4EACCES\fP
Search permission is denied on a component of the path prefix.
.TP 15
\f4EFAULT\fP
.I path
or
.I buf
points outside the process's allocated address space.
.TP 15
\f4EINTR\fP
A signal was caught during \f4statvfs\f1 execution.
.TP 15
\f4EIO\fP
An I/O error occurred while reading the file system.
.TP 15
\f4ELOOP\fP
Too many symbolic links were encountered in translating
.IR path .
.TP 15
\f4EMULTIHOP\fP
Components of
.I path\^
require hopping to multiple remote machines
and file system type does not allow it.
.TP 15
\f4ENAMETOOLONG\fP
The length of a \f2path\f1 component
exceeds {\f4NAME_MAX\f1} characters,
or the length of
.I path\^
exceeds {\f4PATH_MAX\f1} characters.
.TP 15
\f4ENOENT\fP
Either a component of the path prefix or the file referred to by
.I path\^
does not exist.
.TP 15
\f4ENOLINK\fP
.I path\^
points to a remote machine and the link to that machine is no longer
active.
.TP 15
\f4ENOTDIR\fP
A component of the path prefix of
.I path\^
is not a directory.
.PP
\f4fstatvfs\fP
fails if one or more of the following are true:
.TP 15
\f4EFAULT\fP
.I buf\^
points to an invalid address.
.TP 15
\f4EBADF\fP
.I fildes\^
is not an open file descriptor.
.TP 15
\f4EINTR\fP
A signal was caught during \f4fstatvfs\f1 execution.
.TP 15
\f4EIO\fP
An I/O error occurred while reading the file system.
.TP 15
\f4EFBIG\fP
One of the fields overflowed (did not fit in a \f4ulong_t\fP).
See the description of \f4statvfs64\fP and \f4fstatvfs64\fP above.
.SH "DIAGNOSTICS"
Upon successful completion a value of 0 is returned.
Otherwise, a value of \-1 is returned and
\f4errno\fP
is set to indicate the error.
.SH "SEE ALSO"
\f4chmod\fP(2), \f4chown\fP(2), \f4creat\fP(2), \f4link\fP(2), \f4mknod\fP(2), \f4pipe\fP(2), \f4read\fP(2),
\f4time\fP(2), \f4unlink\fP(2), \f4utime\fP(2), \f4write\fP(2).