ftp.delorie.com/djgpp/doc/libc/libc_745.html   search  
libc.a reference

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

statfs

Syntax

 
#include <sys/vfs.h>

int statfs(const char *filename, struct statfs *buf);

Description

This function returns information about the given "filesystem". The drive letter of the given filename, or the default drive if none is given, is used to retrieve the following structure:

 
struct statfs
{
    long	f_type;   /* 0 */
    long	f_bsize;  /* bytes per cluster */
    long	f_blocks; /* clusters on drive */
    long	f_bfree;  /* available clusters */
    long	f_bavail; /* available clusters */
    long	f_files;  /* clusters on drive */
    long	f_ffree;  /* available clusters */
    fsid_t	f_fsid;   /* array: [0]=drive_number, [1]=MOUNT_UFS */
    long	f_magic;  /* FS_MAGIC */
};

Note that if INT 21h is hooked by a TSR, the total size is limited to approximately 2GB (see section statvfs).

Note that there is a POSIX-compliant function statvfs (see section statvfs), which returns similar information.

Return Value

Zero on success, nonzero on failure.

Portability

ANSI/ISO C No
POSIX No

Example

 
struct statfs fs;
unsigned long long bfree, bsize;

statfs("anything", &fs);
bfree = fs.f_bfree;
bsize = fs.f_bsize;
printf("%llu bytes left\n", bfree * bsize);


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004