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