int posix_madvise(void *addr, size_t len, int advice);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
_POSIX_C_SOURCE >= 200112L
- The application has no special advice regarding its memory usage patterns for the specified address range. This is the default behavior.
- The application expects to access the specified address range sequentially, running from lower addresses to higher addresses. Hence, pages in this region can be aggressively read ahead, and may be freed soon after they are accessed.
- The application expects to access the specified address range randomly. Thus, read ahead may be less useful than normally.
- The application expects to access the specified address range in the near future. Thus, read ahead may be beneficial.
- The application expects that it will not access the specified address range in the near future.
- addr is not a multiple of the system page size or len is negative.
- advice is invalid.
- Addresses in the specified range are partially or completely outside the caller's address space.