96 lines
3.2 KiB
Groff
96 lines
3.2 KiB
Groff
.\" 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
|
|
.\" %FreeBSD: src/lib/libc/sys/mprotect.2,v 1.17 2003/02/23 01:47:48 ru Exp %
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.Dd June 9, 1993
|
|
.Dt MPROTECT 2
|
|
.Os
|
|
.Sh ̾¾Î
|
|
.Nm mprotect
|
|
.Nd ¥Ú¡¼¥¸¤ÎÊݸî°À¤òÀ©¸æ¤¹¤ë
|
|
.Sh ¥é¥¤¥Ö¥é¥ê
|
|
.Lb libc
|
|
.Sh ½ñ¼°
|
|
.In sys/mman.h
|
|
.Ft int
|
|
.Fn mprotect "const void *addr" "size_t len" "int prot"
|
|
.Sh ²òÀâ
|
|
.Fn mprotect
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï»ØÄê¤Î¥Ú¡¼¥¸¤¬Êݸî°À
|
|
.Fa prot
|
|
¤ò»ý¤Ä¤è¤¦¤ËÊѹ¹¤·¤Þ¤¹¡£
|
|
¤¹¤Ù¤Æ¤Î¾ì¹ç¤Ë¤ª¤¤¤Æ¥Ú¡¼¥¸Ã±°Ì¤Ç¤ÎÊݸî°À¤òÊݾڤ¹¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
|
|
Êݸî°ÀÊѹ¹¤ÎºÙ¤«¤µ¤Ï¥ê¡¼¥¸¥ç¥óÁ´ÂÎ¤ÈÆ±¤¸Â礤µ¤«¤â¤·¤ì¤Þ¤»¤ó¡£
|
|
¥ê¡¼¥¸¥ç¥ó¤Ï
|
|
.Vt "struct vm_map_entry"
|
|
¤Î start (³«»Ï) ¤È end (½ªÎ») ¤Î¥¢¥É¥ì¥¹¤ÇÄêµÁ¤µ¤ì¤ë²¾ÁÛ¥¢¥É¥ì¥¹¶õ´Ö¤Ç¤¹¡£
|
|
.Pp
|
|
¸½ºß¡¢°Ê²¼¤Î OR ¤ò¤È¤Ã¤ÆÁȤ߹ç¤ï¤»¤ë¤³¤È¤¬²Äǽ¤ÊÊݸî¥Ó¥Ã¥È¤¬ÃΤé¤ì¤Æ¤¤¤Þ¤¹¡£
|
|
.Pp
|
|
.Bl -tag -width ".Dv PROT_WRITE" -compact
|
|
.It Dv PROT_NONE
|
|
Á´¤¯Êݸ¤Þ¤»¤ó¡£
|
|
.It Dv PROT_READ
|
|
¥Ú¡¼¥¸¤ÏÆÉ¼è¤ê²Äǽ¤Ç¤¹¡£
|
|
.It Dv PROT_WRITE
|
|
¥Ú¡¼¥¸¤Ï½ñ¹þ¤ß²Äǽ¤Ç¤¹¡£
|
|
.It Dv PROT_EXEC
|
|
¥Ú¡¼¥¸¤Ï¼Â¹Ô²Äǽ¤Ç¤¹¡£
|
|
.El
|
|
.Sh Ìá¤êÃÍ
|
|
.Rv -std mprotect
|
|
.Sh ¥¨¥é¡¼
|
|
.Fn mprotect
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¼¡¤Î¾ì¹ç¤Ë½èÍý¤ò¼ºÇÔ¤·¤Þ¤¹:
|
|
.Bl -tag -width Er
|
|
.It Bq Er EINVAL
|
|
.Fa addr
|
|
°ú¿ô¤È
|
|
.Fa len
|
|
°ú¿ô¤Ç»ØÄꤷ¤Æ¤¤¤ë²¾ÁÛ¥¢¥É¥ì¥¹ÈϰϤÏ͸ú¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
|
|
.It Bq Er EACCES
|
|
¸Æ¤Ó½Ð¤·¥×¥í¥»¥¹¤Ï
|
|
.Fa prot
|
|
°ú¿ô¤Ë¤è¤Ã¤Æ»ØÄꤵ¤ì¤ëÃͤËÊݸî°À¤òÊѹ¹¤¹¤ë¤³¤È¤òµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£
|
|
.El
|
|
.Sh ´ØÏ¢¹àÌÜ
|
|
.Xr madvise 2 ,
|
|
.Xr mincore 2 ,
|
|
.Xr msync 2 ,
|
|
.Xr munmap 2
|
|
.Sh Îò»Ë
|
|
.Fn mprotect
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï
|
|
.Bx 4.4
|
|
¤Ç¤Ï¤¸¤á¤ÆÅо줷¤Þ¤·¤¿¡£
|