mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
LibCore: Add wrapper for fsync()
This commit is contained in:
parent
d6732e5906
commit
892da127d0
Notes:
sideshowbarker
2024-07-17 02:59:43 +09:00
Author: https://github.com/romch007 Commit: https://github.com/SerenityOS/serenity/commit/892da127d0 Pull-request: https://github.com/SerenityOS/serenity/pull/23700 Reviewed-by: https://github.com/FireFox317 Reviewed-by: https://github.com/gmta
2 changed files with 8 additions and 0 deletions
|
@ -598,6 +598,13 @@ ErrorOr<void> ftruncate(int fd, off_t length)
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> fsync(int fd)
|
||||
{
|
||||
if (::fsync(fd) < 0)
|
||||
return Error::from_syscall("fsync"sv, -errno);
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<struct stat> stat(StringView path)
|
||||
{
|
||||
if (!path.characters_without_null_termination())
|
||||
|
|
|
@ -127,6 +127,7 @@ ErrorOr<int> open(StringView path, int options, mode_t mode = 0);
|
|||
ErrorOr<int> openat(int fd, StringView path, int options, mode_t mode = 0);
|
||||
ErrorOr<void> close(int fd);
|
||||
ErrorOr<void> ftruncate(int fd, off_t length);
|
||||
ErrorOr<void> fsync(int fd);
|
||||
ErrorOr<struct stat> stat(StringView path);
|
||||
ErrorOr<struct stat> lstat(StringView path);
|
||||
ErrorOr<ssize_t> read(int fd, Bytes buffer);
|
||||
|
|
Loading…
Reference in a new issue