OSDN Git Service

test: disable librt shmtest on non-MMU systems
[uclinux-h8/uClibc.git] / test / misc / tst-statfs.c
1 #include <sys/vfs.h>
2 #include <errno.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6
7 int
8 main(int argc, char* argv[])
9 {
10         struct statfs s;
11         int ret = 0, i;
12
13         for (i = 1; i < argc; i++) {
14                 if (statfs(argv[i], &s) != 0) {
15                         fprintf(stderr, "%s: %s: statfs failed. %s\n",
16                                 *argv, argv[i], strerror(errno));
17                         exit(EXIT_FAILURE);
18                 }
19                 ++ret;
20                 printf("statfs %s:\n\tblocks=%lld\n\tblkfree=%lld\n\tbsize=%d\n",
21                         argv[i], s.f_blocks, s.f_bfree, s.f_bsize);
22 #ifdef _STATFS_F_FRSIZE
23                 printf("\tfrsize=%lld\n", s.f_frsize);
24 #elif defined __mips__
25                 printf("\tfrsize=mips, unsupported?\n");
26 #else
27 # error no _STATFS_F_FRSIZE
28 #endif
29         }
30         exit(ret ? EXIT_SUCCESS : EXIT_FAILURE);
31 }