From owner-man-jp-reviewer@jp.freebsd.org  Wed May 10 00:30:27 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id AAA72182;
	Wed, 10 May 2000 00:30:27 +0900 (JST)
	(envelope-from owner-man-jp-reviewer@jp.FreeBSD.org)
Received: from basil.veltec.co.jp (camomile.veltec.co.jp [211.2.223.5])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id AAA72172
	for <man-jp-reviewer@jp.freebsd.org>; Wed, 10 May 2000 00:30:22 +0900 (JST)
	(envelope-from yuko@veltec.co.jp)
Received: from jade ([192.168.0.66])
	by basil.veltec.co.jp (8.10.0.Beta6/3.7W03/20/00) with ESMTP
	id e49Fant14244
	for <man-jp-reviewer@jp.freebsd.org>; Wed, 10 May 2000 00:36:49 +0900 (JST)
To: man-jp-reviewer@jp.freebsd.org
X-SMIME-fingerprint: A7:AE:D4:83:9D:5B:A5:F2:24:8F:F4:DC:87:3C:72:89
From: Yuko Sasaki <yuko@veltec.co.jp>
Message-Id: <200005100031.JIC47175.VLPZ@veltec.co.jp>
X-Mailer: Winbiff [Version 2.31 beta1]
Date: Wed, 10 May 2000 00:31:21 +0900
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-2022-jp
Reply-To: man-jp-reviewer@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: man-jp-reviewer 2435
Subject: [man-jp-reviewer 2435] (man2) msync.2
Errors-To: owner-man-jp-reviewer@jp.freebsd.org
Sender: owner-man-jp-reviewer@jp.freebsd.org
X-Originator: yuko@veltec.co.jp

$B!V$G:G=i$K8=$l$^$7$?!#!W(B -> $B!V$G$O$8$a$FEP>l$7$^$7$?!#!W(B
$B!V=q$-9~$_!W(B -> $B!V=q9~$_!W(B
------- $B$3$3$+$i(B --------------------------------------------------
.\" Copyright (c) 1991, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"	@(#)msync.2	8.2 (Berkeley) 6/21/94
.\"
.Dd June 21, 1994
.Dt MSYNC 2
.Os
.Sh $BL>>N(B
.Nm msync
.Nd $B%^%C%W$5$l$?NN0h$rF14|2=$9$k(B
.Sh $B=q<0(B
.Fd #include <sys/types.h>
.Fd #include <sys/mman.h>
.Ft int
.Fn msync "void *addr" "size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EIO
$B%U%!%$%k%7%9%F%`$K=q9~$_$7$F$$$k4V$KF~=PNO%(%i!<$,5/$-$^$7$?!#(B
.Sh $B4XO"9`L\(B
.Xr madvise 2 ,
.Xr mincore 2 ,
.Xr mprotect 2 ,
.Xr munmap 2
.Sh $BNr;K(B
.Fn msync
$B4X?t$O(B
.Bx 4.4
$B$G$O$8$a$FEP>l$7$^$7$?!#(B
------- $B$3$3$^$G(B --------------------------------------------------

------- $B86J8!&$3$3$+$i(B --------------------------------------------------
.\" Copyright (c) 1991, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"	@(#)msync.2	8.2 (Berkeley) 6/21/94
.\"
.Dd June 21, 1994
.Dt MSYNC 2
.Os
.Sh NAME
.Nm msync
.Nd synchronize a mapped region
.Sh SYNOPSIS
.Fd #include <sys/types.h>
.Fd #include <sys/mman.h>
.Ft int
.Fn msync "void *addr" "size_t len" "int flags"
.Sh DESCRIPTION
The
.Fn msync
system call
writes any modified pages back to the filesystem and updates
the file modification time.
If
.Fa len
is 0, all modified pages within the region containing
.Fa addr
will be flushed;
if
.Fa len
is non-zero, only those pages containing 
.Fa addr
and
.Fa len-1
succeeding locations will be examined.
The
.Fa flags
argument may be specified as follows:
.Bd -literal
MS_ASYNC	Return immediately (not currently implemented)
MS_SYNC		Perform synchronous writes
MS_INVALIDATE	Invalidate all cached data
.Ed
.Sh RETURN VALUES
If any errors occur, -1 is returned and errno is set to indicate the
error. Otherwise, a 0 value is returned.
.Sh ERRORS
.Fn msync
will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
.Fa addr
is not a multiple of the hardware page size.
.It Bq Er EINVAL
.Fa len
is too large or negative.
.It Bq Er EINVAL
.Fa flags
was both MS_ASYNC and MS_INVALIDATE. Only one of these flags is allowed.
.It Bq Er EIO
An I/O error occurred while writing to the file system.
.Sh SEE ALSO
.Xr madvise 2 ,
.Xr mincore 2 ,
.Xr mprotect 2 ,
.Xr munmap 2
.Sh HISTORY
The
.Fn msync
function first appeared in
.Bx 4.4 .
------- $B86J8!&$3$3$^$G(B --------------------------------------------------
