From owner-man-jp-reviewer@jp.freebsd.org  Wed May 10 00:28:21 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id AAA71825;
	Wed, 10 May 2000 00:28:21 +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 AAA71814
	for <man-jp-reviewer@jp.freebsd.org>; Wed, 10 May 2000 00:28:17 +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 e49FYht14229
	for <man-jp-reviewer@jp.freebsd.org>; Wed, 10 May 2000 00:34:43 +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: <200005100029.IHI45513.VPZL@veltec.co.jp>
X-Mailer: Winbiff [Version 2.31 beta1]
Date: Wed, 10 May 2000 00:29:15 +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 2434
Subject: [man-jp-reviewer 2434] (man2) mprotect.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$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.
.\"
.\"	@(#)mprotect.2	8.1 (Berkeley) 6/9/93
.\"
.Dd June 9, 1993
.Dt MPROTECT 2
.Os
.Sh $BL>>N(B
.Nm mprotect
.Nd $B%Z!<%8$NJ]8n$r@)8f$9$k(B
.Sh $B=q<0(B
.Fd #include <sys/types.h>
.Fd #include <sys/mman.h>
.Ft int
.Fn mprotect "const void *addr" "size_t len" "int prot"
.Sh $B2r@b(B
.Fn mprotect
$B%7%9%F%`%3!<%k$O!";XDj$N%Z!<%8$,J]8n(B
.Fa prot
$B$r;}$D$h$&$KJQ99$7$^$9!#$9$Y$F$N%7%9%F%`$,(B
$B%Z!<%8%Y!<%9$GJ]8n$rJ]>Z$9$k$o$1$G$O$"$j$^$;$s!#(B
$BJ]8nJQ99$N:Y$+$5$ONN0hA4BN$HF1$8Bg$-$5$K$G$-$^$9!#(B
.Sh $BLa$jCM(B
$B@5>o$K40N;$9$k$H!"(B
.Fn mprotect
$B$O(B 0 $B$rJV$7$^$9!#$=$&$G$J$$>l9g$O!"CM(B -1 $B$,JV$5$l!"(B
$B%(%i!<$r<($9$?$a$K(B
.Va errno
$B$,@_Dj$5$l$^$9!#(B
.Sh $B%(%i!<(B
.Fn mprotect
$B4X?t$O<!$N>l9g$K<:GT$7$^$9!#(B
.Bl -tag -width Er
.It Bq Er EINVAL
.Fa addr
$B0z?t$H(B
.Fa len
$B0z?t$,;XDj$9$k2>A[%"%I%l%9HO0O$OM-8z$G$O$"$j$^$;$s!#(B
.It Bq Er EACCES
$B8F$S=P$7%W%m%;%9$O!"(B
.Fa prot
$B0z?t$K$h$C$F;XDj$5$l$kCM$KJ]8n$rJQ99$G$-$^$;$s!#(B
.El
.Sh $B4XO"9`L\(B
.Xr madvise 2 ,
.Xr mincore 2 ,
.Xr msync 2 ,
.Xr munmap 2
.Sh $BNr;K(B
.Fn mprotect
$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.
.\"
.\"	@(#)mprotect.2	8.1 (Berkeley) 6/9/93
.\"
.Dd June 9, 1993
.Dt MPROTECT 2
.Os
.Sh NAME
.Nm mprotect
.Nd control the protection of pages
.Sh SYNOPSIS
.Fd #include <sys/types.h>
.Fd #include <sys/mman.h>
.Ft int
.Fn mprotect "const void *addr" "size_t len" "int prot"
.Sh DESCRIPTION
The
.Fn mprotect
system call
changes the specified pages to have protection
.Fa prot .
Not all implementations will guarantee protection on a page basis;
the granularity of protection changes may be as large as an entire region.
.Sh RETURN VALUES
Upon successful completion, 
.Fn mprotect
returns 0.  Otherwise a value of -1 is returned
and
.Va errno
is set to indicate the error.
.Sh ERRORS
The
.Fn mprotect
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The virtual address range specified by the
.Fa addr
and
.Fa len
arguments is not valid.
.It Bq Er EACCES
The calling process was not allowed to change
the protection to the value specified by
the
.Fa prot
argument.
.El
.Sh SEE ALSO
.Xr madvise 2 ,
.Xr mincore 2 ,
.Xr msync 2 ,
.Xr munmap 2
.Sh HISTORY
The
.Fn mprotect
function first appeared in
.Bx 4.4 .
------- $B86J8!&$3$3$^$G(B --------------------------------------------------
