Xref: utzoo comp.unix.questions:23369 comp.sys.pyramid:858 Path: utzoo!attcan!uunet!seismo!ukma!rex!samsung!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!att!dptg!pegasus!mpl From: mpl@pegasus.ATT.COM (Michael P. Lindner) Newsgroups: comp.unix.questions,comp.sys.pyramid Subject: Re: getting 'df' info from inside a program? Message-ID: <4881@pegasus.ATT.COM> Date: 28 Jun 90 21:57:11 GMT References: <797@massey.ac.nz> <3394@sactoh0.UUCP> Reply-To: mpl@pegasus.ATT.COM (Michael P. Lindner) Organization: AT&T Bell Labs NJ USA Lines: 19 In article <3394@sactoh0.UUCP> jak@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) 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