OSDN Git Service

(split) LDP: Update draft pages
[linuxjm/LDP_man-pages.git] / draft / man2 / mlock.2
index e8823e8..662fdc3 100644 (file)
@@ -1,9 +1,8 @@
-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
 .\" Copyright (C) Michael Kerrisk, 2004
 .\"    using some material drawn from earlier man pages
 .\"    written by Thomas Kuhn, Copyright 1996
 .\"
+.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
 .\" This is free documentation; you can redistribute it and/or
 .\" modify it under the terms of the GNU General Public License as
 .\" published by the Free Software Foundation; either version 2 of
 .\" GNU General Public License for more details.
 .\"
 .\" You should have received a copy of the GNU General Public
-.\" License along with this manual; if not, write to the Free
-.\" Software Foundation, Inc., 59 Temple Place, Suite 330,
-.\" Boston, MA 02111, USA.
+.\" License along with this manual; if not, see
+.\" <http://www.gnu.org/licenses/>.
+.\" %%%LICENSE_END
 .\"
-.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
-.\"         all rights reserved.
-.\" Translated 1997-02-23, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
-.\" Updated 2003-10-12, Kentaro Shirakata <argrath@ub32.org>
-.\" Updated 2004-05-23, kentaro Shirakata <argrath@ub32.org>
-.\" Updated 2005-03-29, kentaro Shirakata <argrath@ub32.org>
-.\" Updated 2005-11-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated 2006-02-14, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated 2008-11-10, Akihiro MOTOKI, LDP v3.13
+.\"*******************************************************************
 .\"
-.\"WORD:       unlock                  ¥í¥Ã¥¯²ò½ü
-.\"WORD:       previlege               Æø¢
+.\" This file was generated with po4a. Translate the source file.
 .\"
-.TH MLOCK 2 2008-09-25 "Linux" "Linux Programmer's Manual"
-.\"O .SH NAME
-.\"O mlock, munlock, mlockall, munlockall \- lock and unlock memory
-.SH Ì¾Á°
-mlock \- ¥á¥â¥ê¤Î¥í¥Ã¥¯¤È¥í¥Ã¥¯²ò½ü¤ò¹Ô¤¦
-.\"O .SH SYNOPSIS
-.SH ½ñ¼°
+.\"*******************************************************************
+.TH MLOCK 2 2011\-09\-14 Linux "Linux Programmer's Manual"
+.SH 名前
+mlock \- メモリのロックとロック解除を行う
+.SH 書式
 .nf
-.B #include <sys/mman.h>
+\fB#include <sys/mman.h>\fP
 .sp
-.BI "int mlock(const void *" addr ", size_t " len );
-.BI "int munlock(const void *" addr ", size_t " len );
+\fBint mlock(const void *\fP\fIaddr\fP\fB, size_t \fP\fIlen\fP\fB);\fP
+\fBint munlock(const void *\fP\fIaddr\fP\fB, size_t \fP\fIlen\fP\fB);\fP
 .sp
-.BI "int mlockall(int " flags );
-.B int munlockall(void);
+\fBint mlockall(int \fP\fIflags\fP\fB);\fP
+\fBint munlockall(void);\fP
 .fi
-.\"O .SH DESCRIPTION
-.SH ÀâÌÀ
-.\"O .BR mlock ()
-.\"O and
-.\"O .BR mlockall ()
-.\"O respectively lock part or all of the calling process's virtual address
-.\"O space into RAM, preventing that memory from being paged to the
-.\"O swap area.
-.\"O .BR munlock ()
-.\"O and
-.\"O .BR munlockall ()
-.\"O perform the converse operation,
-.\"O respectively unlocking part or all of the calling process's virtual
-.\"O address space, so that pages in the specified virtual address range may
-.\"O once more to be swapped out if required by the kernel memory manager.
-.\"O Memory locking and unlocking are performed in units of whole pages.
-.BR mlock ()
-¤È
-.BR mlockall ()
-¤Ï¤½¤ì¤¾¤ì¡¢¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î²¾ÁÛ¥¢¥É¥ì¥¹¶õ´Ö¤Î°ìÉô¤Þ¤¿¤ÏÁ´Éô¤ò
-RAM ¾å¤Ë¥í¥Ã¥¯¤·¡¢¥á¥â¥ê¤¬¥¹¥ï¥Ã¥×¥¨¥ê¥¢¤Ë¥Ú¡¼¥¸¥ó¥°¤µ¤ì¤ë¤Î¤òËɤ°¡£
-.BR munlock ()
-¤È
-.BR munlockall ()
-¤ÏµÕ¤ÎÁàºî¤Ç¡¢¤½¤ì¤¾¤ì¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î²¾ÁÛ¥¢¥É¥ì¥¹¶õ´Ö¤Î°ìÉô¤Þ¤¿¤ÏÁ´Éô¤ò
-¥í¥Ã¥¯²ò½ü¤¹¤ë¡£¤Ä¤Þ¤ê¡¢»ØÄꤵ¤ì¤¿²¾ÁÛ¥¢¥É¥ì¥¹ÈϰϤΥڡ¼¥¸¤Ï
-¥«¡¼¥Í¥ë¥á¥â¥ê¥Þ¥Í¡¼¥¸¥ã¡¼¤«¤éÍ׵ᤵ¤ì¤ì¤Ð¥¹¥ï¥Ã¥×¥¢¥¦¥È¤¹¤ë¤è¤¦¤Ë¤Ê¤ë¡£
-¥á¥â¥ê¤Î¥í¥Ã¥¯¤È¥í¥Ã¥¯²ò½ü¤Ï¥Ú¡¼¥¸Ã±°Ì¤Ç¹Ô¤ï¤ì¤ë¡£
-.\"O .SS "mlock() and munlock()"
-.SS "mlock() ¤È munlock()"
-.\"O .BR mlock ()
-.\"O locks pages in the address range starting at
-.\"O .I addr
-.\"O and continuing for
-.\"O .I len
-.\"O bytes.
-.\"O All pages that contain a part of the specified address range are
-.\"O guaranteed to be resident in RAM when the call returns successfully;
-.\"O the pages are guaranteed to stay in RAM until later unlocked.
-.BR mlock ()
-¤Ï
-.I addr
-¤«¤é»Ï¤Þ¤ëŤµ
-.I len
-¥Ð¥¤¥È¤Î¥¢¥É¥ì¥¹ÈϰϤΥڡ¼¥¸¤ò¥í¥Ã¥¯¤¹¤ë¡£
-¸Æ¤Ó½Ð¤·¤¬À®¸ù¤·¤¿¾ì¹ç¤Ë¤Ï¡¢
-»ØÄꤵ¤ì¤¿¥¢¥É¥ì¥¹ÈϰϤò´Þ¤àÁ´¤Æ¤Î¥Ú¡¼¥¸¤Ï
-RAM ¤Ë»Ä¤ê³¤±¤ë¤³¤È¤¬Êݾڤµ¤ì¤ë¡£
-¤³¤ì¤é¤Î¥Ú¡¼¥¸¤Ï¸å¤Ç¥í¥Ã¥¯²ò½ü¤µ¤ì¤ë¤Þ¤Ç RAM ¤Ë»Ä¤ê³¤±¤ë¤³¤È¤¬Êݾڤµ¤ì¤ë¡£
+.SH 説明
+\fBmlock\fP()  と \fBmlockall\fP()  はそれぞれ、呼び出し元プロセスの仮想アドレス空間の一部または全部を RAM
+上にロックし、メモリがスワップエリアにページングされるのを防ぐ。 \fBmunlock\fP()  と \fBmunlockall\fP()
+は逆の操作で、それぞれ呼び出し元プロセスの仮想アドレス空間の一部または全部を ロック解除する。つまり、指定された仮想アドレス範囲のページは
+カーネルメモリマネージャーから要求されればスワップアウトするようになる。 メモリのロックとロック解除はページ単位で行われる。
+.SS "mlock() と munlock()"
+\fBmlock\fP()  は \fIaddr\fP から始まる長さ \fIlen\fP バイトのアドレス範囲のページをロックする。 呼び出しが成功した場合には、
+指定されたアドレス範囲を含む全てのページは RAM に残り続けることが保証される。 これらのページは後でロック解除されるまで RAM
+に残り続けることが保証される。
 
