getting 'df' info from inside a program?

Shu-Wie F Chen swfc at ulysses.att.com
Sat Jun 30 00:58:12 AEST 1990


In article <4881 at pegasus.ATT.COM>, mpl at pegasus.ATT.COM (Michael P.
Lindner) writes:
|>In article <3394 at sactoh0.UUCP> jak at sactoh0.UUCP (Jay A. Konigsberg) writes:
|>>In article <797 at massey.ac.nz> GEustace at massey.ac.nz (Glen Eustace) writes:
|>>>We are trying to write some code that will check whether a file will
|>>>fit on a given file system prior to copying it.  It would be great if
|>>>the information given in a 'df' were available with some system call.
|>>>Does anyone know whether there is one and if so how one uses it.
|>>>
|>>This looks like a job for the stat() system call. (Sys V)
|>	code deleted
|>
|>Close, but NO CIGAR!
|>Glen KNOWS how big his file is.  The problem is to find out how much space
|>is available in the destination filesystem.  To do that call statfs() (Sys
|>V once again).  On older systems you could use ustat().  See section 2 of
|>the programmer's reference manual for more info.
|>
|>Mike Lindner
|>AT&T Bell Labs
|>attmail!mplindner
                   

So what happens if two of these things execute simultaneously.  Both
calculate that they can copy their files onto the file system and try to
do so.  If the sum of the sizes of both files is greater than the
available space, one of those processes will lose.

Or is this not a problem?  That is, will you check afterwards if the
copy was successful, etc.

*swfc



More information about the Comp.sys.pyramid mailing list