Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ msync(3C) — DG/UX R4.11MU05

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

memcntl(2)

mmap(2)

sysconf(2)

reentrant(3)



msync(3C)                      DG/UX R4.11MU05                     msync(3C)


NAME
       msync - synchronize memory with physical storage

SYNOPSIS
       #include <sys/types.h>
       #include <sys/mman.h>
       int msync(void * addr, sizet len, int flags);

DESCRIPTION
       The function msync writes all modified copies of pages over the range
       [addr, addr + len) to their backing storage locations.  msync
       optionally invalidates any copies so that further references to the
       pages will be obtained by the system from their backing storage
       locations.  The backing storage for a modified MAPSHARED mapping is
       the file the page is mapped to; the backing storage for a modified
       MAPPRIVATE mapping is its swap area.

       flags is a bit pattern built from the following values:
                  MSASYNC        perform asynchronous writes
                  MSSYNC         perform synchronous writes
                  MSINVALIDATE   invalidate mappings

       If MSASYNC is set, msync returns immediately once all write
       operations are scheduled; if MSSYNC is set, msync does not return
       until all write operations are completed.

       MSINVALIDATE invalidates all cached copies of data in memory, so
       that further references to the pages will be obtained by the system
       from their backing storage locations.

       The effect of msync(addr, len, flags) is equivalent to:

              memcntl(addr, len, MCSYNC, flags, 0, 0)


   Considerations for Threads Programming
                     +---------+-----------------------------+
                     |         |                      async- |
                     |function | reentrant   cancel   cancel |
                     |         |             point     safe  |
                     +---------+-----------------------------+
                     |msync    |     Y         Y        N    |
                     +---------+-----------------------------+

SEE ALSO
       memcntl(2), mmap(2), sysconf(2), reentrant(3).

RETURN VALUE
       Upon successful completion, the function msync returns 0; otherwise,
       it returns -1 and sets errno to indicate the error.

DIAGNOSTICS
       Under the following conditions, the msync fails and sets errno to:

       EINVAL         if the addr parameter is not a page aligned address.

       ENOMEM         if the len parameter is 0.

       ENOMEM         if an address in the target region is not mapped in
                      the caller's address space.

       EBUSY          if the MSINVALIDATE flag is set and one or more pages
                      in the target region is locked.

       EIO            if an I/O error occurred in writing a page.

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


Licensed material--property of copyright holder(s)

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