summaryrefslogtreecommitdiff
path: root/test/misc/tst-statvfs.c
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-10-24 20:22:12 +0200
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-10-24 20:22:12 +0200
commit7988979a722b4cdf287b2093956a76a3f19b9897 (patch)
treed35e251d0472ceca55a2eef61cff261c8ee68fab /test/misc/tst-statvfs.c
add uClibc-ng test directory
Diffstat (limited to 'test/misc/tst-statvfs.c')
-rw-r--r--test/misc/tst-statvfs.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/misc/tst-statvfs.c b/test/misc/tst-statvfs.c
new file mode 100644
index 0000000..4b67719
--- /dev/null
+++ b/test/misc/tst-statvfs.c
@@ -0,0 +1,26 @@
+#include <sys/statvfs.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int
+main(int argc, char* argv[])
+{
+ struct statvfs s;
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ if (statvfs(argv[i], &s) != 0) {
+ fprintf(stderr, "%s: %s: statvfs failed. %s\n",
+ *argv, argv[i], strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ printf("statvfs %s:\n\tblocks=%lld\n\tblkfree=%lld\n\tbsize=%d\n",
+ argv[i], s.f_blocks, s.f_bfree, s.f_bsize);
+#if 1 // def _STATFS_F_FRSIZE
+ printf("\tfrsize=%lld\n", s.f_frsize);
+#endif
+ }
+ exit(EXIT_SUCCESS);
+}