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

171 lines
4.0 KiB
Groff

'\"macro stdmacro
.if n .pH g2.statfs @(#)statfs 30.3 of 3/18/86
.TH STATFS 2
.SH NAME
statfs, fstatfs \- get file system information
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.B #include <sys/statfs.h>
.sp
.B "int statfs (const char \(**path, struct statfs \(**buf, int len, int fstyp);"
.sp
.B "int fstatfs (int fildes, struct statfs \(**buf, int len, int fstyp);"
.SH DESCRIPTION
.I statfs\^
returns a ``generic superblock'' describing a file system.
It can be used to acquire information about mounted as well as
unmounted file systems, and usage is slightly different in the two cases.
In all cases,
.I buf\^
is a pointer to a structure (described below) which will be filled by
the system call, and
.I len\^
is the number of bytes of information which the system should return
in the structure.
.I Len\^
must be no greater than
.B sizeof (struct statfs)
and ordinarily it will contain exactly that value;
if it holds a smaller value the system will fill the structure
with that number of bytes. (This allows future versions of the system
to grow the structure without invalidating older binary programs.)
.PP
If the file system of interest is currently mounted,
.I path\^
should name a file which resides on that file system.
In this case the file system type is known to the operating system
and the
.I fstyp\^
argument must be zero.
For an unmounted file system
.I path\^
must name the block special file containing it and
.I fstyp\^
must contain the (non-zero) file system type.
In both cases read, write, or execute permission of the named file
is not required,
but all directories
listed in the
path name
leading to the file must be searchable.
.PP
The
.I statfs\^
structure pointed to by
.I buf\^
includes the following members:
.RS
.ta 8n 20n
short f_fstyp; /\(** File system type \(**/
.br
long f_bsize; /\(** Block size \(**/
.br
long f_frsize; /\(** Fragment size \(**/
.br
long f_blocks; /\(** Total number of blocks \(**/
.br
long f_bfree; /\(** Count of free blocks \(**/
.br
long f_files; /\(** Total number of file nodes \(**/
.br
long f_ffree; /\(** Count of free file nodes \(**/
.br
char f_fname[6]; /\(** Volume name \(**/
.br
char f_fpack[6]; /\(** Pack name \(**/
.RE
.PP
In ABI N32 applications, the fields
.BR f_blocks ,
.BR f_bfree ,
.BR f_files ,
and
.B f_ffree
are of type
.B __int64_t
.RB ( long\ long )
instead of
.BR long .
.PP
.I fstatfs\^
is similar, except that the file named by
.I path\^
in
.I statfs\^
is instead identified by an open file descriptor
.I filedes\^
obtained from a successful
\f2open\f1(2),
\f2creat\f1(2),
\f2dup\f1(2),
\f2fcntl\f1(2),
or
\f2pipe\f1(2)
system call.
.PP
.I statfs\^
obsoletes
.IR ustat (2)
and should be used in preference to it in new programs.
.PP
For XFS filesystems with real-time subvolumes (see xfs(4)), the
\f2statfs\f1(2) system call returns information concerning the
data portion of the filesystem only. The
\f2syssgi\f1(2) system call with the SGI_XFS_OPERATIONS request argument
can be used to acquire information concerning the size and usage
of space within the real-time portion of the filesystem.
.PP
.I statfs\^
and
.I fstatfs\^
will fail if one or more of the following are true:
.TP 15
.SM
\%[ENOTDIR]
A component of the
path prefix
is not a directory.
.TP
.SM
\%[ENOENT]
The named file does not exist.
.TP
.SM
\%[EACCES]
Search permission is denied for a component of the
path prefix.
.TP
.SM
\%[EFAULT]
.I Buf\^
or
.I path\^
points to an invalid address.
.TP 15
.SM
\%[EBADF]
.I Fildes\^
is not a valid open file descriptor.
.TP 15
.SM
\%[EINVAL]
.I Fstyp\^
is an invalid file system type;
.I path\^
is not a block special file and
.I fstyp\^
is nonzero;
.I len\^
is negative or is greater than
.BR "sizeof (struct statfs)" .
.SH "DIAGNOSTICS"
Upon successful completion a value of 0 is returned.
Otherwise, a value of \-1 is returned and
.I errno\^
is set to indicate the error.
.SH "SEE ALSO"
chmod(2), chown(2), creat(2), link(2), mknod(2), pipe(2), read(2), statvfs(2), time(2), unlink(2), utime(2), write(2), fs(4).
.Ee
'\".so /pubs/tools/origin.att