7 struct statfs
*buf
= NULL
;
11 int fscount
, newfscount
;
13 fscount
= getfsstat(NULL
, 0, 0);
14 TEST((fscount
!= -1));
15 printf("Number of filesystems: %d\n", fscount
);
16 buf
= malloc(sizeof(struct statfs
) * fscount
);
18 newfscount
= getfsstat(buf
, (long) sizeof(struct statfs
) * fscount
, 0);
19 TEST((newfscount
!= -1));
20 TEST((newfscount
== fscount
));
21 printf("Printing filesystem data:\n\n");
22 for(i
= 0; i
< newfscount
; i
++)
24 printf("Record number:\t\t%d\n", i
+1);
25 printf("Name:\t\t\t%s\n", buf
[i
].f_mntonname
);
26 printf("Fundamental block size:\t%ld\n", buf
[i
].f_fsize
);
27 printf("Optimal block size:\t%ld\n", buf
[i
].f_bsize
);
28 printf("Number of blocks:\t%ld\n", buf
[i
].f_blocks
);
29 printf("Free blocks:\t\t%ld\n", buf
[i
].f_bfree
);
30 printf("Available blocks:\t%ld\n", buf
[i
].f_bavail
);
33 newfscount
= getfsstat(buf
, 1, 0);
34 TEST((newfscount
== 0));