OSDN Git Service

be62dec9174f7f483f9beaeeb6dfe89bd3dd2687
[linuxjm/LDP_man-pages.git] / draft / 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 .\" Japanese Version Copyright (c) 2008  Akihiro MOTOKI
28 .\"         all rights reserved.
29 .\" Translated 2008-08-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.04
30 .\"
31 .TH SHM_OVERVIEW 7 2010-09-10 "Linux" "Linux Programmer's Manual"
32 .\"O .SH NAME
33 .SH 名前
34 .\"O shm_overview \- Overview of POSIX shared memory
35 shm_overview \- POSIX 共有メモリの概要
36 .\"O .SH DESCRIPTION
37 .SH 説明
38 .\"O The POSIX shared memory API allows processes to communicate information
39 .\"O by sharing a region of memory.
40 POSIX 共有メモリ API を使用すると、メモリのある領域を共有して、
41 プロセス間で情報をやり取りすることができる。
42
43 .\"O The interfaces employed in the API are:
44 この API では以下のインターフェースが採用されている。
45 .TP 15
46 .BR shm_open (3)
47 .\"O Create and open a new object, or open an existing object.
48 .\"O This is analogous to
49 .\"O .BR open (2).
50 .\"O The call returns a file descriptor for use by the other
51 .\"O interfaces listed below.
52 新しいオブジェクトを生成しオープンする、もしくは
53 既存のオブジェクトをオープンする。これは
54 .BR open (2)
55 と同じである。下記にある他のインターフェースで使用する
56 ファイルディスクリプタを返す。
57 .TP
58 .BR ftruncate (2)
59 .\"O Set the size of the shared memory object.
60 .\"O (A newly created shared memory object has a length of zero.)
61 共有メモリオブジェクトの大きさを設定する。
62 .TP
63 .BR mmap (2)
64 .\"O Map the shared memory object into the virtual address space
65 .\"O of the calling process.
66 呼び出したプロセスの仮想アドレス空間に共有メモリオブジェクトを
67 マップする。
68 .TP
69 .BR munmap (2)
70 .\"O Unmap the shared memory object from the virtual address space
71 .\"O of the calling process.
72 呼び出したプロセスの仮想アドレス空間から
73 共有メモリオブジェクトをアンマップする。
74 .TP
75 .BR shm_unlink (3)
76 .\"O Remove a shared memory object name.
77 共有メモリオブジェクト名を削除する。
78 .TP
79 .BR close (2)
80 .\"O Close the file descriptor allocated by
81 .\"O .BR shm_open (3)
82 .\"O when it is no longer needed.
83 .BR shm_open (3)
84 で割り当てられたファイルディスクリプタが不要になった際に、
85 そのファイルディスクリプタをクローズする。
86 .TP
87 .BR fstat (2)
88 .\"O Obtain a
89 .\"O .I stat
90 .\"O structure that describes the shared memory object.
91 .\"O Among the information returned by this call are the object's
92 .\"O size
93 .\"O .RI ( st_size ),
94 .\"O permissions
95 .\"O .RI ( st_mode ),
96 .\"O owner
97 .\"O .RI ( st_uid ),
98 .\"O and group
99 .\"O .RI ( st_gid ).
100 その共有メモリオブジェクトについての情報が入った
101 .I stat
102 構造体を取得する。
103 このシステムコールが返す情報には、オブジェクトのサイズ
104 .RI ( st_size )、
105 許可属性
106 .RI ( st_mode )、
107 所有者
108 .RI ( st_uid )、
109 グループ
110 .RI ( st_gid )
111 がある。
112 .TP
113 .BR fchown (2)
114 .\"O To change the ownership of a shared memory object.
115 共有メモリオブジェクトの所有権を変更する。
116 .TP
117 .BR fchmod (2)
118 .\"O To change the permissions of a shared memory object.
119 共有メモリオブジェクトの許可属性を変更する。
120 .\"O .SS Versions
121 .SS バージョン
122 .\"O POSIX shared memory is supported since Linux 2.4 and glibc 2.2.
123 POSIX 共有メモリは Linux 2.4 と glibc 2.2 以降でサポートされている。
124 .\"O .SS Persistence
125 .SS 持続性
126 .\"O POSIX shared memory objects have kernel persistence:
127 .\"O a shared memory object will exist until the system is shut down,
128 .\"O or until all processes have unmapped the object and it has been deleted with
129 .\"O .BR shm_unlink (3)
130 POSIX 共有メモリオブジェクトはカーネル内で保持される。
131 共有メモリオブジェクトは、システムがシャットダウンされるか、
132 全てのプロセスがそのオブジェクトをアンマップし、
133 .BR shm_unlink (3)
134 で削除されるまで、存在し続ける。
135 .\"O .SS Linking
136 .SS リンク
137 .\"O Programs using the POSIX shared memory API must be compiled with
138 .\"O .I cc \-lrt
139 .\"O to link against the real-time library,
140 .\"O .IR librt .
141 POSIX 共有メモリ API を使用したプログラムは
142 .I cc \-lrt
143 でコンパイルし、リアルタイムライブラリ
144 .I librt
145 とリンクしなければならない。
146 .\"O .SS Accessing shared memory objects via the file system
147 .SS ファイルシステム経由での共有メモリオブジェクトへのアクセス
148 .\"O On Linux, shared memory objects are created in a
149 .\"O .RI ( tmpfs )
150 .\"O virtual file system, normally mounted under
151 .\"O .IR /dev/shm .
152 .\"O Since kernel 2.6.19, Linux supports the use of access control lists (ACLs)
153 .\"O to control the permissions of objects in the virtual file system.
154 Linux では、共有メモリオブジェクトは通常
155 .I /dev/shm
156 以下にマウントされる仮想ファイルシステム
157 .RI ( tmpfs )
158 内に作成される。
159 カーネル 2.6.19 以降の Linux では、
160 仮想ファイルシステム内のオブジェクトの許可属性の制御に、
161 アクセス制御リスト (ACL; access control lists) を使うことができる。
162 .\"O .SH "CONFORMING TO"
163 .SH 準拠
164 POSIX.1-2001.
165 .\"O .SH NOTES
166 .SH 注意
167 .\"O Typically, processes must synchronize their access to a shared
168 .\"O memory object, using, for example, POSIX semaphores.
169 通常は、共有メモリオブジェクトにアクセスするプロセスは、
170 POSIX セマフォなどを使ってプロセス間で同期をとらなければならない。
171
172 .\"O System V shared memory
173 .\"O .RB ( shmget (2),
174 .\"O .BR shmop (2),
175 .\"O etc.) is an older shared memory API.
176 .\"O POSIX shared memory provides a simpler, and better designed interface;
177 .\"O on the other hand POSIX shared memory is somewhat less widely available
178 .\"O (especially on older systems) than System V shared memory.
179 System V 共有メモリ
180 .RB ( shmget (2),
181 .BR shmop (2)
182 など) は古い共有メモリ API である。
183 POSIX 共有メモリは、より簡単で、うまく設計されたインタフェースを提供している。
184 一方で、POSIX 共有メモリは System V 共有メモリと比べると
185 利用できるシステムが少ない (特に、古いシステムでは少ない)。
186 .\"O .SH "SEE ALSO"
187 .SH 関連項目
188 .BR fchmod (2),
189 .BR fchown (2),
190 .BR fstat (2),
191 .BR ftruncate (2),
192 .BR mmap (2),
193 .BR mprotect (2),
194 .BR munmap (2),
195 .BR shmget (2),
196 .BR shmop (2),
197 .BR shm_open (3),
198 .BR shm_unlink (3),
199 .BR sem_overview (7)