1 .\" $NetBSD: msync.2,v 1.23 2005/10/18 03:18:16 chs Exp $
3 .\" Copyright (c) 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" @(#)msync.2 8.2 (Berkeley) 6/21/94
37 .Nd synchronize a mapped region
43 .Fn msync "void *addr" "size_t len" "int flags"
47 system call writes all pages with shared modifications
49 region of the process's address space back to permanent
50 storage, and, if requested, invalidates cached data mapped
54 is 0, all modified pages within the region containing
59 is non-zero, only modified pages containing
63 succeeding locations will be flushed.
64 Any required synchronization of memory caches
65 will also take place at this time.
66 Filesystem operations on a file that is mapped for shared modifications
67 are unpredictable except after an
76 .Bl -column -offset indent -compact MS_INVALIDATE
77 .It Dv MS_ASYNC Ta Perform asynchronous writes.
78 .It Dv MS_SYNC Ta Perform synchronous writes.
79 .It Dv MS_INVALIDATE Ta Invalidate cached data after writing.
82 Upon successful completion,
83 a value of 0 is returned.
84 Otherwise, a value of \-1 is returned and
86 is set to indicate the error.
88 The following errors may be reported:
93 flag was specified and a portion of the specified region
103 parameter was not page aligned.
107 parameter did not specify an address part of a mapped region.
111 parameter was negative.
113 An I/O error occurred while writing to the file system.
115 Addresses in the specified region are outside the range allowed
116 for the address space of the process, or specify one or more pages
126 function first appeared in
128 It was modified to conform to