DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

statvfs(S-osr5)


statvfs, fstatvfs -- get filesystem information

Syntax

cc . . . -lc
#include <sys/types.h>
#include <sys/statvfs.h>

int statvfs(const char *path, struct statvfs *buf);

int fstatvfs(int fildes, struct statvfs *buf);

Description

statvfs- report on a filesystem

fstatvfs- report on a filesystem using a file descriptor

statvfs returns a ``generic superblock'' describing a filesystem; it can be used to acquire information about mounted filesystems. buf is a pointer to a structure (described below) that is filled by the system call.

path should name a file that resides on that filesystem. The filesystem 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 pathname leading to the file must be searchable.

The statvfs structure pointed to by buf includes the following members:

unsigned long	f_bsize;      /* preferred filesystem block size */
unsigned long	f_frsize;     /* fundamental filesystem block size */
                              /* (if supported) */
unsigned long	f_blocks;     /* total # of blocks on filesystem in */
                              /* units of f_frsize */
unsigned long	f_bfree;      /* total # of free blocks */
unsigned long	f_bavail;     /* # of free blocks avail to */
                              /* non-superuser */
unsigned long	f_files;      /* total # of file nodes (inodes) */
unsigned long	f_ffree;      /* total # of free file nodes */
unsigned long	f_favail;     /* # of inodes avail to non-superuser */
unsigned long	f_fsid;       /* filesystem id (dev for now) */
char	f_basetype[FSTYPSZ];  /* target fs type name, null-terminated */
unsigned long	f_flag;       /* bit mask of flags */
unsigned long	f_namemax;    /* maximum file name length */
char	f_fstr[32];           /* filesystem specific string */
unsigned long	f_filler[16]; /* reserved for future expansion */
f_basetype contains a null-terminated file system type name of the mounted target (for example, an HTFS filesystem mounted over NFS will contain NFS).

The following flags can be returned in the f_flag field:

   ST_RDONLY   /* read-only filesystem */
   ST_NOSUID   /* does not support setuid/setgid semantics */
   ST_NOTRUNC  /* does not truncate filenames longer than {NAME_MAX} */
fstatvfs 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(S-osr5), creat(S-osr5), dup(S-osr5), fcntl(S-osr5), or pipe(S-osr5) system call.

Return values

On success, statvfs and fstatvfs return 0. On failure, statvfs and fstatvfs return -1 and set errno to identify the error.

Diagnostics

In the following conditions, statvfs fails and sets errno to:

[EACCES]
Search permission is denied on a component of the path prefix.

[EFAULT]
path or buf points outside the process's allocated address space.

[EINTR]
A signal was caught during statvfs execution.

[EIO]
An I/O error occurred while reading the filesystem.

[ELOOP]
Too many symbolic links were encountered in translating path.

[EMULTIHOP]
Components of path require hopping to multiple remote machines and filesystem type does not allow it.

[ENAMETOOLONG]
The length of a path component exceeds {NAME_MAX} characters, or the length of path exceeds {PATH_MAX} characters.

[ENOENT]
Either a component of the path prefix or the file referred to by path does not exist.

[ENOLINK]
path 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.
In the following conditions, fstatvfs fails and sets errno to:

[EFAULT]
buf points to an invalid address.

[EBADF]
fildes is not an open file descriptor.

[EINTR]
A signal was caught during fstatvfs execution.

[EIO]
An I/O error occurred while reading the filesystem.

Files


/lib/libc.a
linking library

See also

chmod(S-osr5), chown(S-osr5), creat(S-osr5), link(S-osr5), mknod(S-osr5), pipe(S-osr5), read(S-osr5), time(S-osr5), unlink(S-osr5), utime(S-osr5), write(S-osr5)

Standards conformance

statvfs and fstatvfs are conformant with:

AT&T SVID Issue 3.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005