checking disk space from c program

Mike Ditto ford at kenobi.UUCP
Sun Apr 10 05:52:44 AEST 1988


Posting-Front-End: GNU Emacs 18.41.10 of Fri Oct  2 1987 on kenobi (usg-unix-v)


In article <398 at wpg.UUCP> russ at wpg.UUCP (Russell Lawrence) writes:

> I'm stumped.  Apart from using system() to run 'df', could someone 
> please suggest a method for checking available disk space from a 
> c program?

Read /etc/mnttab to see what devices are mounted, and use the ustat
system call to check the status of each.  Or, if you are wondering how
big you can make a certain file, you can also stat() the file (or the
directory in which you intend to create it) to see what device it is
on, and ustat() that.

See mnttab(4), stat(2), ustat(2).

					-=] Ford [=-

"Once there were parking lots,		(In Real Life:  Mike Ditto)
now it's a peaceful oasis.		ford%kenobi at crash.CTS.COM
This was a Pizza Hut,			...!sdcsvax!crash!kenobi!ford
now it's all covered with daisies." -- Talking Heads



More information about the Comp.unix.questions mailing list