Advises the system of expected paging behavior.
#include <sys/types.h> #include <sys/mman.h>
int madvise(addr, len, behav) caddr_t addr; size_t len; int behav;
The madvise subroutine permits a process to advise the system about its expected future behavior in referencing a mapped file region or anonymous memory region.
addr | Specifies the starting address of the memory region. Must be a multiple of the page size returned by the sysconf subroutine using the _SC_PAGE_SIZE value for the Name parameter. |
len | Specifies the length, in bytes, of the memory region. If the len value is not a multiple of page size as returned by the sysconf subroutine using the _SC_PAGE_SIZE value for the Name parameter, the length of the region will be rounded up to the next multiple of the page size. |
behav | Specifies the future behavior of the memory region. The following values for the behav parameter are defined in the /usr/include/sys/mman.h file:
|
When successful, the madvise subroutine returns 0. Otherwise, it returns -1 and sets the errno global variable to indicate the error.
If the madvise subroutine is unsuccessful, the errno global variable can be set to one of the following values:
EINVAL | The behav parameter is invalid. |
ENOSPC | The behav parameter specifies MADV_SPACEAVAIL and resources cannot be reserved. |
The madvise subroutine has no functionality and is supported for compatibility only. It is part of Base Operating System (BOS) Runtime.
The mmap subroutine, sysconf subroutine.
List of Memory Manipulation Services and Understanding Paging Space Programming Requirements in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.