Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mctl(3) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mmap(2)

getpagesize(3)

mlock(3C)

mlockall(3C)

msync(3C)

mctl(3)                 (BSD Compatibility Package)                 mctl(3)

NAME
     mctl - memory management control

SYNOPSIS
     /usr/ucb/cc [flag ...] file ... -lucb

     #include <sys/types.h>
     #include <sys/mman.h>

     mctl(caddrt addr, sizet len, int function, void *arg);

DESCRIPTION
     mctl applies a variety of control functions over pages identified by
     the mappings established for the address range [addr, addr + len). The
     function to be performed is identified by the argument function. Valid
     functions are defined in mman.h as follows.

     MCLOCK
          Lock the pages in the range in memory. This function is used to
          support mlock. See mlock(3C) for semantics and usage. arg is
          ignored.

     MCLOCKAS
          Lock the pages in the address space in memory. This function is
          used to support mlockall. See mlockall(3C) for semantics and
          usage. addr and len are ignored. arg is an integer built from the
          flags:

          MCLCURRENT       Lock current mappings
          MCLFUTURE        Lock future mappings

     MCSYNC
          Synchronize the pages in the range with their backing storage.
          Optionally invalidate cache copies. This function is used to sup-
          port msync. See msync(3C) for semantics and usage. arg is used to
          represent the flags argument to msync. It is constructed from an
          OR of the following values:

          MSSYNC           Synchronized write
          MSASYNC          Return immediately
          MSINVALIDATE     Invalidate mappings

          MSASYNC returns after all I/O operations are scheduled. MSSYNC
          does not return until all I/O operations are complete. Specify
          exactly one of MSASYNC or MSSYNC. MSINVALIDATE invalidates all
          cached copies of data from memory, requiring them to be re-
          obtained from the object's permanent storage location upon the
          next reference.







Page 1                       Reliant UNIX 5.44                Printed 11/98

mctl(3)                 (BSD Compatibility Package)                 mctl(3)

     MCUNLOCK
          Unlock the pages in the range. This function is used to support
          munlock. See munlock [mlock(3C)] for semantics and usage. arg is
          ignored.

     MCUNLOCKAS
          Remove address space memory lock, and locks on all current map-
          pings. This function is used to support munlockall. addr and len
          must have the value 0. arg is ignored.

RETURN VALUE
     mctl returns 0 on success, -1 on failure.

DIAGNOSTICS
     mctl fails if:

     EAGAIN   Some or all of the memory identified by the operation could
              not be locked due to insufficient system resources.

     EBUSY    MSINVALIDATE was specified and one or more of the pages is
              locked in memory.

     EINVAL   addr is not a multiple of the page size as returned by get-
              pagesize.

     EINVAL   addr and/or len do not have the value 0 when MCLOCKAS or
              MCUNLOCKAS are specified.

     EINVAL   arg is not valid for the function specified.

     EIO      An I/O error occurred while reading from or writing to the
              file system.

     ENOMEM   Addresses in the range [addr, addr + len) are invalid for the
              address space of a process, or specify one or more pages
              which are not mapped.

     EPERM    The process' effective user ID is not super-user and one of
              MCLOCK, MCLOCKAS, MCUNLOCK, or MCUNLOCKAS was specified.

SEE ALSO
     mmap(2), getpagesize(3), mlock(3C), mlockall(3C), msync(3C).












Page 2                       Reliant UNIX 5.44                Printed 11/98

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