MADVISE(2) Domain/OS BSD MADVISE(2)
NAME
madvise, mincore - advise the system of a process' expected paging
behavior
SYNOPSIS
#include <sys/mman.h>
madvise(addr, len, behav)
caddr_t addr;
int len, behav;
mincore(addr, len, vec)
caddr_t addr;
int len;
char *vec;
DESCRIPTION
madvise advises the kernel what to expect regarding a process' paging
behavior, where addr is starting address of the region for which advice
is given, len is the length of the region, and behav describes expected
behavior. <sys/mman.h> defines the following behaviors:
#define MADV_NORMAL 0 /* no further special treatment */
#define MADV_RANDOM 1 /* expect random page references */
#define MADV_SEQUENTIAL 2 /* expect sequential references */
#define MADV_WILLNEED 3 /* will need these pages */
#define MADV_DONTNEED 4 /* don't need these pages */
#define MADV_SPACEAVAIL 5 /* insure that resources are reserved */
mincore returns 1 in vec if the region starting at address addr with
length len is core-resident.
NOTES
Domain/OS BSD ignores the WILLNEED and DONTNEED behaviors. mincore
always returns 1 for all pages in the region.
This implementation is based upon a proposal by McKusick and Karels, and
upon other sources. Its details may change in a future release.
SEE ALSO
McKusick, M.K. and Karels, M.J. A New Virtual Memory Implementation for
Berkeley UNIX. Berkeley, California: Department of Electrical
Engineering and Computer Science, University of California, 1986.
mmap(2), mprotect(2), mset(2).
DIAGNOSTICS
madvise and mincore return 0 if successful. Otherwise, they return -1.
ERRORS
madvise will fail if either of the following is true:
[EINVAL] An unknown behavior was specified.
[ENOENT] No region is mapped at the specified address.