Path: utzoo!mnetor!uunet!husc6!think!ames!ucsd!sdcsvax!ucsdhub!jack!portnoy!kenobi!ford From: ford@kenobi.UUCP (Mike Ditto) Newsgroups: comp.unix.questions Subject: Re: checking disk space from c program Message-ID: <71@kenobi.UUCP> Date: 9 Apr 88 19:52:44 GMT References: <398@wpg.UUCP> Organization: Omnicron Data Systems, P.O. Box 1721, Bonita, California Lines: 20 Summary: ustat(2) In-reply-to: russ@wpg.UUCP's message of 8 Apr 88 07:30:17 GMT Posting-Front-End: GNU Emacs 18.41.10 of Fri Oct 2 1987 on kenobi (usg-unix-v) In article <398@wpg.UUCP> russ@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@crash.CTS.COM This was a Pizza Hut, ...!sdcsvax!crash!kenobi!ford now it's all covered with daisies." -- Talking Heads