OSDN Git Service

2f89236a50e19bd31ac35167c72d2fed6224eb65
[linuxjm/LDP_man-pages.git] / release / man7 / shm_overview.7
1 .\" t
2 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\"
4 .\" Copyright (C) 2008, Linux Foundation, written by Michael Kerrisk
5 .\" <mtk.manpages@gmail.com>
6 .\"
7 .\" Permission is granted to make and distribute verbatim copies of this
8 .\" manual provided the copyright notice and this permission notice are
9 .\" preserved on all copies.
10 .\"
11 .\" Permission is granted to copy and distribute modified versions of this
12 .\" manual under the conditions for verbatim copying, provided that the
13 .\" entire resulting derived work is distributed under the terms of a
14 .\" permission notice identical to this one.
15 .\"
16 .\" Since the Linux kernel and libraries are constantly changing, this
17 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
18 .\" responsibility for errors or omissions, or for damages resulting from
19 .\" the use of the information contained herein.  The author(s) may not
20 .\" have taken the same level of care in the production of this manual,
21 .\" which is licensed free of charge, as they might when working
22 .\" professionally.
23 .\"
24 .\" Formatted or processed versions of this manual, if unaccompanied by
25 .\" the source, must acknowledge the copyright and authors of this work.
26 .\"
27 .\"*******************************************************************
28 .\"
29 .\" This file was generated with po4a. Translate the source file.
30 .\"
31 .\"*******************************************************************
32 .TH SHM_OVERVIEW 7 2010\-09\-10 Linux "Linux Programmer's Manual"
33 .SH 名前
34 shm_overview \- POSIX 共有メモリの概要
35 .SH 説明
36 POSIX 共有メモリ API を使用すると、メモリのある領域を共有して、 プロセス間で情報をやり取りすることができる。
37
38 この API では以下のインターフェースが採用されている。
39 .TP  15
40 \fBshm_open\fP(3)
41 新しいオブジェクトを生成しオープンする、もしくは 既存のオブジェクトをオープンする。これは \fBopen\fP(2)
42 と同じである。下記にある他のインターフェースで使用する ファイルディスクリプタを返す。
43 .TP 
44 \fBftruncate\fP(2)
45 共有メモリオブジェクトの大きさを設定する。
46 .TP 
47 \fBmmap\fP(2)
48 呼び出したプロセスの仮想アドレス空間に共有メモリオブジェクトを マップする。
49 .TP 
50 \fBmunmap\fP(2)
51 呼び出したプロセスの仮想アドレス空間から 共有メモリオブジェクトをアンマップする。
52 .TP 
53 \fBshm_unlink\fP(3)
54 共有メモリオブジェクト名を削除する。
55 .TP 
56 \fBclose\fP(2)
57 \fBshm_open\fP(3)  で割り当てられたファイルディスクリプタが不要になった際に、 そのファイルディスクリプタをクローズする。
58 .TP 
59 \fBfstat\fP(2)
60 その共有メモリオブジェクトについての情報が入った \fIstat\fP 構造体を取得する。 このシステムコールが返す情報には、オブジェクトのサイズ
61 (\fIst_size\fP)、 許可属性 (\fIst_mode\fP)、 所有者 (\fIst_uid\fP)、 グループ (\fIst_gid\fP)  がある。
62 .TP 
63 \fBfchown\fP(2)
64 共有メモリオブジェクトの所有権を変更する。
65 .TP 
66 \fBfchmod\fP(2)
67 共有メモリオブジェクトの許可属性を変更する。
68 .SS Versions
69 POSIX 共有メモリは Linux 2.4 と glibc 2.2 以降でサポートされている。
70 .SS 持続性
71 POSIX 共有メモリオブジェクトはカーネル内で保持される。 共有メモリオブジェクトは、システムがシャットダウンされるか、
72 全てのプロセスがそのオブジェクトをアンマップし、 \fBshm_unlink\fP(3)  で削除されるまで、存在し続ける。
73 .SS リンク
74 POSIX 共有メモリ API を使用したプログラムは \fIcc \-lrt\fP でコンパイルし、リアルタイムライブラリ \fIlibrt\fP
75 とリンクしなければならない。
76 .SS ファイルシステム経由での共有メモリオブジェクトへのアクセス
77 Linux では、共有メモリオブジェクトは通常 \fI/dev/shm\fP 以下にマウントされる仮想ファイルシステム (\fItmpfs\fP)
78 内に作成される。 カーネル 2.6.19 以降の Linux では、 仮想ファイルシステム内のオブジェクトの許可属性の制御に、 アクセス制御リスト
79 (ACL; access control lists) を使うことができる。
80 .SH 準拠
81 POSIX.1\-2001.
82 .SH 注意
83 通常は、共有メモリオブジェクトにアクセスするプロセスは、 POSIX セマフォなどを使ってプロセス間で同期をとらなければならない。
84
85 System V 共有メモリ (\fBshmget\fP(2), \fBshmop\fP(2)  など) は古い共有メモリ API である。 POSIX
86 共有メモリは、より簡単で、うまく設計されたインタフェースを提供している。 一方で、POSIX 共有メモリは System V 共有メモリと比べると
87 利用できるシステムが少ない (特に、古いシステムでは少ない)。
88 .SH 関連項目
89 \fBfchmod\fP(2), \fBfchown\fP(2), \fBfstat\fP(2), \fBftruncate\fP(2), \fBmmap\fP(2),
90 \fBmprotect\fP(2), \fBmunmap\fP(2), \fBshmget\fP(2), \fBshmop\fP(2), \fBshm_open\fP(3),
91 \fBshm_unlink\fP(3), \fBsem_overview\fP(7)