Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mmap(2)

mprotect(2)

mset(2)

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 permits a process to advise the system about its expected future
     behavior in referencing a mapped file or shared memory region.  The addr
     argument specifies the address of the region to which the advice refers.
     The len argument specifies the length in bytes of the region specified by
     the addr parameter. The region described by addr and len must reside
     within a mapping established earlier via a call to mmap.

     With the exception of the MADV_SPACEAVAIL option, the specified region is
     expanded to cover an integral number of system segments.  That is, the
     segment containing addr, the segment containing addr+len-1, and any
     intervening segments are processed.

     The segment size is as follows:  32K for Apollo M68K (M68010, M68020,
     M68030) workstations, 512K for Apollo M88K (AT) workstations, and 256K
     for Apollo M68K (M68040) workstations.

     The behav argument describes expected behavior.  <sys/mman.h> defines the
     following behaviors:

     #define  MADV_NORMAL      0     /* no further special treatment */
     #define  MADV_RANDOM      1     /* expect random segment references */
     #define  MADV_SEQUENTIAL  2     /* expect sequential references */
     #define  MADV_WILLNEED    3     /* will need these segments */
     #define  MADV_DONTNEED    4     /* don't need these segments */
     #define  MADV_SPACEAVAIL  5     /* insure that resources are reserved */

     The MADV_SPACEAVAIL option is ignored when applied to an anonymous VM
     mapping (MAP_ANON).

     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 behavior.  The DONTNEED behavior is
     implemented at sr10.4.

     mincore always returns 1 for all segments 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.

     In Domain/OS, the unit of mapping and protection is the segment.

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.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026