mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
LibC: Implement posix_fadvise() (as a harmless no-op)
This commit is contained in:
parent
910532b8dc
commit
a7f702a021
2 changed files with 18 additions and 1 deletions
|
@ -87,4 +87,19 @@ int openat(int dirfd, char const* path, int options, ...)
|
||||||
int rc = syscall(SC_open, ¶ms);
|
int rc = syscall(SC_open, ¶ms);
|
||||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_fadvise.html
|
||||||
|
int posix_fadvise(int fd, off_t offset, off_t len, int advice)
|
||||||
|
{
|
||||||
|
// Per POSIX:
|
||||||
|
// "The posix_fadvise() function shall have no effect on the semantics of other operations on the specified data,
|
||||||
|
// although it may affect the performance of other operations."
|
||||||
|
|
||||||
|
// For now, we simply ignore posix_fadvise() requests. In the future we may use them to optimize performance.
|
||||||
|
(void)fd;
|
||||||
|
(void)offset;
|
||||||
|
(void)len;
|
||||||
|
(void)advice;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2021, sin-ack <sin-ack@protonmail.com>
|
* Copyright (c) 2021, sin-ack <sin-ack@protonmail.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
@ -20,4 +20,6 @@ int create_inode_watcher(unsigned flags);
|
||||||
int inode_watcher_add_watch(int fd, char const* path, size_t path_length, unsigned event_mask);
|
int inode_watcher_add_watch(int fd, char const* path, size_t path_length, unsigned event_mask);
|
||||||
int inode_watcher_remove_watch(int fd, int wd);
|
int inode_watcher_remove_watch(int fd, int wd);
|
||||||
|
|
||||||
|
int posix_fadvise(int fd, off_t offset, off_t len, int advice);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue