chiark / gitweb /
9b7a26d91601e431ab0da6b4f08ebe0b05471b17
[elogind.git] / klibc / klibc / tests / statfs.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <errno.h>
4 #include <sys/vfs.h>
5
6 static void do_statfs(const char *path)
7 {
8   struct statfs sfs;
9
10   if ( statfs(path, &sfs) ) {
11     perror(path);
12     exit(1);
13   }
14
15   printf("Path = %s\n"
16          "   f_type     = %#jx\n"
17          "   f_bsize    = %jd\n"
18          "   f_blocks   = %jd\n"
19          "   f_bfree    = %jd\n"
20          "   f_bavail   = %jd\n"
21          "   f_files    = %jd\n"
22          "   f_ffree    = %jd\n"
23          "   f_namelen  = %jd\n",
24          path,
25          (uintmax_t)sfs.f_type,
26          (intmax_t)sfs.f_bsize,
27          (intmax_t)sfs.f_blocks,
28          (intmax_t)sfs.f_bfree,
29          (intmax_t)sfs.f_bavail,
30          (intmax_t)sfs.f_files,
31          (intmax_t)sfs.f_ffree,
32          (intmax_t)sfs.f_namelen);
33 }
34
35 int main(int argc, char *argv[])
36 {
37   int i;
38
39   for ( i = 1 ; i < argc ; i++ )
40     do_statfs(argv[i]);
41
42   return 0;
43 }