john@vpk1.UUCP (06/30/90)
In article <3394@sactoh0.UUCP> Jay A. Konigsberg writes >In article <797@massey.ac.nz> GEustace@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) Nope...I'm afraid that just won't do it. The stat() system call performs on 'FILES' not 'FILE SYSTEMS'. You were very close though. The call that Glen is looking for is ustat() (Unix SysV) #include <sys/types.h> #include <ustat.h> int ustat (dev, buf) int dev; struct ustat *buf; where 'dev' is a device number of a device containing the file system in question (mounted) and buf is a pointer to a structure containing the following: daddr_t f_tfree; /* Total free blocks*/ ino_t f_tinode; /* Number of free inodes */ char f_fname[6]; /* Name of file system */ char f_fpack[6]; /* File system pack name */ All of this is documented in the Unix Programmer's Reference Manual available from AT&T: Order Code: 307-013 by phone: 1-800-432-6600 (continental US) 1-317-352-8557 (outside cont. US) Last time I checked it was going for about $50 US. Good Luck! ____________________________________________________________________________ === =--==== AT&T Canada Inc. John Benfield =----==== 3650 Victoria Park Ave. Network Support Analyst (MIS) =----==== Suite 800 ==--===== Willowdale, Ontario attmail : ~jbenfield ======= M2H-3P7 email : uunet!attcan!john === Compu$erve: 72137,722 ____"Sometimes it just happens...People explode...Natural causes."__________