msync man page on BSDi

Man page or keyword search:  
man Server   6284 pages
apropos Keyword Search (all sections)
Output format
BSDi logo
[printable version]

MSYNC(2)		    BSD Programmer's Manual		      MSYNC(2)

NAME
     msync - synchronize a mapped region

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

     int
     msync(void *addr, int len, int flags);

DESCRIPTION
     The msync() system call writes any modified pages back to the filesystem
     and updates the file modification time.  If len is 0, all modified pages
     within the region containing addr will be flushed; if len is non-zero,
     only the pages containing addr and len succeeding locations will be exam-
     ined.  Any required synchronization of memory caches will also take place
     at this time.

     The flags parameter consists of a type and additional flag bits.  The
     type is mandatory and must be either MS_ASYNC or MS_SYNC, for asyn-
     chronous or synchronous flushing, respectively.  There is currently just
     one flag:

     MS_INVALIDATE    Invalidate pages after flushing.

RETURN VALUES
     Upon successful completion, msync() will return 0; otherwise a value of
     -1 is returned and errno is set to indicate the error.

ERRORS
     The following errors may be reported:

     [EINVAL]	   The addr parameter was not page aligned.

     [EINVAL]	   The addr parameter did not specify an address part of a
		   mapped region.

     [EINVAL]	   The len parameter was negative.

     [EIO]	   An I/O error occured while writing to the file system.

SEE ALSO
     madvise(2),  munmap(2),  mprotect(2),  mincore(2)

HISTORY
     The msync() function first appeared in 4.4BSD.

BUGS
     This interface is not compatible with the traditional BSD interface.  The
     flags parameter is currently ignored, so two-parameter calls to msync()
     are safe, but this will change in future releases.

     The msync() function exposes some of the system's caching policy.	If you
     map a file for shared updates, running msync() to update a region of the
     file will have the same caching behavior as using write() with the same
     data to update that region of the file.  If you don't use msync() to up-
     date a mapped file, then any changes may be cached until a read() or
     write() operation on that region of the file forces synchronization.
     This may occur long after the process that mapped the file has closed the
     file descriptor, or for that matter, long after it has exited.

     Note that msync() does not commit the data to disk.  Use fsync(2) to en-
     sure that data gets written out.

[top]

List of man pages available for BSDi

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net