-.\"O .BR munlock ()
-.\"O unlocks pages in the address range starting at
-.\"O .I addr
-.\"O and continuing for
-.\"O .I len
-.\"O bytes.
-.\"O After this call, all pages that contain a part of the specified
-.\"O memory range can be moved to external swap space again by the kernel.
-.BR munlock ()
-¤Ï¡¢
-.I addr
-¤«¤é»Ï¤Þ¤ëŤµ
-.I len
-¥Ð¥¤¥È¤Î¥¢¥É¥ì¥¹ÈϰϤΥڡ¼¥¸¤Î¥í¥Ã¥¯¤ò²ò½ü¤¹¤ë¡£
-¤³¤Î¸Æ¤Ó½Ð¤·¤ò¹Ô¤Ã¤¿¸å¤Ï¡¢¥«¡¼¥Í¥ë¤¬¡¢»ØÄꤵ¤ì¤¿¥á¥â¥êÈϰϤò´Þ¤à
-Á´¤Æ¤Î¥Ú¡¼¥¸¤ò³°Éô¤Î¥¹¥ï¥Ã¥×¶õ´Ö¤Ë°ÜÆ°¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤ë¡£
-.\"O .SS "mlockall() and munlockall()"
-.SS "mlockall() ¤È munlockall()"
-.\"O .BR mlockall ()
-.\"O locks all pages mapped into the address space of the
-.\"O calling process.
-.\"O This includes the pages of the code, data and stack
-.\"O segment, as well as shared libraries, user space kernel data, shared
-.\"O memory, and memory-mapped files.
-.\"O All mapped pages are guaranteed
-.\"O to be resident in RAM when the call returns successfully;
-.\"O the pages are guaranteed to stay in RAM until later unlocked.
-.BR mlockall ()
-¤Ï¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¥¢¥É¥ì¥¹¶õ´Ö¤Ë¥Þ¥Ã¥×¤µ¤ì¤Æ¤¤¤ëÁ´¤Æ¤Î¥Ú¡¼¥¸¤ò
-¥í¥Ã¥¯¤¹¤ë¡£¤³¤ì¤Ë¤Ï¥³¡¼¥É¡¢¥Ç¡¼¥¿¡¢¥¹¥¿¥Ã¥¯¤Î
-³Æ¥»¥°¥á¥ó¥È¡¢¶¦Í­¥é¥¤¥Ö¥é¥ê¡¢¥«¡¼¥Í¥ë¤Î¥æ¡¼¥¶¡¼¶õ´Ö¥Ç¡¼¥¿¡¢
-¶¦Í­¥á¥â¥ê¡¢¥á¥â¥ê¡¦¥Þ¥Ã¥×¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤¬´Þ¤Þ¤ì¤ë¡£
-¥·¥¹¥Æ¥à¡¦¥³¡¼¥ë¤¬À®¸ù¤·¤¿¾ì¹ç¤Ë¤ÏÁ´¤Æ¤Î¥Þ¥Ã¥×¤µ¤ì¤¿¥Ú¡¼¥¸¤Ï RAM ¤Ë
-»Ä¤ë¤³¤È¤òÊݾڤµ¤ì¤ë¡£
-¤³¤ì¤é¤Î¥Ú¡¼¥¸¤Ï¸å¤Ç¥í¥Ã¥¯²ò½ü¤µ¤ì¤ë¤Þ¤Ç RAM ¤Ë»Ä¤ê³¤±¤ë¤³¤È¤¬Êݾڤµ¤ì¤ë¡£
+\fBmunlock\fP()  は、 \fIaddr\fP から始まる長さ \fIlen\fP バイトのアドレス範囲のページのロックを解除する。
+この呼び出しを行った後は、カーネルが、指定されたメモリ範囲を含む 全てのページを外部のスワップ空間に移動できるようになる。
+.SS "mlockall() と munlockall()"
+\fBmlockall\fP()  は呼び出し元プロセスのアドレス空間にマップされている全てのページを ロックする。これにはコード、データ、スタックの
+各セグメント、共有ライブラリ、カーネルのユーザー空間データ、 共有メモリ、メモリ・マップされたファイルが含まれる。
+システム・コールが成功した場合には全てのマップされたページは RAM に 残ることを保証される。 これらのページは後でロック解除されるまで RAM
+に残り続けることが保証される。
 
-.\"O The
-.\"O .I flags
-.\"O argument is constructed as the bitwise OR of one or more of the
-.\"O following constants:
-.I flags
-°ú¿ô¤Ï°Ê²¼¤ÎÆâÍƤΰì¤Ä¤Þ¤¿¤ÏÊ£¿ô¤Î¥Ó¥Ã¥È OR ¤«¤é¹½À®¤µ¤ì¤ë:
-.TP 1.2i
-.B MCL_CURRENT
-.\"O Lock all pages which are currently mapped into the address space of
-.\"O the process.
-¸½ºß¡¢¥×¥í¥»¥¹¤Î¥¢¥É¥ì¥¹¶õ´Ö¤Ë¥Þ¥Ã¥×¤µ¤ì¤Æ¤¤¤ëÁ´¤Æ¤Î¥Ú¡¼¥¸¤ò¥í¥Ã¥¯¤¹¤ë¡£
-.TP
-.B MCL_FUTURE
-.\"O Lock all pages which will become mapped into the address space of the
-.\"O process in the future.
-.\"O These could be for instance new pages required
-.\"O by a growing heap and stack as well as new memory mapped files or
-.\"O shared memory regions.
-¾­Íè¡¢¥×¥í¥»¥¹¤Î¥¢¥É¥ì¥¹¶õ´Ö¤Ë¥Þ¥Ã¥×¤µ¤ì¤ëÁ´¤Æ¤Î¥Ú¡¼¥¸¤ò¥í¥Ã¥¯¤¹¤ë¡£
-Î㤨¤Ð¡¢¥Ò¡¼¥× (heap) ¤ä¥¹¥¿¥Ã¥¯¤ÎÀ®Ä¹¤Ë¤è¤ê¿·¤·¤¯É¬Íפˤʤä¿¥Ú¡¼¥¸¤À¤±¤Ç
-¤Ê¤¯¡¢¿·¤·¤¯¥á¥â¥ê¥Þ¥Ã¥×¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤ä¶¦Í­¥á¥â¥êÎΰè¤â¥í¥Ã¥¯¤µ¤ì¤ë¡£
+\fIflags\fP 引数は以下の内容の一つまたは複数のビット OR から構成される:
+.TP  1.2i
+\fBMCL_CURRENT\fP
+現在、プロセスのアドレス空間にマップされている全てのページをロックする。
+.TP 
+\fBMCL_FUTURE\fP
+将来、プロセスのアドレス空間にマップされる全てのページをロックする。 例えば、ヒープ (heap) やスタックの成長により新しく必要になったページだけで
+なく、新しくメモリマップされたファイルや共有メモリ領域もロックされる。
 .PP
