posix_madvise()
QNX SDP8.0C Library ReferenceAPIDeveloper
Provide advisory information about the expected use of memory
Synopsis:
#include <sys/mman.h>
int posix_madvise( void *addr,
size_t len,
int advice );
Arguments:
- addr
- The address of the data the application is providing advice about.
- len
- The length of the data, in bytes.
- advice
- The advice to be applied to the memory range; one of the following:
- POSIX_MADV_DISCARD_NP (QNX OS extension) —
discard the backing store for lazy private mappings (similar to
madvise(MADV_DONTNEED)
in Linux). TheNP
in the flag name stands fornon-POSIX.
- POSIX_MADV_DONTNEED — the application expects that it won't access the data in the near future.
- POSIX_MADV_NORMAL — the application has no advice to give on its behavior with respect to the specified range. This is the default characteristic if no advice is given for a range of memory.
- POSIX_MADV_RANDOM — the application expects to access the data in a random order.
- POSIX_MADV_SEQUENTIAL — the application expects to access the data sequentially from lower addresses to higher addresses.
- POSIX_MADV_WILLNEED — the application expects to access the data in the near future.
- POSIX_MADV_DISCARD_NP (QNX OS extension) —
discard the backing store for lazy private mappings (similar to
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The posix_madvise() function advises the memory manager how the application expects to use the data in the memory starting at address addr, and continuing for len bytes. The memory manager may use this information to optimize handling of the data.
Returns:
- EOK
- Success.
- EINVAL
- The value of advice is invalid or len equals zero.
- ENOMEM
- Addresses in the specified range are partly or completely outside the range allowed for the address space of the calling process.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Yes |
Thread | Yes |
Page updated: