Back to index

glibc  2.9
tst-statvfs.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <sys/statvfs.h>
00003 
00004 
00005 /* This test cannot detect many errors.  But it will fail if the
00006    statvfs is completely hosed and it'll detect a missing export.  So
00007    it is better than nothing.  */
00008 static int
00009 do_test (int argc, char *argv[])
00010 {
00011   for (int i = 1; i < argc; ++i)
00012     {
00013       struct statvfs st;
00014       if (statvfs (argv[i], &st) != 0)
00015         printf ("%s: failed (%m)\n", argv[i]);
00016       else
00017         printf ("%s: free: %llu, mandatory: %s\n", argv[i],
00018                 (unsigned long long int) st.f_bfree,
00019 #ifdef ST_MANDLOCK
00020                 (st.f_flag & ST_MANDLOCK) ? "yes" : "no"
00021 #else
00022                 "no"
00023 #endif
00024                 );
00025     }
00026   return 0;
00027 }
00028 
00029 #define TEST_FUNCTION do_test (argc, argv)
00030 #include "../test-skeleton.c"