aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/options/posix/generic/sys-statvfs-stubs.cpp
blob: c02cc390dacee5c557ce1f1ad2055c1b5236af0c (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
#include <errno.h>
#include <sys/statvfs.h>

#include <bits/ensure.h>
#include <mlibc/posix-sysdeps.hpp>

int statvfs(const char *path, struct statvfs *out) {
	MLIBC_CHECK_OR_ENOSYS(mlibc::sys_statvfs, -1);
	if(int e = mlibc::sys_statvfs(path, out); e) {
		errno = e;
		return -1;
	}
	return 0;
}

int fstatvfs(int fd, struct statvfs *out) {
	MLIBC_CHECK_OR_ENOSYS(mlibc::sys_fstatvfs, -1);
	if(int e = mlibc::sys_fstatvfs(fd, out); e) {
		errno = e;
		return -1;
	}
	return 0;
}