LibC: Add support for posix_madvise(..)

Add the `posix_madvise(..)` LibC implementation that just forwards
to the normal `madvise(..)` implementation.

Also define a few POSIX_MADV_DONTNEED and POSIX_MADV_NORMAL as they
are part of the POSIX API for `posix_madvise(..)`.

This is needed by the `fio` port.
This commit is contained in:
Brian Gianforcaro 2021-12-22 00:05:10 -08:00 committed by Brian Gianforcaro
commit c724955d54
Notes: sideshowbarker 2024-07-17 22:21:40 +09:00
3 changed files with 17 additions and 0 deletions

View file

@ -31,10 +31,20 @@ extern "C" {
#define MAP_FAILED ((void*)-1)
#define MADV_NORMAL 0x0
#define MADV_SET_VOLATILE 0x1
#define MADV_SET_NONVOLATILE 0x2
#define MADV_DONTNEED 0x3
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_madvise.html
#define POSIX_MADV_NORMAL MADV_NORMAL
#define POSIX_MADV_DONTNEED MADV_DONTNEED
// Unsupported posix_madvise() advise:
// POSIX_MADV_SEQUENTIAL
// POSIX_MADV_RANDOM
// POSIX_MADV_WILLNEED
#define MS_SYNC 1
#define MS_ASYNC 2
#define MS_INVALIDATE 4