summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC/sys/statvfs.cpp
blob: d49e38623b5d6e90c87c2688271bcf77c07f9954 (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
/*
 * Copyright (c) 2021, Justin Mietzner <sw1tchbl4d3@sw1tchbl4d3.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <errno.h>
#include <string.h>
#include <sys/statvfs.h>
#include <syscall.h>

extern "C" {

int statvfs(const char* path, struct statvfs* buf)
{
    Syscall::SC_statvfs_params params { { path, strlen(path) }, buf };
    int rc = syscall(SC_statvfs, &params);
    __RETURN_WITH_ERRNO(rc, rc, -1);
}

int fstatvfs(int fd, struct statvfs* buf)
{
    int rc = syscall(SC_fstatvfs, fd, buf);
    __RETURN_WITH_ERRNO(rc, rc, -1);
}
}