diff options
author | Anton Kling <anton@kling.gg> | 2023-10-24 14:10:07 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-10-24 14:10:07 +0200 |
commit | 2292b11e82a3d6d70e7bb932c512155dc13c5025 (patch) | |
tree | da7d90e778495bc9a67ee0e09b32813c11dc6fe5 /userland/libc/unistd/ftruncate.c | |
parent | e93a49d1eadf4a4b36369e67f112f8c45a0d567e (diff) |
VFS/LibC: Create ftruncate function and corresponding syscall and libc implementation
Previously this function was only used for shared memory region created
by shm_open because I was lazy. Now exists for all files.
Diffstat (limited to 'userland/libc/unistd/ftruncate.c')
-rw-r--r-- | userland/libc/unistd/ftruncate.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/userland/libc/unistd/ftruncate.c b/userland/libc/unistd/ftruncate.c new file mode 100644 index 0000000..cf35944 --- /dev/null +++ b/userland/libc/unistd/ftruncate.c @@ -0,0 +1,6 @@ +#include <syscall.h> +#include <unistd.h> + +int ftruncate(int fildes, size_t length) { + RC_ERRNO(syscall(SYS_FTRUNCATE, fildes, length, 0, 0, 0)); +} |