diff options
author | Hendiadyoin1 <leon.a@serenityos.org> | 2022-06-18 18:37:54 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-15 12:42:43 +0200 |
commit | d783389877435ef937b4306ac689470a5ca576bb (patch) | |
tree | 843854df4a14ace514d1f4e803e3e3a582bab5bb /Userland/Libraries | |
parent | ad904cdcab84bc2afe0c648ca126f12a781dbf5f (diff) | |
download | serenity-d783389877435ef937b4306ac689470a5ca576bb.zip |
Kernel+LibC: Add posix_fallocate syscall
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibC/fcntl.cpp | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibC/fcntl.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/fcntl.cpp b/Userland/Libraries/LibC/fcntl.cpp index e67a82d357..97fe440606 100644 --- a/Userland/Libraries/LibC/fcntl.cpp +++ b/Userland/Libraries/LibC/fcntl.cpp @@ -104,6 +104,13 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice) return 0; } +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html +int posix_fallocate(int fd, off_t offset, off_t len) +{ + // posix_fallocate does not set errno. + return static_cast<int>(syscall(SC_posix_fallocate, fd, &offset, &len)); +} + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/utimensat.html int utimensat(int dirfd, char const* path, struct timespec const times[2], int flag) { diff --git a/Userland/Libraries/LibC/fcntl.h b/Userland/Libraries/LibC/fcntl.h index 3704d6a7a7..bf640c79f5 100644 --- a/Userland/Libraries/LibC/fcntl.h +++ b/Userland/Libraries/LibC/fcntl.h @@ -29,6 +29,7 @@ int inode_watcher_add_watch(int fd, char const* path, size_t path_length, unsign int inode_watcher_remove_watch(int fd, int wd); int posix_fadvise(int fd, off_t offset, off_t len, int advice); +int posix_fallocate(int fd, off_t offset, off_t len); int utimensat(int dirfd, char const* path, struct timespec const times[2], int flag); |