mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
LibCore: Add syscall wrapper for ftruncate()
This commit is contained in:
parent
4bf08e4d52
commit
4a213869f2
2 changed files with 8 additions and 0 deletions
|
@ -123,4 +123,11 @@ ErrorOr<void> close(int fd)
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> ftruncate(int fd, off_t length)
|
||||
{
|
||||
if (::ftruncate(fd, length) < 0)
|
||||
return Error::from_syscall("ftruncate"sv, -errno);
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,5 +24,6 @@ ErrorOr<void*> mmap(void* address, size_t, int protection, int flags, int fd, of
|
|||
ErrorOr<void> munmap(void* address, size_t);
|
||||
ErrorOr<int> open(StringView path, int options, ...);
|
||||
ErrorOr<void> close(int fd);
|
||||
ErrorOr<void> ftruncate(int fd, off_t length);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue