.\" t .\" Copyright (C) 2008, Linux Foundation, written by Michael Kerrisk .\" .\" .\" %%%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. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2008 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2008-08-21, Akihiro MOTOKI , LDP v3.04 .\" .TH SHM_OVERVIEW 7 2010\-09\-10 Linux "Linux Programmer's Manual" .SH 名前 shm_overview \- POSIX 共有メモリーの概要 .SH 説明 POSIX 共有メモリー API を使用すると、メモリーのある領域を共有して、 プロセス間で情報をやり取りすることができる。 この API では以下のインターフェースが採用されている。 .TP 15 \fBshm_open\fP(3) 新しいオブジェクトを生成しオープンする、もしくは 既存のオブジェクトをオープンする。これは \fBopen\fP(2) と同じである。下記にある他のインターフェースで使用する ファイルディスクリプターを返す。 .TP \fBftruncate\fP(2) 共有メモリーオブジェクトの大きさを設定する。 .TP \fBmmap\fP(2) 呼び出したプロセスの仮想アドレス空間に共有メモリーオブジェクトを マップする。 .TP \fBmunmap\fP(2) 呼び出したプロセスの仮想アドレス空間から 共有メモリーオブジェクトをアンマップする。 .TP \fBshm_unlink\fP(3) 共有メモリーオブジェクト名を削除する。 .TP \fBclose\fP(2) \fBshm_open\fP(3) で割り当てられたファイルディスクリプターが不要になった際に、 そのファイルディスクリプターをクローズする。 .TP \fBfstat\fP(2) その共有メモリーオブジェクトについての情報が入った \fIstat\fP 構造体を取得する。 このシステムコールが返す情報には、オブジェクトのサイズ (\fIst_size\fP)、 許可属性 (\fIst_mode\fP)、 所有者 (\fIst_uid\fP)、 グループ (\fIst_gid\fP) がある。 .TP \fBfchown\fP(2) 共有メモリーオブジェクトの所有権を変更する。 .TP \fBfchmod\fP(2) 共有メモリーオブジェクトの許可属性を変更する。 .SS Versions POSIX 共有メモリーは Linux 2.4 と glibc 2.2 以降でサポートされている。 .SS 持続性 POSIX 共有メモリーオブジェクトはカーネル内で保持される。 共有メモリーオブジェクトは、システムがシャットダウンされるか、 全てのプロセスがそのオブジェクトをアンマップし、 \fBshm_unlink\fP(3) で削除されるまで、存在し続ける。 .SS リンク POSIX 共有メモリー API を使用したプログラムは \fIcc \-lrt\fP でコンパイルし、リアルタイムライブラリ \fIlibrt\fP とリンクしなければならない。 .SS ファイルシステム経由での共有メモリーオブジェクトへのアクセス Linux では、共有メモリーオブジェクトは通常 \fI/dev/shm\fP 以下にマウントされる仮想ファイルシステム (\fItmpfs\fP) 内に作成される。 カーネル 2.6.19 以降の Linux では、 仮想ファイルシステム内のオブジェクトの許可属性の制御に、 アクセス制御リスト (ACL; access control lists) を使うことができる。 .SH 準拠 POSIX.1\-2001. .SH 注意 通常は、共有メモリーオブジェクトにアクセスするプロセスは、 POSIX セマフォなどを使ってプロセス間で同期をとらなければならない。 System V 共有メモリー (\fBshmget\fP(2), \fBshmop\fP(2) など) は古い共有メモリー API である。 POSIX 共有メモリーは、より簡単で、うまく設計されたインターフェースを提供している。 一方で、POSIX 共有メモリーは System V 共有メモリーと比べると 利用できるシステムが少ない (特に、古いシステムでは少ない)。 .SH 関連項目 \fBfchmod\fP(2), \fBfchown\fP(2), \fBfstat\fP(2), \fBftruncate\fP(2), \fBmmap\fP(2), \fBmprotect\fP(2), \fBmunmap\fP(2), \fBshmget\fP(2), \fBshmop\fP(2), \fBshm_open\fP(3), \fBshm_unlink\fP(3), \fBsem_overview\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。