[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Protux-devel] help on disk free detection
From: |
Luciano Giordana |
Subject: |
Re: [Protux-devel] help on disk free detection |
Date: |
Fri, 25 Jul 2003 11:41:51 -0300 |
User-agent: |
KMail/1.5 |
Thanks Tapio, that help me a lot.
Now I can improve Interface::update_system_resources() so it should stop
crashing...
L
On Friday 25 July 2003 06:47 am, tapio laxström wrote:
> I even found some old test code :)
>
>
> #include <stdio.h>
> #include <sys/vfs.h> /* statfs */
>
> int main(int argc, char **argv)
> {
> struct statfs sf;
>
> if(argc > 1) {
> statfs(argv[1], &sf);
> } else {
> statfs("/", &sf);
> }
>
> /* f_bavail == for non-superuser, f_bfree == for superuser */
> printf("block size: %d\n", sf.f_bsize);
> printf("free blocks: %d (%d for superuser)\n",
> sf.f_bavail,
> sf.f_bfree
> );
> printf("free bytes: %d (%d for superuser)\n",
> sf.f_bavail * sf.f_bsize,
> sf.f_bfree * sf.f_bsize
> );
>
> return 0;
> }
--
Best Regards
--
Luciano Giordana - Musician - Certified Java/GNU C++ Developer - Free Software
Evangelist
Project Mustux - http://www.freesoftware.fsf.org/mustux
-- GNU/Linux adoption grew 65% only this yer. Smile : we're winning. --