OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / draft / man2 / shmget.2
1 .\" Copyright (c) 1993 Luigi P. Bai (lpb@softint.com) July 28, 1993
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Modified Wed Jul 28 10:57:35 1993, Rik Faith <faith@cs.unc.edu>
24 .\" Modified Sun Nov 28 16:43:30 1993, Rik Faith <faith@cs.unc.edu>
25 .\"          with material from Giorgio Ciucci <giorgio@crcc.it>
26 .\" Portions Copyright 1993 Giorgio Ciucci <giorgio@crcc.it>
27 .\" Modified Tue Oct 22 22:03:17 1996 by Eric S. Raymond <esr@thyrsus.com>
28 .\" Modified, 8 Jan 2003, Michael Kerrisk, <mtk.manpages@gmail.com>
29 .\"     Removed EIDRM from errors - that can't happen...
30 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
31 .\"     Added notes on capability requirements
32 .\" Modified, 11 Nov 2004, Michael Kerrisk <mtk.manpages@gmail.com>
33 .\"     Language and formatting clean-ups
34 .\"     Added notes on /proc files
35 .\"
36 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
37 .\"         all rights reserved.
38 .\" Translated 1997-03-01, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
39 .\" Updated & Modified 2001-06-03, Yuichi SATO <ysato@h4.dion.ne.jp>
40 .\" Updated 2001-12-22, Kentaro Shirakata <argrath@ub32.org>
41 .\" Updated 2002-10-16, Kentaro Shirakata <argrath@ub32.org>
42 .\" Updated 2003-02-23, Kentaro Shirakata <argrath@ub32.org>
43 .\" Updated 2005-03-02, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
44 .\" Updated 2005-11-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
45 .\" Updated 2006-07-21, Akihiro MOTOKI, LDP v2.36
46 .\"
47 .\"WORD:        shared memory           ¶¦Í­¥á¥â¥ê
48 .\"WORD:        segment                 ¥»¥°¥á¥ó¥È
49 .\"WORD:        owner                   ½êÍ­¼Ô
50 .\"WORD:        group                   ¥°¥ë¡¼¥×
51 .\"WORD:        world                   Â¾¿Í
52 .\"WORD:        creator                 ºîÀ®¼Ô
53 .\"WORD:        super-user              ¥¹¡¼¥Ñ¡¼¡¦¥æ¡¼¥¶¡¼
54 .\"WORD:        detach                  ʬΥ
55 .\"WORD:        attach                  ÉÕ²Ã
56 .\"WORD:        identifier              ¼±ÊÌ»Ò
57 .\"WORD:        member                  ¥á¥ó¥Ð¡¼
58 .\"WORD:        effective user ID       ¼Â¸ú¥æ¡¼¥¶¡¼ID
59 .\"WORD:        effective group ID      ¼Â¸ú¥°¥ë¡¼¥×ID
60 .\"WORD:        policy                  Êý¿Ë
61 .\"WORD:        implement               ¼ÂÁõ
62 .\"
63 .TH SHMGET 2 2006-05-02 "Linux" "Linux Programmer's Manual"
64 .\"O .SH NAME
65 .SH Ì¾Á°
66 .\"O shmget \- allocates a shared memory segment
67 shmget \- ¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤ò³ä¤êÅö¤Æ¤ë
68 .\"O .SH SYNOPSIS
69 .SH ½ñ¼°
70 .ad l
71 .B #include <sys/ipc.h>
72 .br
73 .B #include <sys/shm.h>
74 .sp
75 .BI "int shmget(key_t " key ", size_t " size ", int " shmflg );
76 .ad b
77 .\"O .SH DESCRIPTION
78 .SH ÀâÌÀ
79 .\"O .BR shmget ()
80 .\"O returns the identifier of the shared memory segment
81 .\"O associated with the value of the argument
82 .\"O .IR key .
83 .\"O A new shared memory segment, with size equal to the value of
84 .\"O .I size
85 .\"O rounded up to a multiple of
86 .\"O .BR PAGE_SIZE ,
87 .\"O is created if
88 .\"O .I key
89 .\"O has the value
90 .\"O .B IPC_PRIVATE
91 .\"O or
92 .\"O .I key
93 .\"O isn't
94 .\"O .BR IPC_PRIVATE ,
95 .\"O no shared memory segment corresponding to
96 .\"O .I key
97 .\"O exists, and
98 .\"O .B IPC_CREAT
99 .\"O is specified in
100 .\"O .IR shmflg .
101 .BR shmget ()
102 ¤Ï
103 .I key
104 °ú¤­¿ô¤ËÂбþ¤¹¤ë¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤Î¼±Ê̻ҤòÊÖ¤¹¡£
105 .I key
106 ¤ÎÃͤ¬
107 .B IPC_PRIVATE
108 ¤Î¾ì¹ç¡¢¤â¤·¤¯¤Ï
109 .I key
110 ¤ËÂбþ¤¹¤ë¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤¬Â¸ºß¤»¤º¡¢
111 .I shmflg
112 ¤Ë
113 .B IPC_CREAT
114 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤¿¾ì¹ç¡¢
115 ¿·¤·¤¤¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤òºîÀ®¤¹¤ë¡£
116 ºîÀ®¤µ¤ì¤ë¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤Ï¡¢
117 .I size
118 °ú¤­¿ô¤ÎÃͤò
119 .B PAGE_SIZE
120 ¤ÎÇÜ¿ô¤Ø¤ÈÀÚ¤ê¾å¤²¤¿ (round up) Â礭¤µ¤È¤Ê¤ë¡£
121 .PP
122 .\"O If
123 .\"O .I shmflg
124 .\"O specifies both
125 .\"O .B IPC_CREAT
126 .\"O and
127 .\"O .B IPC_EXCL
128 .\"O and a shared memory segment already exists for
129 .\"O .IR key ,
130 .\"O then
131 .\"O .BR shmget ()
132 .\"O fails with
133 .\"O .I errno
134 .\"O set to
135 .\"O .BR EEXIST .
136 .\"O (This is analogous to the effect of the combination
137 .\"O .B O_CREAT | O_EXCL
138 .\"O for
139 .\"O .BR open (2).)
140 .I shmflg
141 ¤Ë
142 .B IPC_CREAT
143 ¤È
144 .B IPC_EXCL
145 ¤ÎξÊý¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢
146 .I key
147 ¤ËÂбþ¤¹¤ë¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤¬´û¤Ë¸ºß¤¹¤ë¤È¡¢
148 .BR shmget ()
149 ¤Ï¼ºÇÔ¤·¡¢
150 .I errno
151 ¤Ë
152 .B EEXIST
153 ¤¬ÀßÄꤵ¤ì¤ë (¤³¤ì¤Ï
154 .BR open (2)
155 ¤Ë
156 .B O_CREAT | O_EXCL
157 ¤ò»ØÄꤷ¤¿¾ì¹ç¤ÎÆ°ºî¤ÈƱ¤¸¤Ç¤¢¤ë)¡£
158 .PP
159 .\"O The value
160 .\"O .I shmflg
161 .\"O is composed of:
162 .I shmflg
163 ¤Ï°Ê²¼¤ÎÆâÍƤ«¤é¹½À®¤µ¤ì¤ë:
164 .TP 12
165 .B IPC_CREAT
166 .\"O to create a new segment.
167 .\"O If this flag is not used, then
168 .\"O .BR shmget ()
169 .\"O will find the segment associated with \fIkey\fP and check to see if
170 .\"O the user has permission to access the segment.
171 ¿·¤·¤¤¥»¥°¥á¥ó¥È¤òºîÀ®¤¹¤ë¡£¤³¤Î¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¡¢
172 .BR shmget ()
173 ¤Ï \fIkey\fP ¤ËÂбþ¤¹¤ë¥»¥°¥á¥ó¥È¤òõ¤·¡¢
174 ¥æ¡¼¥¶¤¬¤½¤Î¥»¥°¥á¥ó¥È¤Ë¥¢¥¯¥»¥¹¤¹¤ëµö²Ä¤¬¤¢¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
175 .TP
176 .B IPC_EXCL
177 .\"O used with \fBIPC_CREAT\fP to ensure failure if the segment already exists.
178 \fBIPC_CREAT\fP ¤È¶¦¤Ë»ÈÍѤ·¡¢¥»¥°¥á¥ó¥È¤¬´û¤Ë¸ºß¤·¤¿¾ì¹ç¤Ë¤Ï
179 ¼ºÇÔ¤¹¤ë¤³¤È¤òÊݾڤ¹¤ë¡£
180 .TP
181 .I mode_flags
182 .\"O (least significant 9 bits)
183 (²¼°Ì 9 ¥Ó¥Ã¥È)
184 .\"O specifying the permissions granted to the owner, group, and world.
185 .\"O These bits have the same format, and the same
186 .\"O meaning, as the
187 .\"O .I mode
188 .\"O argument of
189 .\"O .BR open (2).
190 .\"O Presently, the execute permissions are not used by the system.
191 ½êÍ­¼Ô¡¢¥°¥ë¡¼¥×¡¢Â¾¿Í (world) ¤Ø¤Îµö²Ä¤ò»ØÄꤹ¤ë¡£
192 ¤³¤ì¤é¤Î¥Ó¥Ã¥È¤Ï
193 .BR open (2)
194 ¤Î
195 .I mode
196 °ú¤­¿ô¤ÈƱ¤¸·Á¼°¤ÇƱ¤¸°ÕÌ£¤ò»ý¤Ä¡£
197 º£¤Î¤È¤³¤í¡¢¥·¥¹¥Æ¥à¤Ï¼Â¹Ô (execute) µö²Ä¤ò»²¾È¤·¤Ê¤¤¡£
198 .TP
199 .\"O .BR SHM_HUGETLB " (since Linux 2.6)"
200 .BR SHM_HUGETLB " (Linux 2.6 °Ê¹ß)"
201 .\"O Allocate the segment using "huge pages."
202 .\"O See the kernel source file
203 .\"O .I Documentation/vm/hugetlbpage.txt
204 .\"O for further information.
205 "¥Ò¥å¡¼¥¸¥Ú¡¼¥¸ (huge page)" ¤ò»È¤¦¥»¥°¥á¥ó¥È¤ò³ä¤êÅö¤Æ¤ë¡£
206 ¾ÜºÙ¤Ê¾ðÊó¤Ï¡¢¥«¡¼¥Í¥ë¡¦¥½¡¼¥¹¤Î¥Õ¥¡¥¤¥ë
207 .I Documentation/vm/hugetlbpage.txt
208 ¤ò»²¾È¡£
209 .TP
210 .\"O .BR SHM_NORESERVE " (since Linux 2.6.15)"
211 .BR SHM_NORESERVE " (Linux 2.6.15 °Ê¹ß)"
212 .\"O This flag serves the same purpose as the
213 .\"O .BR mmap (2)
214 .\"O .B MAP_NORESERVE
215 .\"O flag.
216 ¤³¤Î¥Õ¥é¥°¤Ï¡¢
217 .BR mmap (2)
218 ¤Î
219 .B MAP_NORESERVE
220 ¥Õ¥é¥°¤ÈƱ¤¸Ìò³ä¤ò²Ì¤¿¤¹¡£
221 .\"O Do not reserve swap space for this segment.
222 .\"O When swap space is reserved, one has the guarantee
223 .\"O that it is possible to modify the segment.
224 .\"O When swap space is not reserved one might get
225 .\"O .B SIGSEGV
226 .\"O upon a write
227 .\"O if no physical memory is available.
228 ¤³¤Î¥»¥°¥á¥ó¥È¤ËÂФ¹¤ë¥¹¥ï¥Ã¥×¶õ´Ö¤ÎͽÌó¤ò¹Ô¤ï¤Ê¤¤¡£
229 ¥¹¥ï¥Ã¥×¶õ´Ö¤òͽÌó¤·¤¿¾ì¹ç¤Ï¡¢¤½¤Î¥»¥°¥á¥ó¥È¤ÎÊѹ¹¤¬É¬¤ºÀ®¸ù¤¹¤ë¤³¤È¤¬
230 Êݾڤµ¤ì¤ë¡£¥¹¥ï¥Ã¥×¶õ´Ö¤ÎͽÌó¤ò¹Ô¤ï¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï¡¢ÊªÍý¥á¥â¥ê¤Ë¶õ¤­¤¬
231 ¤Ê¤¤¤È½ñ¤­¹þ¤ß»þ¤Ë
232 .B SIGSEGV
233 ¤ò¼õ¤±¼è¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
234 .\"O See also the discussion of the file
235 .\"O .I /proc/sys/vm/overcommit_memory
236 .\"O in
237 .\"O .BR proc (5).
238 .BR proc (5)
239 ¤Ë¤¢¤ë
240 .I /proc/sys/vm/overcommit_memory
241 ¥Õ¥¡¥¤¥ë¤Ë´Ø¤¹¤ëµÄÏÀ¤â»²¾È¤Î¤³¤È¡£
242 .\" As at 2.6.17-rc2, this flag has no effect if SHM_HUGETLB was also
243 .\" specified.
244 .PP
245 .\"O When a new shared memory segment is created,
246 .\"O its contents are initialized to zero values, and
247 .\"O its associated data structure,
248 .\"O .I shmid_ds
249 .\"O (see
250 .\"O .BR shmctl (2)),
251 .\"O is initialized as follows:
252 ¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤¬¿·¤¿¤ËºîÀ®¤µ¤ì¤ëºÝ¡¢
253 ¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤ÎÆâÍƤϠ0 ¤Ç½é´ü²½¤µ¤ì¡¢
254 ´ØÏ¢¾ðÊó¤òÊÝ»ý¤¹¤ë¥Ç¡¼¥¿¹½Â¤ÂÎ
255 .I shmid_ds
256 ¤Ï°Ê²¼¤Î¤è¤¦¤Ë½é´ü²½¤µ¤ì¤ë¡£
257 .IP
258 .\"O .I shm_perm.cuid
259 .\"O and
260 .\"O .I shm_perm.uid
261 .\"O are set to the effective user ID of the calling process.
262 .I shm_perm.cuid
263 ¤È
264 .I shm_perm.uid
265 ¤Ë¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¼Â¸ú (effective) ¥æ¡¼¥¶¡¼ID ¤òÀßÄꤹ¤ë¡£
266 .IP
267 .\"O .I shm_perm.cgid
268 .\"O and
269 .\"O .I shm_perm.gid
270 .\"O are set to the effective group ID of the calling process.
271 .I shm_perm.cgid
272 ¤È
273 .I shm_perm.gid
274 ¤Ë¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¼Â¸ú¥°¥ë¡¼¥×ID ¤òÀßÄꤹ¤ë¡£
275 .IP
276 .\"O The least significant 9 bits of
277 .\"O .I shm_perm.mode
278 .\"O are set to the least significant 9 bit of
279 .\"O .IR shmflg .
280 .I shm_perm.mode
281 ¤Î²¼°Ì 9 ¥Ó¥Ã¥È¤Ë
282 .I shmflg
283 ¤Î²¼°Ì 9 ¥Ó¥Ã¥È¤òÀßÄꤹ¤ë¡£
284 .IP
285 .\"O .I shm_segsz
286 .\"O is set to the value of
287 .\"O .IR size .
288 .I shm_segsz
289 ¤Ë
290 .I size
291 ¤ÎÃͤòÀßÄꤹ¤ë¡£
292 .IP
293 .\"O .IR shm_lpid ,
294 .\"O .IR shm_nattch ,
295 .\"O .I shm_atime
296 .\"O and
297 .\"O .I shm_dtime
298 .\"O are set to 0.
299 .IR shm_lpid ,
300 .IR shm_nattch ,
301 .IR shm_atime ,
302 .I shm_dtime
303 ¤Ë 0 ¤òÀßÄꤹ¤ë¡£
304 .IP
305 .\"O .I shm_ctime
306 .\"O is set to the current time.
307 .I shm_ctime
308 ¤Ë¸½ºß¤Î»þ¹ï¤òÀßÄꤹ¤ë¡£
309 .PP
310 .\"O If the shared memory segment already exists, the permissions are
311 .\"O verified, and a check is made to see if it is marked for destruction.
312 ¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤¬´û¤Ë¸ºß¤¹¤ë¾ì¹ç¡¢¥¢¥¯¥»¥¹µö²Ä¤Î¸¡ºº¤È¡¢
313 Ç˲õ (destruction) ¥Þ¡¼¥¯¤¬¤Ä¤±¤é¤ì¤Æ¤¤¤Ê¤¤¤«¤Î¥Á¥§¥Ã¥¯¤¬¹Ô¤ï¤ì¤ë¡£
314 .\"O .SH "RETURN VALUE"
315 .SH ÊÖ¤êÃÍ
316 .\"O A valid segment identifier,
317 .\"O .IR shmid ,
318 .\"O is returned on success, \-1 on error.
319 À®¸ù¤·¤¿¾ì¹ç¡¢Í­¸ú¤Ê¥»¥°¥á¥ó¥È¼±ÊÌ»Ò
320 .I shmid
321 ¤¬ÊÖ¤µ¤ì¤ë¡£¥¨¥é¡¼¤Î¾ì¹ç¡¢ \-1 ¤¬ÊÖ¤µ¤ì¤ë¡£
322 .\"O .SH ERRORS
323 .SH ¥¨¥é¡¼
324 .\"O On failure,
325 .\"O .I errno
326 .\"O is set to one of the following:
327 ¼ºÇÔ¤·¤¿¾ì¹ç¤Ï
328 .I errno
329 ¤¬°Ê²¼¤Î¤É¤ì¤«¤ËÀßÄꤵ¤ì¤ë:
330 .TP
331 .B EACCES
332 .\"O The user does not have permission to access the
333 .\"O shared memory segment, and does not have the
334 .\"O .B CAP_IPC_OWNER
335 .\"O capability.
336 ¥æ¡¼¥¶¡¼¤Ï¤½¤Î¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤Ø¤Î¥¢¥¯¥»¥¹µö²Ä¤ò»ý¤¿¤º¡¢
337 .B CAP_IPC_OWNER
338 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤â»ý¤Ã¤Æ¤¤¤Ê¤¤¡£
339 .TP
340 .B EEXIST
341 .\"O .B IPC_CREAT | IPC_EXCL
342 .\"O was specified and the segment exists.
343 .B IPC_CREAT | IPC_EXCL
344 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤¿¤¬¡¢¤½¤Î¥»¥°¥á¥ó¥È¤¬´û¤Ë¸ºß¤¹¤ë¡£
345 .TP
346 .B EINVAL
347 .\"O A new segment was to be created and \fIsize\fP < \fBSHMMIN\fP
348 .\"O or \fIsize\fP > \fBSHMMAX\fP, or no new segment was to be created,
349 .\"O a segment with given key existed, but \fIsize\fP is greater than the size
350 .\"O of that segment.
351 ¿·¤·¤¤¥»¥°¥á¥ó¥È¤òºîÀ®¤·¤è¤¦¤È¤·¤¿ºÝ¤Ë
352 \fIsize\fP < \fBSHMMIN\fP ¤Þ¤¿¤Ï \fIsize\fP > \fBSHMMAX\fP ¤Ç¤¢¤Ã¤¿¡£
353 ¤â¤·¤¯¤Ï¡¢»ØÄꤵ¤ì¤¿¥­¡¼¤ËÂбþ¤¹¤ë¥»¥°¥á¥ó¥È¤¬´û¤Ë¸ºß¤·¤Æ¡¢¿·¤·¤¤
354 ¥»¥°¥á¥ó¥È¤òºîÀ®¤·¤è¤¦¤È¤Ï¤·¤Ê¤«¤Ã¤¿¤¬¡¢\fIsize\fP ¤¬Â¸ºß¤¹¤ë¥»¥°¥á¥ó¥È¤Î
355 ¥µ¥¤¥º¤è¤ê¤âÂ礭¤«¤Ã¤¿¡£
356 .TP
357 .B ENFILE
358 .\"O .\" [2.6.7] shmem_zero_setup()-->shmem_file_setup()-->get_empty_filp()
359 .\"O The system limit on the total number of open files has been reached.
360 .\" [2.6.7] shmem_zero_setup()-->shmem_file_setup()-->get_empty_filp()
361 ¥·¥¹¥Æ¥àÁ´ÂΤǥª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤ÎÁí¿ô¤¬¾å¸Â¤Ë㤷¤¿¡£
362 .TP
363 .B ENOENT
364 .\"O No segment exists for the given \fIkey\fP, and
365 .\"O .B IPC_CREAT
366 .\"O was not specified.
367 »ØÄꤵ¤ì¤¿ \fIkey\fP ¤ËÂбþ¤¹¤ë¥»¥°¥á¥ó¥È¤¬Â¸ºß¤»¤º¡¢
368 .B IPC_CREAT
369 ¤â»ØÄꤵ¤ì¤Æ¤¤¤Ê¤«¤Ã¤¿¡£
370 .TP
371 .B ENOMEM
372 .\"O No memory could be allocated for segment overhead.
373 ¥»¥°¥á¥ó¥È¤Î´ÉÍý¾ðÊó (overhead) ¤Ë³ä¤êÅö¤Æ¤ë¥á¥â¥ê¤¬¤Ê¤«¤Ã¤¿¡£
374 .TP
375 .B ENOSPC
376 .\"O All possible shared memory ID's have been taken
377 .\"O .RB ( SHMMNI ),
378 .\"O or allocating a segment of the requested
379 .\"O .I size
380 .\"O would cause the system to exceed the system-wide limit on shared memory
381 .\"O .RB ( SHMALL ).
382 .\" motoki 2005-03-02 -- SHMMNI ¤Î°ÕÌ£¤ò¹Íθ¤·¤Æ°ÕÌõ
383 ¥·¥¹¥Æ¥àÁ´ÂΤζ¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¿ô¤ÎÀ©¸Â
384 .RB ( SHMMNI )
385 ¤Ë㤷¤¿¡¢¤Þ¤¿¤ÏÍ׵ᤵ¤ì¤¿
386 .I size
387 ¤Î¥»¥°¥á¥ó¥È¤Î³ä¤êÅö¤Æ¤¬
388 ¥·¥¹¥Æ¥àÁ´ÂΤζ¦Í­¥á¥â¥ê¥µ¥¤¥º¤ÎÀ©¸Â
389 .RB ( SHMALL )
390 ¤òĶ²á¤·¤¿¡£
391 .TP
392 .B EPERM
393 .\"O The
394 .\"O .B SHM_HUGETLB
395 .\"O flag was specified, but the caller was not privileged (did not have the
396 .\"O .B CAP_IPC_LOCK
397 .\"O capability).
398 .B SHM_HUGETLB
399 ¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤¿¤¬¡¢¸Æ¤Ó½Ð¤·¸µ¤Ë¤Ï¸¢¸Â¤¬¤Ê¤«¤Ã¤¿
400 .RB ( CAP_IPC_LOCK
401 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ã¤Æ¤¤¤Ê¤«¤Ã¤¿)¡£
402 .\"O .SH "CONFORMING TO"
403 .SH ½àµò
404 SVr4, POSIX.1-2001.
405 .\"O .\" SVr4 documents an additional error condition EEXIST.
406 .\" SVr4 ¤Ë¤ÏÄɲäǠEEXIST ¥¨¥é¡¼¾õÂ֤ε­½Ò¤¬¤¢¤ë¡£
407
408 .\"O .B SHM_HUGETLB
409 .\"O is a nonportable Linux extension.
410 .B SHM_HUGETLB
411 ¤Ï Linux ¤Ç¤Î³ÈÄ¥¤Ç¤¢¤ê¡¢°Ü¿¢À­¤Ï¤Ê¤¤¡£
412 .\"O .SH NOTES
413 .SH Ãí°Õ
414 .\"O .B IPC_PRIVATE
415 .\"O isn't a flag field but a
416 .\"O .I key_t
417 .\"O type.
418 .B IPC_PRIVATE
419 ¤Ï¥Õ¥é¥°¤Ç¤Ï¤Ê¤¯
420 .I key_t
421 ·¿¤Ç¤¢¤ë¡£
422 .\"O If this special value is used for
423 .\"O .IR key ,
424 .\"O the system call ignores everything but the least significant 9 bits of
425 .\"O .I shmflg
426 .\"O and creates a new shared memory segment (on success).
427 ¤³¤ÎÆÃÊ̤ÊÃͤ¬
428 .I key
429 ¤Ë»ÈÍѤµ¤ì¤¿¾ì¹ç¤Ï¡¢
430 .BR shmget ()
431 ¤Ï
432 .I shmflg
433 ¤Î²¼°Ì 9 ¥Ó¥Ã¥È¤ò½ü¤¤¤¿Á´¤Æ¤ò̵»ë¤·¡¢
434 (À®¸ù¤¹¤ì¤Ð) ¿·¤·¤¤¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤òºîÀ®¤¹¤ë¡£
435 .PP
436 .\"O The following limits on shared memory segment resources affect the
437 .\"O .BR shmget ()
438 .\"O call:
439 .BR shmget ()
440 ¥³¡¼¥ë¤Ë±Æ¶Á¤¹¤ë¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È»ñ¸»¤ÎÀ©¸Â¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¢¤ë:
441 .TP
442 .B SHMALL
443 .\"O System wide maximum of shared memory pages
444 .\"O (on Linux, this limit can be read and modified via
445 .\"O .IR /proc/sys/kernel/shmall ).
446 ¥·¥¹¥Æ¥àÁ´ÂΤζ¦Í­¥á¥â¥ê¡¦¥Ú¡¼¥¸¤ÎºÇÂç¿ô
447 (Linux ¤Ç¤Ï¡¢¤³¤Î¾å¸ÂÃͤÏ
448 .I /proc/sys/kernel/shmall
449 ·Ðͳ¤Ç»²¾È¤·¤¿¤ê¡¢Êѹ¹¤·¤¿¤ê¤Ç¤­¤ë)¡£
450 .TP
451 .B SHMMAX
452 .\"O Maximum size in bytes for a shared memory segment: policy dependent
453 .\"O (on Linux, this limit can be read and modified via
454 .\"O .IR /proc/sys/kernel/shmmax ).
455 ¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤Î¥Ð¥¤¥Èñ°Ì¤ÎÂ礭¤µ¤Î¾å¸Â: Êý¿Ë°Í¸
456 (Linux ¤Ç¤Ï¡¢¤³¤Î¾å¸ÂÃͤÏ
457 .I /proc/sys/kernel/shmmax
458 ·Ðͳ¤Ç»²¾È¤·¤¿¤ê¡¢Êѹ¹¤·¤¿¤ê¤Ç¤­¤ë)¡£
459 .TP
460 .B SHMMIN
461 .\"O Minimum size in bytes for a shared memory segment: implementation
462 .\"O dependent (currently 1 byte, though
463 .\"O .B PAGE_SIZE
464 .\"O is the effective minimum size).
465 ¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤Î¥Ð¥¤¥Èñ°Ì¤ÎÂ礭¤µ¤Î²¼¸Â: ¼ÂÁõ°Í¸
466 (¸½ºß¤Ï 1 ¥Ð¥¤¥È¤À¤¬¡¢¼Â¼ÁŪ¤ÊºÇ¾®¥µ¥¤¥º¤Ï
467 .B PAGE_SIZE
468 ¤Ç¤¢¤ë)¡£
469 .TP
470 .B SHMMNI
471 .\"O System wide maximum number of shared memory segments: implementation
472 .\"O dependent (currently 4096, was 128 before Linux 2.3.99;
473 .\"O on Linux, this limit can be read and modified via
474 .\"O .IR /proc/sys/kernel/shmmni ).
475 .\"O .\" Kernels between 2.4.x and 2.6.8 had an off-by-one error that meant
476 .\"O .\" that we could create one more segment than SHMMNI -- MTK
477 .\"O .\" This /proc file is not available in Linux 2.2 and earlier -- MTK
478 ¥·¥¹¥Æ¥àÁ´ÂΤζ¦Í­¥á¥â¥ê¡¼¤Î¿ô¤Î¾å¸Â: ¼ÂÁõ°Í¸
479 (¸½ºß¤Ï 4096¡£Linux 2.3.99 ¤è¤êÁ°¤Ç¤Ï 128¡£
480 Linux ¤Ç¤Ï¡¢¤³¤Î¾å¸ÂÃͤÏ
481 .I /proc/sys/kernel/shmmni
482 ·Ðͳ¤Ç»²¾È¤·¤¿¤ê¡¢Êѹ¹¤·¤¿¤ê¤Ç¤­¤ë)¡£
483 .\" 2.4.x ¤È 2.6.8 ¤Î´Ö¤Î¥«¡¼¥Í¥ë¤Ë¤Ï¡¢SHMMNI ¤è¤ê°ì¤Ä¤Î¿¤¯¤Î
484 .\" ¥»¥°¥á¥ó¥È¤òºîÀ®¤Ç¤­¤ë¤È¤¤¤¦¥Ð¥°¤¬¤¢¤Ã¤¿¡£
485 .\" ¤³¤Î /proc ¥Õ¥¡¥¤¥ë¤Ï Linux 2.2 °ÊÁ°¤Ç¤ÏÍøÍѤǤ­¤Ê¤¤ -- MTK
486 .PP
487 .\"O The implementation has no specific limits for the per-process maximum
488 .\"O number of shared memory segments
489 .\"O .RB ( SHMSEG ).
490 ¥×¥í¥»¥¹Åö¤ê¤Î¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤Î¸Ä¿ô¤ÎºÇÂçÃÍ
491 .RB ( SHMSEG )
492 ¤Ë´Ø¤¹¤ë¼ÂÁõ¾å¤ÎÀ©¸Â¤Ï¤Ê¤¤¡£
493 .\"O .SS LINUX NOTES
494 .\"O Until version 2.3.30 Linux would return
495 .\"O .B EIDRM
496 .\"O for a
497 .\"O .BR shmget ()
498 .\"O on a shared memory segment scheduled for deletion.
499 .SS Linux ¤Ç¤ÎÃí°Õ
500 ¥Ð¡¼¥¸¥ç¥ó 2.3.30 ¤Þ¤Ç¤Ï¡¢Linux ¤Ï
501 ºï½ü¤¬Í½Äꤵ¤ì¤Æ¤¤¤ë¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤ËÂФ·¤Æ
502 .BR shmget ()
503 ¤¬¹Ô¤ï¤ì¤ë¤È
504 .B EIDRM
505 ¤òÊÖ¤·¤Æ¤¤¤¿¡£
506 .\"O .SH BUGS
507 .SH ¥Ð¥°
508 .\"O The name choice
509 .\"O .B IPC_PRIVATE
510 .\"O was perhaps unfortunate,
511 .\"O .B IPC_NEW
512 .\"O would more clearly show its function.
513 .B IPC_PRIVATE
514 ¤È¤¤¤¦Ì¾Á°¤òÁª¤ó¤À¤Î¤Ï¤ª¤½¤é¤¯¼ºÇԤǤ¢¤í¤¦¡£
515 .B IPC_NEW
516 ¤ÎÊý¤¬¤è¤êÌÀ³Î¤Ë¤½¤Îµ¡Ç½¤òɽ¤·¤Æ¤¤¤ë¤À¤í¤¦¡£
517 .\"O .SH "SEE ALSO"
518 .SH ´ØÏ¢¹àÌÜ
519 .BR shmat (2),
520 .BR shmctl (2),
521 .BR shmdt (2),
522 .BR ftok (3),
523 .BR capabilities (7),
524 .BR shm_overview (7),
525 .BR svipc (7)