www.delorie.com/djgpp/doc/libc/libc_747.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

statvfs

Syntax

 
#include <sys/types.h>
#include <sys/statvfs.h>

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

Description

This function returns information about the "filesystem" (FS) containing path and stores it in sbuf, which has the structure below:

 
struct statvfs {
  unsigned long f_bsize;   /* FS block size */
  unsigned long f_frsize;  /* fundamental block size */
  fsblkcnt_t    f_blocks;  /* # of blocks on FS of size f_frsize */
  fsblkcnt_t    f_bfree;   /* # of free blocks on FS of size f_frsize */
  fsblkcnt_t    f_bavail;  /* # of free blocks on FS of size f_frsize
                            * for unprivileged users */
  fsfilcnt_t    f_files;   /* # of file serial numbers */
  fsfilcnt_t    f_ffree;   /* # of free file serial numbers */
  fsfilcnt_t    f_favail;  /* # of free file serial numbers
                            * for unprivileged users */
  unsigned long f_fsid;    /* FS identifier */
  unsigned long f_flag;    /* FS flags: bitwise OR of ST_NOSUID,
                            * ST_RDONLY */
  unsigned long f_namemax; /* Maximum file name length on FS */
};

Note that if INT 21h is hooked by a TSR, the total size is limited to approximately 2GB. TSRs that hook INT 21h include:

These may be loaded by `autoexec.bat' or `config.sys'.

The fundamental block size is considered to be a cluster. Really the fundamental block is the sector of the physical media rather than the logical block of the filesystem, but the sector size cannot be determined in all cases. So for consistency we return the cluster size.

Return Value

Zero on success, nonzero on failure (and errno set).

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001 (see note 1)

Notes:

  1. See the comments on the fundamental block size above.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004