madvise Subroutine
Purpose
Advises the system of expected paging behavior.
Library
Standard C Library (libc.a).
Syntax
Description
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.
The madvise subroutine has no functionality and is supported for compatibility only.
Parameters
Item | Description |
---|---|
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:
|
Return Values
When successful, the madvise subroutine returns 0. Otherwise, it returns -1 and sets the errno global variable to indicate the error.
Error Codes
If the madvise subroutine is unsuccessful, the errno global variable can be set to one of the following values:
Item | Description |
---|---|
EINVAL | The behav parameter is invalid. |
ENOSPC | C:\A Workspace\71S\src\idd\en_US\basetrf1The behav parameter specifies MADV_SPACEAVAIL and resources cannot be reserved. |