.\" Updated 2013-05-06, Akihiro MOTOKI <amotoki@gmail.com>
.\" Updated 2013-07-24, Akihiro MOTOKI <amotoki@gmail.com>
.\"
-.TH SHMGET 2 2014\-04\-17 Linux "Linux Programmer's Manual"
+.TH SHMGET 2 2014\-05\-21 Linux "Linux Programmer's Manual"
.SH 名前
shmget \- System V 共有メモリ・セグメントを割り当てる
.SH 書式
\fBint shmget(key_t \fP\fIkey\fP\fB, size_t \fP\fIsize\fP\fB, int \fP\fIshmflg\fP\fB);\fP
.ad b
.SH 説明
-\fBshmget\fP() は \fIkey\fP 引き数に対応する System V 共有メモリ・セグメントの識別子を返す。 \fIkey\fP の値が
+\fBshmget\fP() は \fIkey\fP 引き数に対応する System\ V 共有メモリ・セグメントの識別子を返す。 \fIkey\fP の値が
\fBIPC_PRIVATE\fP の場合、もしくは \fIkey\fP に対応する共有メモリ・セグメントが存在せず、 \fIshmflg\fP に
\fBIPC_CREAT\fP が指定されていた場合、 新しい共有メモリ・セグメントを作成する。 作成される共有メモリ・セグメントは、 \fIsize\fP
引き数の値を \fBPAGE_SIZE\fP の倍数へと切り上げた (round up) 大きさとなる。
ユーザがそのセグメントにアクセスする許可があるかどうかをチェックする。
.TP
\fBIPC_EXCL\fP
-\fBIPC_CREAT\fP と共に使用し、セグメントが既に存在した場合には 失敗することを保証する。
-.TP
-\fImode_flags\fP
-(下位 9 ビット) 所有者、グループ、他人 (world) への許可を指定する。 これらのビットは \fBopen\fP(2) の \fImode\fP
-引き数と同じ形式で同じ意味を持つ。 今のところ、システムは実行 (execute) 許可を参照しない。
+This flag is used with \fBIPC_CREAT\fP to ensure that this call creates the
+segment. If the segment already exists, the call fails.
.TP
\fBSHM_HUGETLB\fP (Linux 2.6 以降)
"ヒュージページ (huge page)" を使うセグメントを割り当てる。詳細な情報は、Linux カーネルソースのファイル
保証される。スワップ空間の予約を行わなかった場合は、物理メモリに空きが ないと書き込み時に \fBSIGSEGV\fP を受け取る可能性がある。
\fBproc\fP(5) にある \fI/proc/sys/vm/overcommit_memory\fP ファイルに関する議論も参照のこと。
.PP
+In addition to the above flags, the least significant 9 bits of \fIshmflg\fP
+specify the permissions granted to the owner, group, and others. These bits
+have the same format, and the same meaning, as the \fImode\fP argument of
+\fBopen\fP(2). Presently, execute permissions are not used by the system.
+.PP
共有メモリ・セグメントが新たに作成される際、 共有メモリ・セグメントの内容は 0 で初期化され、 関連情報を保持するデータ構造体 \fIshmid_ds\fP
は以下のように初期化される。
.IP
ユーザーはその共有メモリ・セグメントへのアクセス許可を持たず、 \fBCAP_IPC_OWNER\fP ケーパビリティも持っていない。
.TP
\fBEEXIST\fP
-\fBIPC_CREAT | IPC_EXCL\fP が指定されていたが、そのセグメントが既に存在する。
+\fBIPC_CREAT\fP and \fBIPC_EXCL\fP were specified in \fIshmflg\fP, but a shared
+memory segment already exists for \fIkey\fP.
+.TP
+\fBEINVAL\fP
+A new segment was to be created and \fIsize\fP is less than \fBSHMIN\fP or greater
+than \fBSHMMAX\fP.
.TP
\fBEINVAL\fP
-新しいセグメントを作成しようとした際に \fIsize\fP < \fBSHMMIN\fP または \fIsize\fP > \fBSHMMAX\fP
-であった。 もしくは、指定されたキーに対応するセグメントが既に存在して、新しい セグメントを作成しようとはしなかったが、\fIsize\fP
-が存在するセグメントの サイズよりも大きかった。
+(The call did not create a new segment and) a segment for the given \fIkey\fP
+exists, but \fIsize\fP is greater than the size of that segment.
.TP
\fBENFILE\fP
.\" [2.6.7] shmem_zero_setup()-->shmem_file_setup()-->get_empty_filp()
.\" SVr4 documents an additional error condition EEXIST.
SVr4, POSIX.1\-2001.
-\fBSHM_HUGETLB\fP は Linux での拡張であり、移植性はない。
+\fBSHM_HUGETLB\fP and \fBSHM_NORESERVE\fP are Linux extensions.
.SH 注意
.\" Like Linux, the FreeBSD man pages still document
.\" the inclusion of these header files.
のインクルードは必要ない。しかしながら、いくつかの古い実装ではこれらのヘッダファイルのインクルードが必要であり、 SVID
でもこれらのインクルードをするように記載されている。このような古いシステムへの移植性を意図したアプリケーションではこれらのファイルをインクルードする必要があるかもしれない。
-\fBIPC_PRIVATE\fP はフラグではなく \fIkey_t\fP 型である。 この特別な値が \fIkey\fP に使用された場合は、 \fBshmget\fP()
-は \fIshmflg\fP の下位 9 ビットを除いた全てを無視し、 (成功すれば) 新しい共有メモリ・セグメントを作成する。
-.PP
+.\"
+\fBIPC_PRIVATE\fP isn't a flag field but a \fIkey_t\fP type. If this special
+value is used for \fIkey\fP, the system call ignores all but the least
+significant 9 bits of \fIshmflg\fP and creates a new shared memory segment.
+.SS "Shared memory limits"
\fBshmget\fP() コールに影響する共有メモリ・セグメント資源の制限は以下の通りである:
.TP
\fBSHMALL\fP
-システム全体の共有メモリ・ページの最大数。 Linux 2.2 以降では、この上限値のデフォルトは以下である。
+System\-wide limit on the number of shared memory pages. Since Linux 2.4,
+the default value for this limit is
SHMMAX / PAGE_SIZE * (SHMMNI / 16)
-4kB ページサイズと仮定すると、 (Linux 2.4 以降では) この式の結果は 2^20 (2,097,152) になる。
+If \fBSHMMAX\fP and \fBSHMMNI\fP are not modified, this yields a limit for the
+total memory used by all shared memory segments of 8 GB: With a 4kB page
+size, this formula yields the value 2^21 (2,097,152), with 8kB page size, it
+yields 2^20 (1048576).
Linux では、この上限値は \fI/proc/sys/kernel/shmall\fP 経由で参照したり、変更したりできる。
.TP
共有メモリ・セグメントのバイト単位の大きさの下限: 実装依存 (現在は 1 バイトだが、実質的な最小サイズは \fBPAGE_SIZE\fP である)。
.TP
\fBSHMMNI\fP
-システム全体の共有メモリ・セグメントの最大数。 この上限値のデフォルトは、 Linux 2.2 以降では 128、 Linux 2.4 以降で 4096
-である。
+System\-wide limit on the number of shared memory segments. In Linux 2.2,
+the default value for this limit was 128; since Linux 2.4, the default value
+is 4096.
.\" Kernels between 2.4.x and 2.6.8 had an off-by-one error that meant
.\" that we could create one more segment than SHMMNI -- MTK
\fBshmat\fP(2), \fBshmctl\fP(2), \fBshmdt\fP(2), \fBftok\fP(3), \fBcapabilities\fP(7),
\fBshm_overview\fP(7), \fBsvipc\fP(7)
.SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部
である。プロジェクトの説明とバグ報告に関する情報は
http://www.kernel.org/doc/man\-pages/ に書かれている。