1#include <stdio.h>
2#include <sys/statfs.h>
3#include <sys/statvfs.h>
4#include <support/check.h>
5
6
7/* This test cannot detect many errors. But it will fail if the
8 statvfs is completely hosed and it'll detect a missing export. So
9 it is better than nothing. */
10static int
11do_test (int argc, char *argv[])
12{
13 for (int i = 1; i < argc; ++i)
14 {
15 struct statvfs st;
16 struct statfs stf;
17 TEST_COMPARE (statvfs (argv[i], &st), 0);
18 TEST_COMPARE (statfs (argv[i], &stf), 0);
19 TEST_COMPARE (st.f_type, (unsigned int) stf.f_type);
20 printf (format: "%s: free: %llu, mandatory: %s, tp=%x\n", argv[i],
21 (unsigned long long int) st.f_bfree,
22#ifdef ST_MANDLOCK
23 (st.f_flag & ST_MANDLOCK) ? "yes" : "no",
24#else
25 "no",
26#endif
27 st.f_type);
28 }
29 return 0;
30}
31
32#define TEST_FUNCTION do_test (argc, argv)
33#include "../test-skeleton.c"
34

source code of glibc/io/tst-statvfs.c