somani@parns.nsc.com (Anil Somani) (08/25/89)
What is the best way to find out current available diskspace from within a program? One way is - system("df . > /tmp/somename"); and then parse the file /tmp/somename. I am sure there is a better way. I am using SunOS 4.0.3. thanks in advance, -Anil -- Anil Somani uucp: {sun|hplabs|amdahl|decwrl}!nsc!parns!somani National Semiconductor Domain: somani@parns.nsc.com 2900 Semiconductor Dr. Corporate Design Automation, M/S D3-677 Santa Clara, CA 95052-8090 Phone: (408)721-4146
jpr@dasys1.UUCP (Jean-Pierre Radley) (09/07/89)
In article <146@beta.nsc.com> somani@parns.nsc.com (Anil Somani) writes: >What is the best way to find out current available diskspace >from within a program? One way is - > system("df . > /tmp/somename"); Have you tried the ustat() call? It uses the ustat structure which looks like this: struct ustat { daddr_t f_tfree; /* total free blocks */ ino_t f_tinode; /* total inodes free */ char f_fname[6]; /* filsys name */ char f_fpack[6]; /* filsys pack name */ }; -- Jean-Pierre Radley jpr@jpradley.uucp New York, NY 72160.1341@compuserve.com
tjo@fulcrum.bt.co.uk (Tim Oldham) (09/11/89)
In article <10651@dasys1.UUCP> jpr@dasys1.UUCP (Jean-Pierre Radley) writes: >In article <146@beta.nsc.com> somani@parns.nsc.com (Anil Somani) writes: >>What is the best way to find out current available diskspace >>from within a program? > >Have you tried the ustat() call? AT&T UNIX System V Programmer's Reference Manual, statfs(2): "statfs obsoletes ustat and should be used in preference to it in new programs." Much better all round. Tim. -- Tim Oldham tjo@fulcrum.bt.co.uk or ...!mcvax!ukc!axion!fulcrum!tjo #include <stdisclaim> Why have coffee, when caffeine tastes this good?