How do "df" from within a C program?

Richard H. Gumpertz rhg at cpsolv.UUCP
Fri Dec 22 02:31:35 AEST 1989


I have a C program that would like to take special action when disk
space is getting tight for the group of files that it writes (to avoid
running out completely).
	1) How can a C program get the space available on a file system
	   (i.e., do the equivalent of a "df" command)?
	2) How can a C program determine which file system a particular
	   directory is on (so that it can find the appropriate argument
	   for doing the equivalent of "df")?
	3) I am using an AT&T Unix PC, OS release 3.51 (roughly Vr2); a
	   system-specific answer will do IF NECESSARY.
	4) What are the portability issues of the answers to the above?
-- 
===============================================================================
| Richard H. Gumpertz rhg%cpsolv at uunet.uu.NET -or- ...uunet!amgraf!cpsolv!rhg |
| Computer Problem Solving, 8905 Mohawk Lane, Leawood, Kansas 66206-1749      |
===============================================================================



More information about the Comp.unix.questions mailing list