Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Apropos / Subsearch:
optional field

MSYNC(3)                   Library Functions Manual                   MSYNC(3)

       msync - synchronize memory with physical storage

       #include <&lt;sys/types.h>&gt;
       #include <&lt;sys/mman.h>&gt;

       int msync(addr, len, flags)
       caddr_t addr; size_t len; int flags;

       msync()  writes all modified copies of pages over the range [addr, addr
       + len) to their permanent storage locations.  msync() optionally inval-
       idates  any  copies  so  that  further  references to the pages will be
       obtained by the system from their permanent storage locations.

       Values for flags are defined in <&lt;sys/mman.h>&gt; as:

       #define MS_ASYNC         0x1       /* Return immediately */
       #define MS_INVALIDATE    0x2       /* Invalidate mappings */

       and are used to control the behavior of msync().  One or more flags may
       be specified in a single call.

       MS_ASYNC  returns  immediately  once  all I/O operations are scheduled;
       normally, msync() will not return until all  I/O  operations  are  com-
       plete.  MS_INVALIDATE invalidates all cached copies of data from memory
       objects, requiring them to be re-obtained from the  object's  permanent
       storage location upon the next reference.

       msync()  should  be used by programs that require a memory object to be
       in a known state, for example in building transaction facilities.

       msync() returns:

       0      on success.

       -1     on failure and sets errno to indicate the error.

       EINVAL         addr is not a multiple of the  page size as returned  by

                      flags  is not some combination of MS_ASYNC or MS_INVALI-

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

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

       EPERM          MS_INVALIDATE was specified and one or more of the pages
                      is locked in memory.

       mctl(2), mmap(2)

                                21 January 1990                       MSYNC(3)