OSDN Git Service

Update drafts for LDP 3.67
[linuxjm/LDP_man-pages.git] / draft / man2 / shmop.2
index 86bf390..113f76d 100644 (file)
@@ -1,5 +1,6 @@
 .\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
@@ -19,6 +20,7 @@
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
 .\" Modified Sun Nov 28 17:06:19 1993, Rik Faith (faith@cs.unc.edu)
 .\"          with material from Luigi P. Bai (lpb@softint.com)
 .\"            of segments marked for destruction
 .\"
 .\" FIXME . Add an example program to this page.
-.\" FIXME Linux 2.6.9 added SHM_EXEC, which should be documented
+.\"
 .\"*******************************************************************
 .\"
 .\" This file was generated with po4a. Translate the source file.
 .\"
 .\"*******************************************************************
-.TH SHMOP 2 2008\-06\-03 Linux "Linux Programmer's Manual"
+.\"
+.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
+.\"         all rights reserved.
+.\" Translated 1999-08-15, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
+.\" Updated & Modified 2002-05-07, Yuichi SATO <ysato@h4.dion.ne.jp>
+.\" Updated & Modified 2003-01-18, Yuichi SATO <ysato444@yahoo.co.jp>
+.\" Updated & Modified 2005-01-07, Yuichi SATO
+.\" Updated 2005-12-05, Akihiro MOTOKI, Catch up to LDP man-pages 2.16
+.\" Updated 2006-04-14, Akihiro MOTOKI, Catch up to LDP man-pages 2.29
+.\" Updated 2013-03-26, Akihiro MOTOKI <amotoki@gmail.com>
+.\" Updated 2013-05-01, Akihiro MOTOKI <amotoki@gmail.com>
+.\" Updated 2013-07-24, Akihiro MOTOKI <amotoki@gmail.com>
+.\"
+.TH SHMOP 2 2014\-04\-28 Linux "Linux Programmer's Manual"
 .SH 名前
-shmat, shmdt \- 共有メモリ (shared memory) の操作
+shmat, shmdt \- System V 共有メモリ (shared memory) の操作
 .SH 書式
 .nf
 \fB#include <sys/types.h>\fP
@@ -54,23 +69,37 @@ shmat, shmdt \- 共有メモリ (shared memory) の操作
 \fBint shmdt(const void *\fP\fIshmaddr\fP\fB);\fP
 .fi
 .SH 説明
-\fBshmat\fP()  は \fIshmid\fP で指定された共有メモリ・セグメント (shared memory segment) を
-コールしたプロセスのアドレス空間に付加 (attach) する。 付加するアドレスは \fIshmaddr\fP に以下のどれかの形式で指定する:
-.LP
+.SS shmat()
+\fBshmat\fP()  は \fIshmid\fP で指定された System\ V 共有メモリ・セグメント (shared memory segment)
+を コールしたプロセスのアドレス空間に付加 (attach) する。 付加するアドレスは \fIshmaddr\fP に以下のどれかの形式で指定する:
+.IP * 3
 \fIshmaddr\fP が NULL ならば、システムはセグメントを付加するための 適切な (使用されていない) アドレスを選択する。
-.LP
+.IP *
 \fIshmaddr\fP が NULL でなく \fBSHM_RND\fP が \fIshmflg\fP に指定されている場合は、 \fIshmaddr\fP を
-\fBSHMLBA\fP の倍数へと切り捨てた (rounding down) のと等しいアドレスへ付加する。 その他の場合は \fIshmaddr\fP
-は付加を行なうアドレスで、ページ境界を指している必要がある。
-.PP
-\fBSHM_RDONLY\fP が \fIshmflg\fP に指定されていた場合は、 セグメントは読み込み専用に付加され、プロセスはそのセグメントへの
-読み込み許可を持たなければならない。 そうでなければそのセグメントは読み込みと書き込みのために付加され、
-プロセスはそのセグメントに読み込みと書き込みの許可を持つ必要がある。 書き込み専用の共有メモリ・セグメントという概念は存在しない。
+\fBSHMLBA\fP の倍数へと切り捨てた (rounding down) のと等しいアドレスへ付加する。
+.IP *
+その他の場合は \fIshmaddr\fP は付加を行なうアドレスで、ページ境界を指している必要がある。
 .PP
-(Linux 特有の)  \fBSHM_REMAP\fP フラグが \fIshmflg\fP に指定された場合は、
-セグメントのマッピングを既存のマッピングに置き換える。 マッピングの範囲は、 \fIshmaddr\fP から始まりセグメントのサイズ分だけある (通常
-\fBEINVAL\fP エラーは、このアドレス範囲にマッピングが既に存在するために起る)。 このフラグを指定する場合は、 \fIshmaddr\fP が NULL
-であってはならない。
+In addition to \fBSHM_RND\fP, the following flags may be specified in the
+\fIshmflg\fP bit\-mask argument:
+.TP 
+\fBSHM_EXEC\fP (Linux 固有; Linux 2.6.9 以降)
+Allow the contents of the segment to be executed.  The caller must have
+execute permission on the segment.
+.TP 
+\fBSHM_RDONLY\fP
+Attach the segment for read\-only access.  The process must have read
+permission for the segment.  If this flag is not specified, the segment is
+attached for read and write access, and the process must have read and write
+permission for the segment.  There is no notion of a write\-only shared
+memory segment.
+.TP 
+\fBSHM_REMAP\fP (Linux 固有)
+This flag specifies that the mapping of the segment should replace any
+existing mapping in the range starting at \fIshmaddr\fP and continuing for the
+size of the segment.  (Normally, an \fBEINVAL\fP error would result if a
+mapping already exists in this address range.)  In this case, \fIshmaddr\fP
+must not be NULL.
 .PP
 呼び出したプロセスの \fBbrk\fP(2)  の値は付加によって変化しない。 そのセグメントはプロセスが終了 (exit) したら自動的に分離
 (detach) される。 同じセグメントをプロセスのアドレス空間に、読み込み専用および読み書き両用 として付加でき、また複数回付加することもできる。