-.\"O If
-.\"O .B MCL_FUTURE
-.\"O has been specified, then a later system call (e.g.,
-.\"O .BR mmap (2),
-.\"O .BR sbrk (2),
-.\"O .BR malloc (3)),
-.\"O may fail if it would cause the number of locked bytes to exceed
-.\"O the permitted maximum (see below).
-.B MCL_FUTURE
-¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¤È¡¢°Ê¸å¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë (Î㤨¤Ð¡¢
-.BR mmap (2),
-.BR sbrk (2),
-.BR malloc (3))
-¤Ï¡¢¥í¥Ã¥¯¤¹¤ë¥Ð¥¤¥È¿ô¤¬µö²Ä¤µ¤ì¤¿ºÇÂçÃÍ (²¼µ­»²¾È) ¤òĶ¤¨¤¿¾ì¹ç¤Ë
-¼ºÇÔ¤¹¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
-.\"O In the same circumstances, stack growth may likewise fail:
-.\"O the kernel will deny stack expansion and deliver a
-.\"O .B SIGSEGV
-.\"O signal to the process.
-ƱÍͤˡ¢¥¹¥¿¥Ã¥¯¤ÎÀ®Ä¹¤â¼ºÇÔ¤¹¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
-¤½¤Î¾ì¹ç¡¢¥«¡¼¥Í¥ë¤Ï¥¹¥¿¥Ã¥¯¤Î³ÈÄ¥¤òµñÈݤ·¡¢
-.B SIGSEGV
-¤ò¥×¥í¥»¥¹¤ËÁ÷¤ë¡£
+\fBMCL_FUTURE\fP が指定されていると、以後のシステムコール (例えば、 \fBmmap\fP(2), \fBsbrk\fP(2),
+\fBmalloc\fP(3))  は、ロックするバイト数が許可された最大値 (下記参照) を超えた場合に 失敗する可能性がある。
+同様に、スタックの成長も失敗する可能性がある。 その場合、カーネルはスタックの拡張を拒否し、 \fBSIGSEGV\fP をプロセスに送る。
 
-.\"O .BR munlockall ()
-.\"O unlocks all pages mapped into the address space of the
-.\"O calling process.
-.BR munlockall ()
-¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¥¢¥É¥ì¥¹¶õ´Ö¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤Æ¤¤¤ë
-Á´¤Æ¤Î¥Ú¡¼¥¸¤ò¥í¥Ã¥¯²ò½ü¤¹¤ë¡£
-.\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
-.\"O On success these system calls return 0.
-.\"O On error, \-1 is returned,
-.\"O .I errno
-.\"O is set appropriately, and no changes are made to any locks in the
-.\"O address space of the process.
-À®¸ù¤·¤¿¾ì¹ç¤Ï¡¢¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¥¼¥í¤òÊÖ¤¹¡£
-¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤¬ÊÖ¤µ¤ì¡¢
-.I errno
-¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¡¢¥×¥í¥»¥¹¤Î¥¢¥É¥ì¥¹¶õ´Ö¤Ë¤ª¤±¤ë¥í¥Ã¥¯¤ÏÊѹ¹¤µ¤ì¤Ê¤¤¡£
-.\"O .SH ERRORS
-.SH ¥¨¥é¡¼
-.TP
-.B ENOMEM
-.\"O (Linux 2.6.9 and later) the caller had a nonzero
-.\"O .B RLIMIT_MEMLOCK
-.\"O soft resource limit, but tried to lock more memory than the limit
-.\"O permitted.
-(Linux 2.6.9 °Ê¹ß) ¸Æ¤Ó½Ð¤·¸µ¤ÏÈó¥¼¥í¤Î
-¥½¥Õ¥È»ñ¸»À©¸Â
-.B RLIMIT_MEMLOCK
-¤ò»ý¤Ä¤¬¡¢À©¸Â¤¬µö²Ä¤·¤Æ¤¤¤ë°Ê¾å¤Î¥á¥â¥ê¤ò¥í¥Ã¥¯¤·¤è¤¦¤È¤·¤¿¡£
-.\"O This limit is not enforced if the process is privileged
-.\"O .RB ( CAP_IPC_LOCK ).
-¤³¤ÎÀ©¸Â¤Ï¡¢¥×¥í¥»¥¹¤¬Æø¢
-.RB ( CAP_IPC_LOCK )
-¤ò»ý¤Ã¤Æ¤¤¤ë¾ì¹ç¤ÏŬÍѤµ¤ì¤Ê¤¤¡£
-.TP
-.B ENOMEM
-.\"O (Linux 2.4 and earlier) the calling process tried to lock more than
-.\"O half of RAM.
-(Linux 2.4 °ÊÁ°) ¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤¬ RAM ¤ÎȾʬ°Ê¾å¤ò¥í¥Ã¥¯¤·¤è¤¦¤È¤·¤¿¡£
-.\"O .\" In the case of mlock(), this check is somewhat buggy: it doesn't
-.\"O .\" take into account whether the to-be-locked range overlaps with
-.\"O .\" already locked pages.  Thus, suppose we allocate
-.\"O .\" (num_physpages / 4 + 1) of memory, and lock those pages once using
-.\"O .\" mlock(), and then lock the *same* page range a second time.
-.\"O .\" In the case, the second mlock() call will fail, since the check
-.\"O .\" calculates that the process is trying to lock (num_physpages / 2 + 2)
-.\"O .\" pages, which of course is not true.  (MTK, Nov 04, kernel 2.4.28)
-.TP
-.B EPERM
-.\"O (Linux 2.6.9 and later) the caller was not privileged
-.\"O .RB ( CAP_IPC_LOCK )
-.\"O and its
-.\"O .B RLIMIT_MEMLOCK
-.\"O soft resource limit was 0.
-(Linux 2.6.9 °Ê¹ß) ¸Æ¤Ó½Ð¤·¸µ¤ÏÆø¢
-.RB ( CAP_IPC_LOCK )
-¤ò»ý¤¿¤º¡¢¥½¥Õ¥È»ñ¸»À©¸Â
-.B RLIMIT_MEMLOCK
-¤¬ 0 ¤Ç¤¢¤ë¡£
-.TP
-.B EPERM
-.\"O (Linux 2.6.8 and earlier)
-.\"O The calling process has insufficient privilege to call
-.\"O .BR munlockall ().
-(Linux 2.6.8 °ÊÁ°)
-¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤¬
-.BR munlockall ()
-¤ò¸Æ¤Ó½Ð¤¹¤Î¤ËɬÍפÊÆø¢¤ò½êÍ­¤·¤Æ¤¤¤Ê¤«¤Ã¤¿¡£
-.\"O Under Linux the
-.\"O .B CAP_IPC_LOCK
-.\"O capability is required.
-Linux ¤Ç¤Ï¡¢
-.B CAP_IPC_LOCK
-¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤¬É¬ÍפǤ¢¤ë¡£
-.\"O .\"SVr4 documents an additional EAGAIN error code.
-.\"SVr4 ¤Î¥É¥­¥å¥á¥ó¥È¤Ë¤Ï¡¢¤³¤ì°Ê³°¤Ë¥¨¥é¡¼¥³¡¼¥É EAGAIN ¤Îµ­ºÜ¤¬¤¢¤ë¡£
+\fBmunlockall\fP()  は、呼び出し元プロセスのアドレス空間にマッピングされている 全てのページをロック解除する。
+.SH 返り値
+成功した場合は、これらのシステムコールはゼロを返す。 エラーの場合は \-1 が返され、 \fIerrno\fP
+が適切に設定され、プロセスのアドレス空間におけるロックは変更されない。
+.SH エラー
+.TP 
+\fBENOMEM\fP
+(Linux 2.6.9 以降) 呼び出し元は非ゼロの ソフト資源制限 \fBRLIMIT_MEMLOCK\fP
+を持つが、制限が許可している以上のメモリをロックしようとした。 この制限は、プロセスが特権 (\fBCAP_IPC_LOCK\fP)
+を持っている場合は適用されない。
+.TP 
+\fBENOMEM\fP
+.\" In the case of mlock(), this check is somewhat buggy: it doesn't
+.\" take into account whether the to-be-locked range overlaps with
+.\" already locked pages.  Thus, suppose we allocate
+.\" (num_physpages / 4 + 1) of memory, and lock those pages once using
+.\" mlock(), and then lock the *same* page range a second time.
+.\" In the case, the second mlock() call will fail, since the check
+.\" calculates that the process is trying to lock (num_physpages / 2 + 2)
+.\" pages, which of course is not true.  (MTK, Nov 04, kernel 2.4.28)
+(Linux 2.4 以前) 呼び出し元プロセスが RAM の半分以上をロックしようとした。
+.TP 
+\fBEPERM\fP
+.\"SVr4 documents an additional EAGAIN error code.
+呼び出し側が特権を持っていないが、
+要求された操作を実行するには特権 (\fBCAP_IPC_LOCK\fP) が必要である。
 .LP
-.\"O For
-.\"O .BR mlock ()
-.\"O and
-.\"O .BR munlock ():
-.BR mlock ()
-¤È
-.BR munlock ()
-ÍѤȤ·¤Æ:
-.TP
-.B EAGAIN
-.\"O Some or all of the specified address range could not be locked.
-»ØÄꤵ¤ì¤¿¥¢¥É¥ì¥¹ÈϰϤΰìÉô¤Þ¤¿¤ÏÁ´¤Æ¤ò¥í¥Ã¥¯¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤«¤Ã¤¿¡£
-.TP
-.B EINVAL
-.\"O .I len
-.\"O was negative.
-.I len
-¤¬Éé¤Î¿ô¤Ç¤¢¤ë¡£
-.TP
-.B EINVAL
-.\"O (Not on Linux)
-.\"O .I addr
-.\"O was not a multiple of the page size.
-(Linux ¤Ç¤Ï¤³¤Î°ÕÌ£¤Ç»È¤ï¤ì¤Ê¤¤)
-.I addr
-¤¬¥Ú¡¼¥¸¥µ¥¤¥º¤ÎÇÜ¿ô¤Ç¤Ï¤Ê¤¤¡£
-.TP
-.B ENOMEM
-.\"O Some of the specified address range does not correspond to mapped
-.\"O pages in the address space of the process.
-»ØÄꤵ¤ì¤¿¥¢¥É¥ì¥¹ÈϰϤ¬¥×¥í¥»¥¹¤Î¥¢¥É¥ì¥¹¶õ´Ö¤Ë¥Þ¥Ã¥×¤µ¤ì¤¿¥Ú¡¼¥¸¤È
-°ìÃפ·¤Ê¤¤¡£
+\fBmlock\fP()  と \fBmunlock\fP()  用として:
+.TP 
+\fBEAGAIN\fP
+指定されたアドレス範囲の一部または全てをロックすることができなかった。
+.TP 
+\fBEINVAL\fP
+\fIstart\fP+\fIlen\fP の加算の結果が \fIstart\fP よりも小さかった
+(例えば、加算でオーバーフローが発生したなど)。
+.TP 
+\fBEINVAL\fP
+(Linux ではこの意味で使われない)  \fIaddr\fP がページサイズの倍数ではない。
+.TP 
+\fBENOMEM\fP
+指定されたアドレス範囲がプロセスのアドレス空間にマップされたページと 一致しない。
 .LP
-.\"O For
-.\"O .BR mlockall ():
-.BR mlockall ()
-ÍѤȤ·¤Æ:
-.TP
-.B EINVAL
-.\"O Unknown \fIflags\fP were specified.
-̤ÃΤΠ\fIflags\fP ¤¬»ØÄꤵ¤ì¤¿¡£
+\fBmlockall\fP()  用として:
+.TP 
+\fBEINVAL\fP
+未知の \fIflags\fP が指定された。
 .LP
-.\"O For
-.\"O .BR munlockall ():
-.BR munlockall ()
-ÍѤȤ·¤Æ:
-.TP
-.B EPERM
-.\"O (Linux 2.6.8 and earlier) The caller was not privileged
-.\"O .RB ( CAP_IPC_LOCK ).
-(Linux 2.6.8 °ÊÁ°) ¸Æ¤Ó½Ð¤·¸µ¤¬¸¢¸Â
-.RB ( CAP_IPC_LOCK )
-¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£
-.\"O .SH "CONFORMING TO"
-.SH ½àµò
-POSIX.1-2001, SVr4.
-.\"O .SH AVAILABILITY
-.SH ²ÄÍÑÀ­
-.\"O On POSIX systems on which
-.\"O .BR mlock ()
-.\"O and
-.\"O .BR munlock ()
-.\"O are available,
-.\"O .B _POSIX_MEMLOCK_RANGE
-.\"O is defined in \fI<unistd.h>\fP and the number of bytes in a page
-.\"O can be determined from the constant
-.\"O .B PAGESIZE
-.\"O (if defined) in \fI<limits.h>\fP or by calling
-.\"O .IR sysconf(_SC_PAGESIZE) .
-.BR mlock ()
-¤È
-.BR munlock ()
-¤¬»ÈÍѲÄǽ¤Ê POSIX ¥·¥¹¥Æ¥à¤Ç¤Ï
-.B _POSIX_MEMLOCK_RANGE
-¤¬ \fI<unistd.h>\fP ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
-¤Þ¤¿¡¢¥Ú¡¼¥¸¤¢¤¿¤ê¤Î¥Ð¥¤¥È¿ô¤Ï¡¢
-\fI<limits.h>\fP ¤ÇÄêµÁ¤µ¤ì¤ëÄê¿ô
-.B PAGESIZE
-¤«¤é (ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç)¡¢¤â¤·¤¯¤Ï
-.I sysconf(_SC_PAGESIZE)
-¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤Ç·èÄê¤Ç¤­¤ë¡£
+\fBmunlockall\fP()  用として:
+.TP 
+\fBEPERM\fP
+(Linux 2.6.8 以前) 呼び出し元が権限 (\fBCAP_IPC_LOCK\fP)  を持っていない。
+.SH 準拠
+POSIX.1\-2001, SVr4.
+.SH 可用性
+\fBmlock\fP()  と \fBmunlock\fP()  が使用可能な POSIX システムでは \fB_POSIX_MEMLOCK_RANGE\fP が
+\fI<unistd.h>\fP で定義されている。 また、ページあたりのバイト数は、 \fI<limits.h>\fP
+で定義される定数 \fBPAGESIZE\fP から (定義されている場合)、もしくは \fIsysconf(_SC_PAGESIZE)\fP
+を呼び出すことで決定できる。
+
+.\" POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
+.\" -1: unavailable, 0: ask using sysconf().
+.\" glibc defines it to 1.
+\fBmlockall\fP()  と \fBmunlockall\fP()  が利用可能な POSIX システムでは、 \fB_POSIX_MEMLOCK\fP は
+\fI<unistd.h>\fP で 0 より大きい値に定義されている (\fBsysconf\fP(3)  も参照のこと)。
+.SH 注意
+メモリのロックの用途としては主に二つある: リアルタイム アルゴリズムと高いセキュリティの必要なデータ処理である。リアルタイムの
+アプリケーションは決定的なタイミングやスケジューリングを必要とするが、 ページングは予期しないプログラムの実行遅延をもたらす主要な要因となる。
+リアルタイムのアプリケーションはたいていは \fBsched_setscheduler\fP(2)  でリアルタイムスケジューラに変更される。
+暗号やセキュリティのソフトウェアはしばしばパスワードや秘密鍵のデータの ような重要なバイト列を扱う。ページングの結果、これらの秘密が
+スワップ用の固定媒体に転送されるかもしれない。そして、セキュリティ・ ソフトウェアが RAM 上の秘密を削除して終了したずっと後になっても、
+このスワップされたデータには敵がアクセスできる可能性がある (しかし、ラップトップといくつかのデスクトップコンピュータの サスペンドモードはシステムの
+RAM の内容をメモリのロックに関わらず ディスクに保存することに注意)。
 
-.\"O On POSIX systems on which
-.\"O .BR mlockall ()
-.\"O and
-.\"O .BR munlockall ()
-.\"O are available,
-.\"O .B _POSIX_MEMLOCK
-.\"O is defined in \fI<unistd.h>\fP to a value greater than 0.
-.\"O (See also
-.\"O .BR sysconf (3).)
-.BR mlockall ()
-¤È
-.BR munlockall ()
-¤¬ÍøÍѲÄǽ¤Ê POSIX ¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
-.B _POSIX_MEMLOCK
-¤Ï \fI<unistd.h>\fP ¤Ç 0 ¤è¤êÂ礭¤¤ÃͤËÄêµÁ¤µ¤ì¤Æ¤¤¤ë
-.RB ( sysconf (3)
-¤â»²¾È¤Î¤³¤È)¡£
-.\"O .\" POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
-.\"O .\" -1: unavailable, 0: ask using sysconf().
-.\"O .\" glibc defines it to 1.
-.\" POSIX.1-2001: ¤³¤ÎÊÑ¿ô¤Ï -1 ¤« 0 ¤« 200112l ¤Î¤¤¤º¤ì¤«¤Ë
-.\" ÄêµÁ¤¹¤Ù¤­¤È¤Ê¤Ã¤Æ¤¤¤ë¡£
-.\" -1: ÍøÍѤǤ­¤Ê¤¤¡¢0: sysconf() ¤ËÌ䤤¹ç¤ï¤»¤ë
-.\" glibc ¤Ç¤Ï 1 ¤ËÄêµÁ¤·¤Æ¤¤¤ë¡£
-.\"O .SH "NOTES"
-.SH Ãí°Õ
-.\"O Memory locking has two main applications: real-time algorithms and
-.\"O high-security data processing.
-.\"O Real-time applications require
-.\"O deterministic timing, and, like scheduling, paging is one major cause
-.\"O of unexpected program execution delays.
-.\"O Real-time applications will
-.\"O usually also switch to a real-time scheduler with
-.\"O .BR sched_setscheduler (2).
-¥á¥â¥ê¤Î¥í¥Ã¥¯¤ÎÍÑÅӤȤ·¤Æ¤Ï¼ç¤ËÆó¤Ä¤¢¤ë: ¥ê¥¢¥ë¥¿¥¤¥à
-¥¢¥ë¥´¥ê¥º¥à¤È¹â¤¤¥»¥­¥å¥ê¥Æ¥£¤ÎɬÍפʥǡ¼¥¿½èÍý¤Ç¤¢¤ë¡£¥ê¥¢¥ë¥¿¥¤¥à¤Î
-¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï·èÄêŪ¤Ê¥¿¥¤¥ß¥ó¥°¤ä¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤òɬÍפȤ¹¤ë¤¬¡¢
-¥Ú¡¼¥¸¥ó¥°¤Ïͽ´ü¤·¤Ê¤¤¥×¥í¥°¥é¥à¤Î¼Â¹ÔÃÙ±ä¤ò¤â¤¿¤é¤¹¼çÍפÊÍ×°ø¤È¤Ê¤ë¡£
-¥ê¥¢¥ë¥¿¥¤¥à¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¤¿¤¤¤Æ¤¤¤Ï
-.BR sched_setscheduler (2)
-¤Ç¥ê¥¢¥ë¥¿¥¤¥à¥¹¥±¥¸¥å¡¼¥é¤ËÊѹ¹¤µ¤ì¤ë¡£
-.\"O Cryptographic security software often handles critical bytes like
-.\"O passwords or secret keys as data structures.
-.\"O As a result of paging,
-.\"O these secrets could be transferred onto a persistent swap store medium,
-.\"O where they might be accessible to the enemy long after the security
-.\"O software has erased the secrets in RAM and terminated.
-.\"O (But be aware that the suspend mode on laptops and some desktop
-.\"O computers will save a copy of the system's RAM to disk, regardless
-.\"O of memory locks.)
-°Å¹æ¤ä¥»¥­¥å¥ê¥Æ¥£¤Î¥½¥Õ¥È¥¦¥§¥¢¤Ï¤·¤Ð¤·¤Ð¥Ñ¥¹¥ï¡¼¥É¤äÈëÌ©¸°¤Î¥Ç¡¼¥¿¤Î
-¤è¤¦¤Ê½ÅÍפʥХ¤¥ÈÎó¤ò°·¤¦¡£¥Ú¡¼¥¸¥ó¥°¤Î·ë²Ì¡¢¤³¤ì¤é¤ÎÈëÌ©¤¬
-¥¹¥ï¥Ã¥×ÍѤθÇÄêÇÞÂΤËžÁ÷¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£¤½¤·¤Æ¡¢¥»¥­¥å¥ê¥Æ¥£¡¦
-¥½¥Õ¥È¥¦¥§¥¢¤¬ RAM ¾å¤ÎÈëÌ©¤òºï½ü¤·¤Æ½ªÎ»¤·¤¿¤º¤Ã¤È¸å¤Ë¤Ê¤Ã¤Æ¤â¡¢
-¤³¤Î¥¹¥ï¥Ã¥×¤µ¤ì¤¿¥Ç¡¼¥¿¤Ë¤ÏŨ¤¬¥¢¥¯¥»¥¹¤Ç¤­¤ë²ÄǽÀ­¤¬¤¢¤ë
-(¤·¤«¤·¡¢¥é¥Ã¥×¥È¥Ã¥×¤È¤¤¤¯¤Ä¤«¤Î¥Ç¥¹¥¯¥È¥Ã¥×¥³¥ó¥Ô¥å¡¼¥¿¤Î
-¥µ¥¹¥Ú¥ó¥É¥â¡¼¥É¤Ï¥·¥¹¥Æ¥à¤Î RAM ¤ÎÆâÍƤò¥á¥â¥ê¤Î¥í¥Ã¥¯¤Ë´Ø¤ï¤é¤º
-¥Ç¥£¥¹¥¯¤ËÊݸ¤¹¤ë¤³¤È¤ËÃí°Õ)¡£
+リアルタイムプロセスが \fBmlockall\fP()  を使ってページフォールトによる遅延を防ごうとする場合、
+関数呼び出しによってページフォールトが発生しないように、 時間制限の厳しい部分 (time\-critical section) に入る前に
+十分な量のロックされたスタックを確保しておく必要がある。 これを実現するには、十分な大きさの自動変数 (の配列) を確保し、
+これらのスタック用のページがメモリ上に確保されるようにこの配列に 書き込みを行う関数を用意し、これを呼び出せばよい。こうすることで、
+十分な量のページがスタックにマッピングされ、RAM にロックされる。 ダミーの書き込みを行うことによって、 時間制限の厳しい部分 (critical
+section) 内では書き込み時コピーによる ページフォールトさえも発生しないことが保証される。
 
