summaryrefslogtreecommitdiffstats
path: root/usr/klibc/tests/statfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/tests/statfs.c')
-rw-r--r--usr/klibc/tests/statfs.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/usr/klibc/tests/statfs.c b/usr/klibc/tests/statfs.c
new file mode 100644
index 0000000..0ac8051
--- /dev/null
+++ b/usr/klibc/tests/statfs.c
@@ -0,0 +1,41 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/vfs.h>
+
+static void do_statfs(const char *path)
+{
+ struct statfs sfs;
+
+ if (statfs(path, &sfs)) {
+ perror(path);
+ exit(1);
+ }
+
+ printf("Path = %s\n"
+ " f_type = %#jx\n"
+ " f_bsize = %jd\n"
+ " f_blocks = %jd\n"
+ " f_bfree = %jd\n"
+ " f_bavail = %jd\n"
+ " f_files = %jd\n"
+ " f_ffree = %jd\n"
+ " f_namelen = %jd\n",
+ path,
+ (uintmax_t) sfs.f_type,
+ (intmax_t) sfs.f_bsize,
+ (intmax_t) sfs.f_blocks,
+ (intmax_t) sfs.f_bfree,
+ (intmax_t) sfs.f_bavail,
+ (intmax_t) sfs.f_files,
+ (intmax_t) sfs.f_ffree, (intmax_t) sfs.f_namelen);
+}
+
+int main(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ do_statfs(argv[i]);
+
+ return 0;
+}