mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
LibC: Add functions for the new statvfs syscalls
This commit adds the statvfs() and fstatvfs() functions into LibC.
This commit is contained in:
parent
1c3badede3
commit
45a1a7e1e6
3 changed files with 63 additions and 0 deletions
26
Userland/Libraries/LibC/sys/statvfs.cpp
Normal file
26
Userland/Libraries/LibC/sys/statvfs.cpp
Normal file
|
@ -0,0 +1,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, ¶ms);
|
||||
__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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue