21 mntsize = getmntinfo(&fs, MNT_NOWAIT);
27 for(i=0;i<mntsize;i++)
28 getstatfs(fs[i].f_mntonname);
31 #elif defined( __linux__ )
34 f = setmntent("/etc/mtab", "r");
35 while ((m = getmntent(f)))
36 getstatfs(m->mnt_dir);
45 int getstatfs(char *path)
51 if(statfs(path, &fs) != 0)
54 if((fs.f_bfree == 0)||(fs.f_ffree == 0))
56 percentbfree = (int)(100*fs.f_bfree)/fs.f_blocks;
57 percentnfree = (int)(100*fs.f_ffree)/fs.f_files;
58 printf("file system for %s has %d free blocks out of a total of %d - %d. Total of %d%% FREE \n",path,fs.f_ffree,fs.f_blocks,percentbfree,percentnfree);