-.\"O Real-time processes that are using
-.\"O .BR mlockall ()
-.\"O to prevent delays on page faults should reserve enough
-.\"O locked stack pages before entering the time-critical section,
-.\"O so that no page fault can be caused by function calls.
-.\"O This can be achieved by calling a function that allocates a
-.\"O sufficiently large automatic variable (an array) and writes to the
-.\"O memory occupied by this array in order to touch these stack pages.
-.\"O This way, enough pages will be mapped for the stack and can be
-.\"O locked into RAM.
-.\"O The dummy writes ensure that not even copy-on-write
-.\"O page faults can occur in the critical section.
-¥ê¥¢¥ë¥¿¥¤¥à¥×¥í¥»¥¹¤¬
-.BR mlockall ()
-¤ò»È¤Ã¤Æ¥Ú¡¼¥¸¥Õ¥©¡¼¥ë¥È¤Ë¤è¤ëÃÙ±ä¤òËɤ´¤¦¤È¤¹¤ë¾ì¹ç¡¢
-´Ø¿ô¸Æ¤Ó½Ð¤·¤Ë¤è¤Ã¤Æ¥Ú¡¼¥¸¥Õ¥©¡¼¥ë¥È¤¬È¯À¸¤·¤Ê¤¤¤è¤¦¤Ë¡¢
-»þ´ÖÀ©¸Â¤Î¸·¤·¤¤Éôʬ (time-critical section) ¤ËÆþ¤ëÁ°¤Ë
-½½Ê¬¤ÊÎ̤Υí¥Ã¥¯¤µ¤ì¤¿¥¹¥¿¥Ã¥¯¤ò³ÎÊݤ·¤Æ¤ª¤¯É¬Íפ¬¤¢¤ë¡£
-¤³¤ì¤ò¼Â¸½¤¹¤ë¤Ë¤Ï¡¢½½Ê¬¤ÊÂ礭¤µ¤Î¼«Æ°ÊÑ¿ô (¤ÎÇÛÎó) ¤ò³ÎÊݤ·¡¢
-¤³¤ì¤é¤Î¥¹¥¿¥Ã¥¯ÍѤΥڡ¼¥¸¤¬¥á¥â¥ê¾å¤Ë³ÎÊݤµ¤ì¤ë¤è¤¦¤Ë¤³¤ÎÇÛÎó¤Ë
-½ñ¤­¹þ¤ß¤ò¹Ô¤¦´Ø¿ô¤òÍÑ°Õ¤·¡¢¤³¤ì¤ò¸Æ¤Ó½Ð¤»¤Ð¤è¤¤¡£¤³¤¦¤¹¤ë¤³¤È¤Ç¡¢
-½½Ê¬¤ÊÎ̤Υڡ¼¥¸¤¬¥¹¥¿¥Ã¥¯¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¡¢RAM ¤Ë¥í¥Ã¥¯¤µ¤ì¤ë¡£
-¥À¥ß¡¼¤Î½ñ¤­¹þ¤ß¤ò¹Ô¤¦¤³¤È¤Ë¤è¤Ã¤Æ¡¢
-»þ´ÖÀ©¸Â¤Î¸·¤·¤¤Éôʬ (critical section) Æâ¤Ç¤Ï½ñ¤­¹þ¤ß»þ¥³¥Ô¡¼¤Ë¤è¤ë
-¥Ú¡¼¥¸¥Õ¥©¡¼¥ë¥È¤µ¤¨¤âȯÀ¸¤·¤Ê¤¤¤³¤È¤¬Êݾڤµ¤ì¤ë¡£
+メモリロックは \fBfork\fP(2)  で作成された子プロセスには継承されず、 \fBexecve\fP(2)  が呼ばれたり、プロセスが終了した場合は
+自動的に削除される (ロック解除される)。
 