@@ -82,8 +111,9 @@ shmat, shmdt \- 共有メモリ (shared memory) の操作
 .IP
 \fIshm_lpid\fP には呼び出したプロセスのプロセス ID が設定される。
 .IP
+.\"
 \fIshm_nattch\fP を 1 増加させる。
-.PP
+.SS shmdt()
 \fBshmdt\fP()  は呼び出したプロセスのアドレス空間から \fIshmaddr\fP で指定されたアドレスに配置された共有メモリ・セグメントを分離
 (detach) する。 分離する共有メモリ・セグメントは、現在 \fIshmaddr\fP に付加されているものでなければならない。 \fIshmaddr\fP
 は、それを付加した時に \fBshmat\fP()  が返した値に等しくなければならない。
@@ -95,12 +125,6 @@ shmat, shmdt \- 共有メモリ (shared memory) の操作
 \fIshm_lpid\fP には呼び出したプロセスのプロセス ID が設定される。
 .IP
 \fIshm_nattch\fP を 1 減少させる。 もし 0 になり、削除マークがあった場合は そのセグメントは削除される。
-.PP
-\fBfork\fP(2)  した後、子プロセスは付加された共有メモリ・セグメントを継承する。
-
-\fBexec\fP(2)  した後、全ての付加された共有メモリ・セグメントはプロセスから分離される。
-
-\fBexit\fP(2)  において、全ての付加された共有メモリ・セグメントはプロセスから分離される。
 .SH 返り値
 \fBshmat\fP()  は、成功した場合、 付加された共有メモリ・セグメントのアドレスを返す。 エラーの場合、 \fI(void\ *)\ \-1\fP
 を返し、 \fIerrno\fP にエラーの原因を示す値を設定する。
@@ -112,6 +136,9 @@ shmat, shmdt \- 共有メモリ (shared memory) の操作
 \fBEACCES\fP
 呼び出したプロセスに要求された種類の付加に必要な許可がなく、 \fBCAP_IPC_OWNER\fP ケーパビリティ (capability) がない。
 .TP 
+\fBEIDRM\fP
+\fIshmid\fP が削除 (remove) された識別子 (identifier) を指している。
+.TP 
 \fBEINVAL\fP
 \fIshmid\fP の値が不正である。 \fIshmaddr\fP の値が境界違反 (unaligned) (つまり、ページ境界に合っておらず、
 \fBSHM_RND\fP が指定されていない) または が不正である。 \fIshmaddr\fP へのセグメントの付加に失敗した。 または
@@ -129,10 +156,17 @@ shmat, shmdt \- 共有メモリ (shared memory) の操作
 .\" SVr4 documents an additional error condition EMFILE.
 SVr4, POSIX.1\-2001.
 
-SVID 3 で (たぶんそれより前だと思うが)  \fIshmaddr\fP 引き数の型は \fIchar *\fP から \fIconst void *\fP
-に、\fIshmat\fP() の返り値の型は \fIchar *\fP から \fIvoid *\fP に変更された (Linux では libc4 と libc5
-のプロトタイプは \fIchar *\fP であり、glibc2 のプロトタイプは \fIvoid *\fP である)。
+SVID 3 で (たぶんそれより前だと思うが)  \fIshmaddr\fP 引き数の型は \fIchar\ *\fP から \fIconst void\ *\fP
+に、\fIshmat\fP() の返り値の型は \fIchar\ *\fP から \fIvoid\ *\fP に変更された (Linux では libc4 と libc5
+のプロトタイプは \fIchar\ *\fP であり、glibc2 のプロトタイプは \fIvoid\ *\fP である)。
 .SH 注意
+.PP
+\fBfork\fP(2)  した後、子プロセスは付加された共有メモリ・セグメントを継承する。
+
+\fBexec\fP(2)  した後、全ての付加された共有メモリ・セグメントはプロセスから分離される。
+
+\fBexit\fP(2)  において、全ての付加された共有メモリ・セグメントはプロセスから分離される。
+
 共有メモリセグメントを付加する場合の移植性の高い方法としては、 \fIshmaddr\fP を NULL にして \fBshmat\fP()  を使用するのがよい。
 このような方法で付加される共有メモリセグメントは、 プロセスが異なれば別のアドレスに付加される、という点に注意すること。
 よって共有メモリ内で管理されるポインタは、 絶対アドレスではなく、 (一般的にはセグメントの開始アドレスからの)  相対アドレスで作成するべきである。
@@ -154,3 +188,7 @@ POSIX.1\-2001 ではこのような動作を指定しておらず、 他の多
 .SH 関連項目
 \fBbrk\fP(2), \fBmmap\fP(2), \fBshmctl\fP(2), \fBshmget\fP(2), \fBcapabilities\fP(7),
 \fBshm_overview\fP(7), \fBsvipc\fP(7)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。