LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   programmatic disk free information (https://www.linuxquestions.org/questions/linux-software-2/programmatic-disk-free-information-191061/)

vidi 06-08-2004 07:22 AM

programmatic disk free information
 
Hello everybody,

I'm writing an application that has to run on SuSE and on Montavista. I need to see the amount of disk space available. So far the only option I found was to do a 'df' and then parse the result.

Do you know any other solution to this? I would prefer to do it programmatic way since I think it would be faster and safer (something similar to accessing /proc/meminfo for information about memory usage).

Thanks,
vidi

csfalcon 06-08-2004 09:39 AM

Hi,

These functions are what you are looking for
Code:

man getmntent

man getfsent


vidi 06-10-2004 01:27 AM

These functions will give me the partition list. They are useful BUT what I need is for each mounted partition to get its size and the available/used space.

Basically what I need is exactly what the command 'df' does but I have to do it in my program. I wouldn't use df as I want to have as little dependencies as possible.


All times are GMT -5. The time now is 05:54 PM.