-.\"O Memory locks are not inherited by a child created via
-.\"O .BR fork (2)
-.\"O and are automatically removed (unlocked) during an
-.\"O .BR execve (2)
-.\"O or when the process terminates.
-¥á¥â¥ê¥í¥Ã¥¯¤Ï
-.BR fork (2)
-¤ÇºîÀ®¤µ¤ì¤¿»Ò¥×¥í¥»¥¹¤Ë¤Ï·Ñ¾µ¤µ¤ì¤º¡¢
-.BR execve (2)
-¤¬¸Æ¤Ð¤ì¤¿¤ê¡¢¥×¥í¥»¥¹¤¬½ªÎ»¤·¤¿¾ì¹ç¤Ï
-¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë (¥í¥Ã¥¯²ò½ü¤µ¤ì¤ë)¡£
+あるアドレス範囲に対するメモリロックは、そのアドレス範囲が \fBmunmap\fP(2)  によってアンマップされた場合は削除される。
 
-.\"O The memory lock on an address range is automatically removed
-.\"O if the address range is unmapped via
-.\"O .BR munmap (2).
-¤¢¤ë¥¢¥É¥ì¥¹ÈϰϤËÂФ¹¤ë¥á¥â¥ê¥í¥Ã¥¯¤Ï¡¢¤½¤Î¥¢¥É¥ì¥¹ÈϰϤ¬
-.BR munmap (2)
-¤Ë¤è¤Ã¤Æ¥¢¥ó¥Þ¥Ã¥×¤µ¤ì¤¿¾ì¹ç¤Ïºï½ü¤µ¤ì¤ë¡£
+メモリのロックは累積しない。 すなわち複数回 \fBmlock\fP()  や \fBmlockall\fP()  を呼び出してロックされたページでも、
+対応する範囲に対して \fBmunlock\fP()  を 1 回呼び出したり \fBmunlockall\fP()  を呼び出したりするだけでロック解除される。
+複数の場所や複数のプロセスにマップされているページは、少なくとも一つの場所、 一つのプロセスでロックされている限りは RAM に残り続ける。
+.SS "Linux での注意"
+Linux では、 \fBmlock\fP()  と \fBmunlock\fP()  は自動的に \fIaddr\fP
+を端数切り捨てにより一番近いページ境界へと丸める。 しかし POSIX.1\-2001 は \fIaddr\fP
+がページ境界に合っていることを要求する実装も許している。 そのため移植性を意図したアプリケーションではきちんと境界に合わせた方が良い。
 
-.\"O Memory locks do not stack, that is, pages which have been locked several times
-.\"O by calls to
-.\"O .BR mlock ()
-.\"O or
-.\"O .BR mlockall ()
-.\"O will be unlocked by a single call to
-.\"O .BR munlock ()
-.\"O for the corresponding range or by
-.\"O .BR munlockall ().
-.\"O Pages which are mapped to several locations or by several processes stay
-.\"O locked into RAM as long as they are locked at least at one location or by
-.\"O at least one process.
-¥á¥â¥ê¤Î¥í¥Ã¥¯¤ÏÎßÀѤ·¤Ê¤¤¡£
-¤¹¤Ê¤ï¤ÁÊ£¿ô²ó
-.BR mlock ()
-¤ä
-.BR mlockall ()
-¤ò¸Æ¤Ó½Ð¤·¤Æ¥í¥Ã¥¯¤µ¤ì¤¿¥Ú¡¼¥¸¤Ç¤â¡¢
-Âбþ¤¹¤ëÈϰϤËÂФ·¤Æ
-.BR munlock ()
-¤ò 1 ²ó¸Æ¤Ó½Ð¤·¤¿¤ê
-.BR munlockall ()
-¤ò¸Æ¤Ó½Ð¤·¤¿¤ê¤¹¤ë¤À¤±¤Ç¥í¥Ã¥¯²ò½ü¤µ¤ì¤ë¡£
-Ê£¿ô¤Î¾ì½ê¤äÊ£¿ô¤Î¥×¥í¥»¥¹¤Ë¥Þ¥Ã¥×¤µ¤ì¤Æ¤¤¤ë¥Ú¡¼¥¸¤Ï¡¢¾¯¤Ê¤¯¤È¤â°ì¤Ä¤Î¾ì½ê¡¢
-°ì¤Ä¤Î¥×¥í¥»¥¹¤Ç¥í¥Ã¥¯¤µ¤ì¤Æ¤¤¤ë¸Â¤ê¤Ï RAM ¤Ë»Ä¤ê³¤±¤ë¡£
-.\"O .SS "Linux Notes"
-.SS Linux ¤Ç¤ÎÃí°Õ
-.\"O Under Linux,
-.\"O .BR mlock ()
-.\"O and
-.\"O .BR munlock ()
-.\"O automatically round
-.\"O .I addr
-.\"O down to the nearest page boundary.
-Linux ¤Ç¤Ï¡¢
-.BR mlock ()
-¤È
-.BR munlock ()
-¤Ï¼«Æ°Åª¤Ë
-.I addr
-¤òü¿ôÀÚ¤ê¼Î¤Æ¤Ë¤è¤ê°ìÈֶᤤ¥Ú¡¼¥¸¶­³¦¤Ø¤È´Ý¤á¤ë¡£
-.\"O However, POSIX.1-2001 allows an implementation to require that
-.\"O .I addr
-.\"O is page aligned, so portable applications should ensure this.
-¤·¤«¤· POSIX.1-2001 ¤Ï
-.I addr
-¤¬¥Ú¡¼¥¸¶­³¦¤Ë¹ç¤Ã¤Æ¤¤¤ë¤³¤È¤òÍ׵᤹¤ë¼ÂÁõ¤âµö¤·¤Æ¤¤¤ë¡£
-¤½¤Î¤¿¤á°Ü¿¢À­¤ò°Õ¿Þ¤·¤¿¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï¤­¤Á¤ó¤È¶­³¦¤Ë¹ç¤ï¤»¤¿Êý¤¬Îɤ¤¡£
-.\"O .SS "Limits and permissions"
-.SS À©¸Â¤È¸¢¸Â
-.\"O In Linux 2.6.8 and earlier,
-.\"O a process must be privileged
-.\"O .RB ( CAP_IPC_LOCK )
-.\"O in order to lock memory and the
-.\"O .B RLIMIT_MEMLOCK
-.\"O soft resource limit defines a limit on how much memory the process may lock.
-Linux 2.6.8 °ÊÁ°¤Ç¤Ï¡¢¥á¥â¥ê¤ò¥í¥Ã¥¯¤¹¤ë¤¿¤á¤Ë¤ÏÆø¢
-.RB ( CAP_IPC_LOCK )
-¤¬É¬Íפǡ¢
-¥½¥Õ¥È»ñ¸»À©¸Â
-.B RLIMIT_MEMLOCK
-¤Ï¥×¥í¥»¥¹¤¬¤É¤ì¤À¤±¤Î¥á¥â¥ê¤ò¥í¥Ã¥¯¤Ç¤­¤ë¤«¤ÎÀ©¸Â¤òÄêµÁ¤¹¤ë¡£
+Linux 固有の \fI/proc/PID/status\fP ファイルの \fIVmLck\fP フィールドには、
+\fBmlock\fP(), \fBmlockall\fP() および \fBmmap\fP(2) \fBMAP_LOCKED\fP を使って、
+ID が \fIPID\fP のプロセスがロックしているメモリ量 (キロバイト単位) が
+表示される。
+.SS 制限と権限
+Linux 2.6.8 以前では、メモリをロックするためには特権 (\fBCAP_IPC_LOCK\fP)  が必要で、 ソフト資源制限
+\fBRLIMIT_MEMLOCK\fP はプロセスがどれだけのメモリをロックできるかの制限を定義する。
 
