www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/12/12/02:17:54

To: "Marty Leisner" <leisner AT sdsp DOT mc DOT xerox DOT com>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: how to get filesystem info?
Date: Mon, 12 Dec 94 08:12:04 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>

> What's a portable way to get file system information on 
> go32 (it probably will have to be created).

That one's in the manual.  If you do this:

	C:\> Info libc.a Alphabetical statfs

you will see this:

------------------- begin enclosed material --------------------------

File: libc,  Node: statfs,  Next: stdin/stdout/stderr/stdprn/stdaux,  Prev: stat
_assist,  Up: Alphabetical List

`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;   /* [0]=drive_number, [1]=MOUNT_UFS
         long   f_magic;  /* FS_MAGIC */
     };

Return Value
------------

Zero on success, nonzero on failure.

Example
-------

     struct statfs fs;
     statfs("anything", &fs);
     printf("%d bytes left\n", fs.f_bfree * fs.f_bsize);

--------------------- end of enclosed material --------------------

The name of the structura and its contents are different, though,
from what you will see on a Unix box, so its portability, not
surprisingly, is, er, limited...

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019