OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / draft / man3 / shm_open.3
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) 2002 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" FIXME . Add an example to this page
26 .\"
27 .\" Japanese Version Copyright (c) 2002 Akihiro MOTOKI, all rights reserved.
28 .\" Translated Mon Feb  2 2003 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
29 .\" Updated 2009-02-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.19
30 .\"
31 .TH SHM_OPEN 3 2009-02-25 "Linux" "Linux Programmer's Manual"
32 .\"O .SH NAME
33 .SH Ì¾Á°
34 .\"O shm_open, shm_unlink \- Create/open or unlink POSIX shared memory objects
35 shm_open, shm_unlink \- POSIX ¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ÎºîÀ®/¥ª¡¼¥×¥ó¡¢
36 ºï½ü¤ò¹Ô¤¦
37 .\"O .SH SYNOPSIS
38 .SH ½ñ¼°
39 .B #include <sys/mman.h>
40 .br
41 .\"O .BR "#include <sys/stat.h>" "        /* For mode constants */"
42 .BR "#include <sys/stat.h>" "        /* mode Äê¿ôÍÑ */"
43 .br
44 .\"O .BR "#include <fcntl.h>" "           /* For O_* constants */"
45 .BR "#include <fcntl.h>" "           /* O_* Äê¿ô¤ÎÄêµÁÍÑ */"
46 .sp
47 .BI "void * shm_open(const char *" name ", int " oflag ", mode_t " mode );
48 .sp
49 .BI "int shm_unlink(const char *" name );
50 .sp
51 .\"O Link with \fI\-lrt\fP.
52 \fI\-lrt\fP ¤Ç¥ê¥ó¥¯¤¹¤ë¡£
53 .\"O .SH DESCRIPTION
54 .SH ÀâÌÀ
55 .\"O .BR shm_open ()
56 .\"O creates and opens a new, or opens an existing, POSIX shared memory object.
57 .\"O A POSIX shared memory object is in effect a handle which can
58 .\"O be used by unrelated processes to
59 .\"O .BR mmap (2)
60 .\"O the same region of shared memory.
61 .BR shm_open ()
62 ¤Ï¡¢POSIX ¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ò¿·µ¬¤ËºîÀ®/¥ª¡¼¥×¥ó¤·¤¿¤ê¡¢
63 ¤¹¤Ç¤Ë¸ºß¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤ò¥ª¡¼¥×¥ó¤·¤¿¤ê¤¹¤ë¡£
64 POSIX ¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Ï¡¢¼ÂºÝ¤Ë¤Ï¡¢´Ø·¸¤Î¤Ê¤¤¥×¥í¥»¥¹¤¬
65 ¶¦Í­¥á¥â¥ê¤ÎƱ¤¸Îΰè¤ò
66 .BR mmap (2)
67 ¤¹¤ë¤¿¤á¤Ë»ÈÍѤ¹¤ë¤³¤È¤¬¤Ç¤­¤ë¼êÃʤǤ¢¤ë¡£
68 .\"O The
69 .\"O .BR shm_unlink ()
70 .\"O function performs the converse operation,
71 .\"O removing an object previously created by
72 .\"O .BR shm_open ().
73 .BR shm_unlink ()
74 ¤Ï¡¢µÕ¤ÎÁàºî¡¢¤Ä¤Þ¤ê°ÊÁ°¤Ë
75 .BR shm_open ()
76 ¤ÇºîÀ®¤µ¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Îºï½ü¤ò¹Ô¤¦¡£
77 .LP
78 .\"O The operation of
79 .\"O .BR shm_open ()
80 .\"O is analogous to that of
81 .\"O .BR open (2).
82 .BR shm_open ()
83 ¤ÎÆ°ºî¤Ï
84 .BR open (2)
85 ¤È¤è¤¯»÷¤Æ¤¤¤ë¡£
86 .\"O .I name
87 .\"O specifies the shared memory object to be created or opened.
88 .\"O For portable use,
89 .\"O a shared memory object should be identified by a name of the form
90 .\"O .IR /somename ;
91 .\"O that is, a null-terminated string of up to
92 .\"O .BI NAME_MAX
93 .\"O (i.e., 255) characters consisting of an initial slash,
94 .I name
95 ¤ÇºîÀ®¤·¤¿¤ê¥ª¡¼¥×¥ó¤·¤¿¤ê¤¹¤ë¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ò»ØÄꤹ¤ë¡£
96 °Ü¿¢À­¤ò»ý¤¿¤»¤ë¤¿¤á¤Ë¤Ï¡¢¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Ï
97 .I /somename
98 ¤È¤¤¤¦·Á¼°¤Î̾Á°¤Ç¼±Ê̤·¡¢
99 ¤½¤Î̾Á°¤Ï¡¢ºÇÂç¤Ç
100 .B NAME_MAX
101 (¤¹¤Ê¤ï¤Á 255) Ê¸»ú¤Î NULL ½ªÃ¼¤µ¤ì¤¿Ê¸»úÎó¤Ç¡¢
102 .\" glibc allows the initial slash to be omitted, and makes
103 .\" multiple initial slashes equivalent to a single slash.
104 .\" This differs from the implementation of POSIX message queues.
105 .\"O followed by one or more characters, none of which are slashes.
106 ¥¹¥é¥Ã¥·¥å¤Ç»Ï¤Þ¤ê¡¢¥¹¥é¥Ã¥·¥å°Ê³°¤Îʸ»ú¤¬ 1 Ê¸»ú°Ê¾å³¤¯·Á¼°
107 ¤Ë¤¹¤Ù¤­¤Ç¤¢¤ë¡£
108 .\" glibc allows subdirectory components in the name, in which
109 .\" case the subdirectory must exist under /dev/shm, and allow the
110 .\" required permissions if a user wants to create a shared memory
111 .\" object in that subdirectory.
112 .LP
113 .\"O .I oflag
114 .\"O is a bit mask created by ORing together exactly one of
115 .\"O .B O_RDONLY
116 .\"O or
117 .\"O .B O_RDWR
118 .\"O and any of the other flags listed here:
119 .I oflag
120 ¤Ï¥Ó¥Ã¥È¥Þ¥¹¥¯¤Ç¡¢
121 .B O_RDONLY
122 ¤È
123 .B O_RDWR
124 ¤Î¤¤¤º¤ì¤«°ìÊý¤È¡¢°Ê²¼¤Ë½Ò¤Ù¤ë¾¤Î¥Õ¥é¥°¤ÎÏÀÍýϤò¤È¤Ã¤¿¤â¤Î
125 ¤ò»ØÄꤹ¤ë¡£
126 .TP 1.1i
127 .B O_RDONLY
128 .\"O Open the object for read access.
129 .\"O A shared memory object opened in this way can only be
130 .\"O .BR mmap (2)ed
131 .\"O for read (\fBPROT_READ\fP) access.
132 Æɤ߽Ф·¥¢¥¯¥»¥¹ÍѤ˥ª¥Ö¥¸¥§¥¯¥È¤ò¥ª¡¼¥×¥ó¤¹¤ë¡£
133 ¤³¤Î¥Õ¥é¥°¤ò»ØÄꤷ¤Æ¥ª¡¼¥×¥ó¤µ¤ì¤¿¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Ï¡¢
134 Æɤ߽Ф· (\fBPROT_READ\fP) ¥¢¥¯¥»¥¹¤Ç¤Î¤ß
135 .BR mmap (2)
136 ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
137 .TP
138 .B O_RDWR
139 .\"O Open the object for read-write access.
140 Æɤ߽ñ¤­¥¢¥¯¥»¥¹ÍѤ˥ª¥Ö¥¸¥§¥¯¥È¤ò¥ª¡¼¥×¥ó¤¹¤ë¡£
141 .TP
142 .B O_CREAT
143 .\"O Create the shared memory object if it does not exist.
144 ¸ºß¤·¤Ê¤¤¾ì¹ç¡¢¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤¹¤ë¡£
145 .\"O The user and group ownership of the object are taken
146 .\"O from the corresponding effective IDs of the calling process,
147 .\"O .\" In truth it is actually the file system IDs on Linux, but these
148 .\"O .\" are nearly always the same as the effective IDs.  (MTK, Jul 05)
149 .\"O and the object's
150 .\"O permission bits are set according to the low-order 9 bits of
151 .\"O .IR mode ,
152 .\"O except that those bits set in the process file mode
153 .\"O creation mask (see
154 .\"O .BR umask (2))
155 .\"O are cleared for the new object.
156 ¥ª¥Ö¥¸¥§¥¯¥È¤Î¥æ¡¼¥¶¤È¥°¥ë¡¼¥×¤Î½êÍ­¸¢¤Ï¡¢
157 ¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤ÎÂбþ¤¹¤ë¼Â¸ú ID ¤¬»È¤ï¤ì¡¢
158 .\" ËÜÅö¤Ï¡¢Linux ¤Ç¤Ï¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à ID ¤¬»È¤ï¤ì¤ë¤Î¤À¤¬¡¢
159 .\" ¤½¤ÎÃͤϤۤȤó¤É¤¤¤Ä¤â¼Â¸ú ID ¤ÈƱ¤¸¤Ç¤¢¤ë¡£ (MTK, Jul 05)
160 ¥ª¥Ö¥¸¥§¥¯¥È¤Îµö²Ä¥Ó¥Ã¥È¤Ï
161 .I mode
162 ¤Î²¼°Ì 9 ¥Ó¥Ã¥È¤Ë´ð¤Å¤¤¤ÆÀßÄꤵ¤ì¤ë¡£¤¿¤À¤·¡¢
163 ¥Õ¥¡¥¤¥ë¥â¡¼¥ÉºîÀ®¥Þ¥¹¥¯
164 .RB ( umask (2)
165 »²¾È) ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ëÃͤϡ¢¿·µ¬¥ª¥Ö¥¸¥§¥¯¥È¤Ë´Ø¤·¤Æ¤Ï¥¯¥ê¥¢¤µ¤ì¤ë¡£
166 .\"O A set of macro constants which can be used to define
167 .\"O .I mode
168 .\"O is listed in
169 .\"O .BR open (2).
170 .\"O (Symbolic definitions of these constants can be obtained by including
171 .\"O .IR <sys/stat.h> .)
172 .I mode
173 ¤òÄêµÁ¤¹¤ë¤¿¤á¤Ë»ÈÍѤǤ­¤ë¥Þ¥¯¥íÄê¿ô(·²)¤Ï
174 .BR open (2)
175 ¤Ëµ­ºÜ¤µ¤ì¤Æ¤¤¤ë
176 (¤³¤ì¤é¤ÎÄê¿ô¤Î¥·¥ó¥Ü¥ëÄêµÁ¤Ï
177 .I <sys/stat.h>
178 ¤Î¥¤¥ó¥¯¥ë¡¼¥É¤Ë¤è¤êÆÀ¤é¤ì¤ë)¡£
179 .sp
180 .\"O A new shared memory object initially has zero length \(em the size of the
181 .\"O object can be set using
182 .\"O .BR ftruncate (2).
183 .\"O The newly-allocated bytes of a shared memory
184 .\"O object are automatically initialized to 0.
185 ¿·µ¬¤ËºîÀ®¤µ¤ì¤¿¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ÏŤµ 0 ¤Ç½é´ü²½¤µ¤ì¤ë¡£
186 ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÂ礭¤µ¤Ï
187 .BR ftruncate (2)
188 ¤ò»È¤Ã¤ÆÀßÄê¤Ç¤­¤ë¡£
189 ¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ¿·µ¬¤Ë³ÎÊݤµ¤ì¤¿¥Ð¥¤¥È¤Ï¼«Æ°Åª¤Ë
190 0 ¤Ë½é´ü²½¤µ¤ì¤ë¡£
191 .TP
192 .B O_EXCL
193 .\"O If
194 .\"O .B O_CREAT
195 .\"O was also specified, and a shared memory object with the given
196 .\"O .I name
197 .\"O already exists, return an error.
198 .\"O The check for the existence of the object, and its creation if it
199 .\"O does not exist, are performed atomically.
200 .B O_CREAT
201 ¤¬°ì½ï¤Ë»ØÄꤵ¤ì¤Æ¤ª¤ê¡¢
202 .I name
203 ¤Ç»ØÄꤵ¤ì¤¿¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤¬´û¤Ë¸ºß¤·¤¿¾ì¹ç¡¢
204 ¥¨¥é¡¼¤òÊÖ¤¹¡£
205 ¥ª¥Ö¥¸¥§¥¯¥È¤Î¸ºß³Îǧ¤È¡¢Â¸ºß¤·¤Ê¤«¤Ã¤¿¾ì¹ç¤Î¥ª¥Ö¥¸¥§¥¯¥ÈºîÀ®¤Ï¡¢
206 ɬ¤º°ìÏ¢¤ÎÁàºî¤È¤·¤Æ¼Â¹Ô¤µ¤ì¤ë (performed atomically)¡£
207 .TP
208 .B O_TRUNC
209 .\"O If the shared memory object already exists, truncate it to zero bytes.
210 ¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤¬¤¹¤Ç¤Ë¸ºß¤·¤¿¾ì¹ç¡¢
211 ¤½¤Î¥ª¥Ö¥¸¥§¥¯¥È¤ò 0 ¥Ð¥¤¥È¤ËÀÚ¤êµÍ¤á¤ë¡£
212 .LP
213 .\"O Definitions of these flag values can be obtained by including
214 .\"O .IR <fcntl.h> .
215 ¤³¤ì¤é¤Î¥Õ¥é¥°ÃͤÎÄêµÁ¤Ï
216 .I <fcntl.h>
217 ¤Î¥¤¥ó¥¯¥ë¡¼¥É¤Ë¤è¤êÆÀ¤é¤ì¤ë¡£
218 .LP
219 .\"O On successful completion
220 .\"O .BR shm_open ()
221 .\"O returns a new file descriptor referring to the shared memory object.
222 .\"O This file descriptor is guaranteed to be the lowest-numbered file descriptor
223 .\"O not previously opened within the process.
224 .\"O The
225 .\"O .B FD_CLOEXEC
226 .\"O flag (see
227 .\"O .BR fcntl (2))
228 .\"O is set for the file descriptor.
229 À®¸ù¤·¤Æ´°Î»¤·¤¿¾ì¹ç¡¢
230 .BR shm_open ()
231 ¤Ï¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ò»²¾È¤¹¤ë¿·¤·¤¤¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤òÊÖ¤¹¡£
232 ¤³¤Î¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï¡¢¤½¤Î¥×¥í¥»¥¹Æâ¤Ç²áµî¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤Ê¤¤
233 ¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ÎÃæ¤ÇºÇ¤â¾®¤µ¤Ê¿ô¤Ë¤Ê¤ë¤³¤È¤¬Êݾڤµ¤ì¤ë¡£
234 .B FD_CLOEXEC
235 ¥Õ¥é¥°
236 .RB ( fcntl (2)
237 ¤ò»²¾È) ¤¬¡¢¤³¤Î¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ËÀßÄꤵ¤ì¤ë¡£
238 .PP
239 .\"O The file descriptor is normally used in subsequent calls
240 .\"O to
241 .\"O .BR ftruncate (2)
242 .\"O (for a newly created object) and
243 .\"O .BR mmap (2).
244 .\"O After a call to
245 .\"O .BR mmap (2)
246 .\"O the file descriptor may be closed without affecting the memory mapping.
247 Ä̾¤³¤ì¤é¤Î¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï¡¢¤³¤Î¸å³¤±¤Æ¼Â¹Ô¤µ¤ì¤ë
248 .BR ftruncate (2)
249 (¿·µ¬¤ËºîÀ®¤µ¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Î¾ì¹ç¤Î¤ß) ¤È
250 .BR mmap (2)
251 ¤Î¸Æ¤Ó½Ð¤·¤Ë»ÈÍѤµ¤ì¤ë¡£
252 .BR mmap (2)
253 ¤ò¸Æ¤Ó½Ð¤·¤¿¸å¤Ï¡¢¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ò¥¯¥í¡¼¥º¤·¤Æ¤â¤è¤¯¡¢
254 ¥¯¥í¡¼¥º¤·¤Æ¤â¥á¥â¥ê¡¦¥Þ¥Ã¥Ô¥ó¥°¤Ë±Æ¶Á¤òÍ¿¤¨¤ë¤³¤È¤Ï¤Ê¤¤¡£
255 .PP
256 .\"O The operation
257 .\"O of
258 .\"O .BR shm_unlink ()
259 .\"O is analogous to
260 .\"O .BR unlink (2):
261 .\"O it removes a shared memory object name, and, once all processes
262 .\"O have unmapped the object, de-allocates and
263 .\"O destroys the contents of the associated memory region.
264 .BR shm_unlink ()
265 ¤ÎÆ°ºî¤Ï
266 .BR unlink (2)
267 ¤È¤è¤¯»÷¤Æ¤¤¤ë:
268 ¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È̾¤òºï½ü¤·¡¢¤¹¤Ù¤Æ¤Î¥×¥í¥»¥¹¤¬½èÍýÂоݤÎ
269 ¥ª¥Ö¥¸¥§¥¯¥È¤ò¥¢¥ó¥Þ¥Ã¥×¤·¤¿»þÅÀ¤Ç¥ª¥Ö¥¸¥§¥¯¥È¤Î³ä¤êÅö¤Æ¤ò²ò½ü¤·¡¢
270 Âбþ¤¹¤ë¥á¥â¥êÎΰè¤ÎÆâÍƤòÇË´þ¤¹¤ë¡£
271 .\"O After a successful
272 .\"O .BR shm_unlink (),
273 .\"O attempts to
274 .\"O .BR shm_open ()
275 .\"O an object with the same
276 .\"O .I name
277 .\"O will fail (unless
278 .\"O .B O_CREAT
279 .\"O was specified, in which case a new, distinct object is created).
280 .BR shm_unlink ()
281 ¤¬À®¸ù¤·¤¿¸å¤Ç¡¢Æ±¤¸
282 .I name
283 ¤ò»ý¤Ä¥ª¥Ö¥¸¥§¥¯¥È¤ËÂФ·¤Æ
284 .BR shm_open ()
285 ¤ò¹Ô¤¦¤È¡¢
286 .RB ( O_CREAT
287 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç) ¼ºÇÔ¤¹¤ë¡£
288 .RB ( O_CREAT
289 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢¿·¤·¤¯Ê̤Υª¥Ö¥¸¥§¥¯¥È¤¬ºîÀ®¤µ¤ì¤ë)¡£
290 .\"O .SH "RETURN VALUE"
291 .SH ÊÖ¤êÃÍ
292 .\"O On success,
293 .\"O .BR shm_open ()
294 .\"O returns a nonnegative file descriptor.
295 .\"O On failure,
296 .\"O .B shm_open ()
297 .\"O returns \-1.
298 .\"O .BR shm_unlink ()
299 .\"O returns 0 on success, or \-1 on error.
300 À®¸ù¤·¤¿¾ì¹ç¡¢
301 .BR shm_open ()
302 ¤ÏÈóÉé¤Î¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤òÊÖ¤¹¡£
303 ¼ºÇÔ¤·¤¿¾ì¹ç¡¢
304 .BR shm_open ()
305 ¤Ï \-1 ¤òÊÖ¤¹¡£
306 .BR shm_unlink ()
307 ¤Ï¡¢À®¸ù¤·¤¿¾ì¹ç 0 ¤ò¡¢¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¾ì¹ç \-1 ¤òÊÖ¤¹¡£
308 .\"O .SH ERRORS
309 .SH ¥¨¥é¡¼
310 .\"O On failure,
311 .\"O .I errno
312 .\"O is set to indicate the cause of the error.
313 .\"O Values which may appear in
314 .\"O .I errno
315 .\"O include the following:
316 ¼ºÇÔ¤·¤¿¾ì¹ç¡¢¥¨¥é¡¼¤Î¸¶°ø¤ò¼¨¤¹¤¿¤á
317 .I errno
318 ¤¬ÀßÄꤵ¤ì¤ë¡£
319 .I errno
320 ¤ËÀßÄꤵ¤ì¤ëÃͤϰʲ¼¤ÎÄ̤ê¤Ç¤¢¤ë:
321 .TP
322 .B EACCES
323 .\"O Permission to
324 .\"O .BR shm_unlink ()
325 .\"O the shared memory object was denied.
326 ¶¦Í­¥á¥â¥ê¥ª¥Ö¥¸¥§¥¯¥È¤ò
327 .BR shm_unlink ()
328 ¤¹¤ë¸¢¸Â¤¬¤Ê¤«¤Ã¤¿¡£
329 .TP
330 .B EACCES
331 .\"O Permission was denied to
332 .\"O .BR shm_open ()
333 .\"O .I name
334 .\"O in the specified
335 .\"O .IR mode ,
336 .\"O or
337 .\"O .B O_TRUNC
338 .\"O was specified and the caller does not have write permission on the object.
339 »ØÄꤵ¤ì¤¿
340 .I mode
341 ¤Ç
342 .I name
343 ¤ò
344 .BR shm_open ()
345 ¤¹¤ë¸¢¸Â¤¬¤Ê¤«¤Ã¤¿¡£¤â¤·¤¯¤Ï¡¢
346 .B O_TRUNC
347 ¤¬»ØÄꤵ¤ì¤¿¤¬¡¢¸Æ¤Ó½Ð¤·¸µ¤Ë¤Ï¤½¤Î¥ª¥Ö¥¸¥§¥¯¥È¤ËÂФ¹¤ë½ñ¤­¹þ¤ß¸¢¸Â¤¬
348 ¤Ê¤«¤Ã¤¿¡£
349 .TP
350 .B EEXIST
351 .\"O Both
352 .\"O .B O_CREAT
353 .\"O and
354 .\"O .B O_EXCL
355 .\"O were specified to
356 .\"O .BR shm_open ()
357 .\"O and the shared memory object specified by
358 .\"O .I name
359 .\"O already exists.
360 .B O_CREAT
361 ¤È
362 .B O_EXCL
363 ¤ÎξÊý¤¬
364 .BR shm_open ()
365 ¤Ë»ØÄꤵ¤ì¤¿¤¬¡¢
366 .I name
367 ¤Ç»ØÄꤵ¤ì¤¿¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤¬´û¤Ë¸ºß¤·¤¿¡£
368 .TP
369 .B EINVAL
370 .\"O The
371 .\"O .I name
372 .\"O argument to
373 .\"O .BR shm_open ()
374 .\"O was invalid.
375 .BR shm_open ()
376 ¤ËÍ¿¤¨¤é¤ì¤¿
377 .I name
378 °ú¤­¿ô¤¬ÉÔÀµ¤Ç¤¢¤Ã¤¿¡£
379 .TP
380 .B EMFILE
381 .\"O The process already has the maximum number of files open.
382 ¥×¥í¥»¥¹¤¬¥ª¡¼¥×¥ó²Äǽ¤Ê¥Õ¥¡¥¤¥ë¿ô¤Î¾å¸Â¤Ë¤¹¤Ç¤Ë㤷¤Æ¤¤¤¿¡£
383 .TP
384 .B ENAMETOOLONG
385 .\"O The length of
386 .\"O .I name
387 .\"O exceeds
388 .\"O .BR PATH_MAX .
389 .I name
390 ¤ÎŤµ¤¬
391 .B PATH_MAX
392 ¤ò±Û¤¨¤Æ¤¤¤ë¡£
393 .TP
394 .B ENFILE
395 .\"O The limit on the total number of files open on the system has been
396 .\"O reached.
397 ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ç¥ª¡¼¥×¥ó¤Ç¤­¤ë¥Õ¥¡¥¤¥ë¿ô¤Î¾å¸Â¤Ë㤷¤¿¡£
398 .TP
399 .B ENOENT
400 .\"O An attempt was made to
401 .\"O .BR shm_open ()
402 .\"O a
403 .\"O .I name
404 .\"O that did not exist, and
405 .\"O .B O_CREAT
406 .\"O was not specified.
407 ¸ºß¤·¤Æ¤¤¤Ê¤¤
408 .I name
409 ¤Î¥ª¥Ö¥¸¥§¥¯¥È¤ò
410 .BR shm_open ()
411 ¤·¤è¤¦¤È¤·¤¿¤¬¡¢
412 .B O_CREAT
413 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤«¤Ã¤¿¡£
414 .TP
415 .B ENOENT
416 .\"O An attempt was to made to
417 .\"O .BR shm_unlink ()
418 .\"O a
419 .\"O .I name
420 .\"O that does not exist.
421 ¸ºß¤·¤Ê¤¤
422 .I name
423 ¤Î¥ª¥Ö¥¸¥§¥¯¥È¤ò
424 .BR shm_unlink ()
425 ¤·¤è¤¦¤È¤·¤¿¡£
426 .\"O .SH VERSIONS
427 .SH ¥Ð¡¼¥¸¥ç¥ó
428 .\"O These functions are provided in glibc 2.2 and later.
429 ¤³¤ì¤é¤Î´Ø¿ô¤Ï glibc 2.2 °Ê¹ß¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ë¡£
430 .\"O .SH "CONFORMING TO"
431 .SH ½àµò
432 POSIX.1-2001.
433 .LP
434 .\"O POSIX.1-2001 says that the group ownership of a newly created shared
435 .\"O memory object is set to either the calling process's effective group ID
436 .\"O or "a system default group ID".
437 POSIX.1-2001 ¤Ë¤Ï¡¢¿·µ¬¤ËºîÀ®¤µ¤ì¤ë¶¦Í­¥á¥â¥ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¥°¥ë¡¼¥×½êÍ­¸¢¤Ï¡¢
438 ¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¼Â¸ú¥°¥ë¡¼¥× ID ¤« ¡Ö¥·¥¹¥Æ¥à¤Î¥Ç¥Õ¥©¥ë¥È¤Î¥°¥ë¡¼¥× ID¡×
439 ¤Î¤É¤Á¤é¤«¤ËÀßÄꤵ¤ì¤ë¡¢¤È½ñ¤«¤ì¤Æ¤¤¤ë¡£
440 .\"O .SH "NOTES"
441 .SH Ãí°Õ
442 .LP
443 .\"O POSIX leaves the behavior of the combination of
444 .\"O .B O_RDONLY
445 .\"O and
446 .\"O .B O_TRUNC
447 .\"O unspecified.
448 .\"O On Linux, this will successfully truncate an existing
449 .\"O shared memory object \(em this may not be so on other Unix systems.
450 POSIX ¤Ï
451 .B O_RDONLY
452 ¤È
453 .B O_TRUNC
454 ¤¬°ì½ï¤Ë»ØÄꤵ¤ì¤¿¾ì¹ç¤ÎÆ°ºî¤ò̤ÄêµÁ¤Ë¤·¤Æ¤¤¤ë¡£Linux ¤Ç¤Ï¡¢
455 ´û¸¤Î¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ËÂФ¹¤ëÀÚ¤êµÍ¤á (truncate) ¤ÏÀ®¸ù¤¹¤ë¡£
456 ¤·¤«¤·¡¢Â¾¤Î Unix ¥·¥¹¥Æ¥à¤Ç¤âƱ¤¸¤Ç¤¢¤ë¤È¤Ï¸Â¤é¤Ê¤¤¡£
457 .LP
458 .\"O The POSIX shared memory object implementation on Linux 2.4 makes use
459 .\"O of a dedicated file system, which is normally
460 .\"O mounted under
461 .\"O .IR /dev/shm .
462 Linux 2.4 ¤Ë¤ª¤±¤ë POSIX ¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Î¼ÂÁõ¤Ï
463 ÀìÍѤΥե¡¥¤¥ë¥·¥¹¥Æ¥à¤ò»ÈÍѤ¹¤ë¡£¤½¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤ÏÄ̾ï
464 .I /dev/shm
465 ¤Ë¥Þ¥¦¥ó¥È¤µ¤ì¤ë¡£
466 .\"O .SH "SEE ALSO"
467 .SH ´ØÏ¢¹àÌÜ
468 .BR close (2),
469 .BR fchmod (2),
470 .BR fchown (2),
471 .BR fcntl (2),
472 .BR fstat (2),
473 .BR ftruncate (2),
474 .BR mmap (2),
475 .BR open (2),
476 .BR umask (2),
477 .BR shm_overview (7)