-.\"O Since Linux 2.6.9, no limits are placed on the amount of memory
-.\"O that a privileged process can lock and the
-.\"O .B RLIMIT_MEMLOCK
-.\"O soft resource limit instead defines a limit on how much memory an
-.\"O unprivileged process may lock.
-Linux 2.6.9 °Ê¹ß¤Ç¤Ï¡¢Æø¢¤ò»ý¤Ä¥×¥í¥»¥¹¤¬¥í¥Ã¥¯¤Ç¤­¤ë¥á¥â¥êÎ̤Ï̵À©¸Â¤È¤Ê¤ê¡¢
-Âå¤ï¤ê¤Ë¥½¥Õ¥È»ñ¸»À©¸Â
-.B RLIMIT_MEMLOCK
-¤ÏÆø¢¤ò»ý¤¿¤Ê¤¤¥×¥í¥»¥¹¤¬¥í¥Ã¥¯¤Ç¤­¤ë¥á¥â¥êÎ̤ÎÀ©¸Â¤òÄêµÁ¤¹¤ë¡£
-.\"O .SH "BUGS"
-.SH ¥Ð¥°
-.\"O In the 2.4 series Linux kernels up to and including 2.4.17,
-.\"O a bug caused the
-.\"O .BR mlockall ()
-.\"O .B MCL_FUTURE
-.\"O flag to be inherited across a
-.\"O .BR fork (2).
-2.4.17 ¤Þ¤Ç¤Î 2.4 ¥·¥ê¡¼¥º¤Î Linux ¥«¡¼¥Í¥ë¤Ë¤Ï¡¢
-.BR mlockall ()
-.B MCL_FUTURE
-¥Õ¥é¥°¤¬
-.BR fork (2)
-¤Ç·Ñ¾µ¤µ¤ì¤ë¤È¸À¤¦¥Ð¥°¤¬¤¢¤ë¡£
-.\"O This was rectified in kernel 2.4.18.
-¤³¤ì¤Ï¥«¡¼¥Í¥ë 2.4.18 ¤Ç½¤Àµ¤µ¤ì¤¿¡£
+Linux 2.6.9 以降では、特権を持つプロセスがロックできるメモリ量は無制限となり、 代わりにソフト資源制限 \fBRLIMIT_MEMLOCK\fP
+は特権を持たないプロセスがロックできるメモリ量の制限を定義する。
+.SH バグ
+2.4.17 までの 2.4 シリーズの Linux カーネルには、 \fBmlockall\fP()  \fBMCL_FUTURE\fP フラグが
+\fBfork\fP(2)  で継承されると言うバグがある。 これはカーネル 2.4.18 で修正された。
 
-.\"O Since kernel 2.6.9, if a privileged process calls
-.\"O .I mlockall(MCL_FUTURE)
-.\"O and later drops privileges (loses the
-.\"O .B CAP_IPC_LOCK
-.\"O capability by, for example,
-.\"O setting its effective UID to a nonzero value),
-.\"O then subsequent memory allocations (e.g.,
-.\"O .BR mmap (2),
-.\"O .BR brk (2))
-.\"O will fail if the
-.\"O .B RLIMIT_MEMLOCK
-.\"O resource limit is encountered.
-¥«¡¼¥Í¥ë 2.6.9 °Ê¹ß¤Ç¤Ï¡¢Æø¢¤ò»ý¤Ã¤¿¥×¥í¥»¥¹¤¬
-.I mlockall(MCL_FUTURE)
-¤ò¸Æ¤Ó½Ð¤·¤¿¸å¤Ç¡¢Æø¢¤ò¤Ê¤¯¤·¤¿¾ì¹ç (Î㤨¤Ð¡¢
-¼Â¸ú UID ¤ò 0 °Ê³°¤ÎÃͤËÊѹ¹¤¹¤ë¤Ê¤É¤Ë¤è¤ê¡¢
-.B CAP_IPC_LOCK
-¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò¼º¤Ã¤¿¾ì¹ç)¡¢¥ê¥½¡¼¥¹¾å¸Â
-.B RLIMIT_MEMLOCK
-¤Ë㤹¤ë¤È¡¢¤½¤ì°Ê¹ß¤Î¥á¥â¥ê³ä¤êÅö¤Æ (Î㤨¤Ð
-.BR mmap (2),
-.BR brk (2))
-¤Ï¼ºÇÔ¤¹¤ë¡£
-.\"O .\" See the following LKML thread:
-.\"O .\" http://marc.theaimsgroup.com/?l=linux-kernel&m=113801392825023&w=2
-.\"O .\" "Rationale for RLIMIT_MEMLOCK"
-.\"O .\" 23 Jan 2006
-.\" LKML ¤Î°Ê²¼¤Î¥¹¥ì¥Ã¥É¤ò»²¾È:
+.\" See the following LKML thread:
 .\" http://marc.theaimsgroup.com/?l=linux-kernel&m=113801392825023&w=2
 .\" "Rationale for RLIMIT_MEMLOCK"
 .\" 23 Jan 2006
-.\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
-.BR mmap (2),
-.BR setrlimit (2),
-.BR shmctl (2),
-.BR sysconf (3),
-.BR capabilities (7)
+カーネル 2.6.9 以降では、特権を持ったプロセスが \fImlockall(MCL_FUTURE)\fP を呼び出した後で、特権をなくした場合 (例えば、
+実効 UID を 0 以外の値に変更するなどにより、 \fBCAP_IPC_LOCK\fP ケーパビリティを失った場合)、リソース上限
+\fBRLIMIT_MEMLOCK\fP に達すると、それ以降のメモリ割り当て (例えば \fBmmap\fP(2), \fBbrk\fP(2))  は失敗する。
+.SH 関連項目
+\fBmmap\fP(2), \fBsetrlimit\fP(2), \fBshmctl\fP(2), \fBsysconf\fP(3), \fBproc\fP(5),
+\fBcapabilities\fP(7)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。