summaryrefslogtreecommitdiffstats
path: root/usr/klibc/tests/statfs.c
blob: 0ac805118acd95e690562164a201afe943d527c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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;
}