aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/options/linux/generic/sys-statfs-stubs.cpp
blob: 6152ef27c234a96284c78c87980fd3510a7713b2 (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

#include <errno.h>
#include <sys/statfs.h>
#include <bits/ensure.h>

#include <mlibc/debug.hpp>
#include <mlibc/linux-sysdeps.hpp>

int statfs(const char *path, struct statfs *buf) {
	MLIBC_CHECK_OR_ENOSYS(mlibc::sys_statfs, -1);
	if(int e = mlibc::sys_statfs(path, buf); e) {
		errno = e;
		return -1;
	}
	return 0;
}

int fstatfs(int fd, struct statfs *buf) {
	MLIBC_CHECK_OR_ENOSYS(mlibc::sys_fstatfs, -1);
	if (int e = mlibc::sys_fstatfs(fd, buf); e) {
		errno = e;
		return -1;
	}
	return 0;
}