Check for SYS/GL during library init. Reason is that
[AROS.git] / test / clib / getfsstat.c
blob23602c18e6cccdaab1572323641050972834dbf4
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <stdlib.h>
7 #include <sys/types.h>
8 #include <sys/mount.h>
9 #include <stdio.h>
10 #include "test.h"
12 struct statfs *buf = NULL;
14 int main()
16 int fscount, newfscount;
17 int i;
18 fscount = getfsstat(NULL, 0, 0);
19 TEST((fscount != -1));
20 printf("Number of filesystems: %d\n", fscount);
21 buf = malloc(sizeof(struct statfs) * fscount);
22 TEST(buf);
23 newfscount = getfsstat(buf, (long) sizeof(struct statfs) * fscount, 0);
24 TEST((newfscount != -1));
25 TEST((newfscount == fscount));
26 printf("Printing filesystem data:\n\n");
27 for(i = 0; i < newfscount; i++)
29 printf("Record number:\t\t%d\n", i+1);
30 printf("Name:\t\t\t%s\n", buf[i].f_mntonname);
31 printf("Fundamental block size:\t%ld\n", buf[i].f_fsize);
32 printf("Optimal block size:\t%ld\n", buf[i].f_bsize);
33 printf("Number of blocks:\t%ld\n", buf[i].f_blocks);
34 printf("Free blocks:\t\t%ld\n", buf[i].f_bfree);
35 printf("Available blocks:\t%ld\n", buf[i].f_bavail);
36 printf("\n");
38 newfscount = getfsstat(buf, 1, 0);
39 TEST((newfscount == 0));
40 cleanup();
42 return OK;
45 void cleanup()
47 if(buf)
48 free(buf);