fstatfs

Hurricane Electric Internet Services: Accounts starting at $9.95/month
Hurricane Electric Internet Services

NAME

       statfs, fstatfs - get file system statistics


SYNOPSIS

       #include <sys/vfs.h>

       int statfs(const char *path, struct statfs *buf);
       int fstatfs(int fd, struct statfs *buf);


DESCRIPTION

       returns  information about a mounted file system.  Path is
       the path name of any file within the  mounted  filesystem.
       Buf is a pointer to a statfs structure defined as follows:

              struct statfs {
                 long    f_type;     /* type of filesystem (see below) */
                 long    f_bsize;    /* optimal transfer block size */
                 long    f_blocks;   /* total data blocks in file system */
                 long    f_bfree;    /* free blocks in fs */
                 long    f_bavail;   /* free blocks avail to non-superuser */
                 long    f_files;    /* total file nodes in file system */
                 long    f_ffree;    /* free file nodes in fs */
                 fsid_t  f_fsid;     /* file system id */
                 long    f_namelen;  /* maximum length of filenames */
                 long    f_spare[6]; /* spare for later */
              };

              File system types:

              linux/ext2_fs.h:  EXT2_OLD_SUPER_MAGIC  0xEF51
              linux/ext2_fs.h:  EXT2_SUPER_MAGIC      0xEF53
              linux/ext_fs.h:   EXT_SUPER_MAGIC       0x137D
              linux/iso_fs.h:   ISOFS_SUPER_MAGIC     0x9660
              linux/minix_fs.h: MINIX_SUPER_MAGIC     0x137F /* orig. minix */
              linux/minix_fs.h: MINIX_SUPER_MAGIC2    0x138F /* 30 char minix */
              linux/minix_fs.h: NEW_MINIX_SUPER_MAGIC 0x2468 /* minix V2 */
              linux/msdos_fs.h: MSDOS_SUPER_MAGIC     0x4d44
              linux/nfs_fs.h:   NFS_SUPER_MAGIC       0x6969
              linux/proc_fs.h:  PROC_SUPER_MAGIC      0x9fa0
              linux/xia_fs.h:   _XIAFS_SUPER_MAGIC    0x012FD16D

       Fields that are undefined for a particular file system are
       set  to -1.  Fstatfs returns the same information about an
       open file referenced by descriptor fd.


RETURN VALUE

       On success, zero is returned.  On error, -1  is  returned,
       and errno is set appropriately.


ERRORS

       For statfs:

       ENOTDIR A  component  of  the path prefix of Path is not a
               directory.

       EINVAL  path contains a character with the high-order  bit
               set.

       ENAMETOOLONG
               The  length  of  a  component  of path exceeds 255
               characters, or the length  of  path  exceeds  1023
               characters.  [Documenter's  note: are these values
               correct for Linux?]

       ENOENT  The file referred to by path does not exist.

       EACCES  Search permission is denied for a component of the
               path prefix of path.

       ELOOP   Too many symbolic links were encountered in trans-
               lating path.

       EFAULT  Buf or path points to an invalid address.

       EIO     An I/O error occurred while reading from or  writ-
               ing to the file system.

       For fstatfs:

       EBADF   Fd is not a valid open file descriptor.

       EFAULT  Buf points to an invalid address.

       EIO     An  I/O error occurred while reading from or writ-
               ing to the file system.


SEE ALSO

       stat(2)
Hurricane Electric Internet Services: Accounts starting at $9.95/month
Hurricane Electric Internet Services
Copyright (C) 1998 Hurricane Electric. All Rights Reserved.