LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Disk Usage Statistics (https://www.linuxquestions.org/questions/programming-9/disk-usage-statistics-496133/)

ftenario 10-27-2006 01:05 PM

Disk Usage Statistics
 
Hello,

How do you get the disk usage statistics just like the output of "df"?
I want to include this is my application. I was able to extract other information like cpu, memory, load average from the /proc file.

Any ideas?

thanks
ferd

krizzz 10-27-2006 01:22 PM

Hi,
Kind of quick solution would be to just call df from your program and capture the output ...

ftenario 10-27-2006 01:28 PM

Thanks. I'm kind of thinking of that solution but would like to try another solution first. Perhaps a system call?

any other?

krizzz 10-27-2006 01:33 PM

Have a look at busybox's minimalistic implementation of df at www.busybox.net

xhi 10-27-2006 01:35 PM

what does df read from? probably /proc/diskstats ? you could parse from there

krizzz 10-27-2006 01:39 PM

There's also something like statfs, try man statfs.

ftenario 10-27-2006 02:02 PM

thank you for your replies. statvfs or statfs will do

ftenario 10-30-2006 12:33 PM

never mind. thanks.


All times are GMT -5. The time now is 09:42 AM.