Can any one please find out the problem in this code. Problem is its showing same output for all pathnames ,even though they have different contents,different files.
#include<stdio.h>
#include<sys/stat.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/vfs.h>
int main(int argc,char *argv[])
{
struct statfs sb;
if((statfs(argv[1],&sb))==0)
{
printf("optimal transfer blk size is %d
",sb.f_bsize);
printf("total data blocks are %d
",sb.f_blocks);
printf("free blocks in fs are %d
",sb.f_bfree);
printf("total file nodes in fs are %d
",sb.f_files);
printf("free file nodes in fs are %d
",sb.f_ffree);
}
}
[testuser@hdchshocms6344 ex4]$ ./a.out /home/testuser
optimal transfer blk size is 4096
total data blocks are 8819390
free blocks in fs are 6771045
total file nodes in fs are 2240224
free file nodes in fs are 1927385
[testuser@hdchshocms6344 ex4]$ ./a.out /home/testuser/harish
optimal transfer blk size is 4096
total data blocks are 8819390
free blocks in fs are 6771034
total file nodes in fs are 2240224
free file nodes in fs are 1927386
提前感谢。