File: shm_open.3

package info (click to toggle)
manpages-ja 0.5.0.0.20080615-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 20,508 kB
  • ctags: 1
  • sloc: sh: 13,690; perl: 157; makefile: 114
file content (266 lines) | stat: -rw-r--r-- 7,177 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (C) 2002 Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" 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.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Japanese Version Copyright (c) 2002 Akihiro MOTOKI, all rights reserved.
.\" Translated Mon Feb  2 2003 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\"
.TH SHM_OPEN 3 2004-12-17 "Linux" "Linux Programmer's Manual"
.SH ̾
shm_open, shm_unlink \- POSIX ͭꡦ֥Ȥκ/ץȺ (unlink)
.SH 
.B #include <sys/types.h>
.br
.B #include <sys/mman.h>
.br
.BR "#include <fcntl.h>" "           /* O_*  */"
.sp
.BI "void * shm_open(const char *" name ", int " oflag ", mode_t " mode );
.sp
.BI "int shm_unlink(const char *" name );
.sp
\fI\-lrt\fP ǥ󥯤롣
.SH 
.BR shm_open ()
ϡPOSIX ͭꡦ֥Ȥ򿷵˺ץ󤷤ꡢ
Ǥ¸ߤ륪֥Ȥ򥪡ץ󤷤ꤹ롣
POSIX ͭꡦ֥ȤϡºݤˤϡطΤʤץ
ͭƱΰ
.BR mmap (2)
뤿˻Ѥ뤳ȤǤʤǤ롣
.BR shm_unlink ()
ϡդĤޤ
.BR shm_open ()
Ǻ줿֥ȤκԤ
.LP
.BR shm_open ()
ư
.BR open (2)
Ȥ褯Ƥ롣
.I name
Ǻꥪץ󤷤ꤹ붦ͭꡦ֥Ȥꤹ롣
ܿ뤿ˤϡ
.I name
ϥå (/) ϤޤΤˤˤϥåޤޤʤ褦
٤Ǥ롣
.\" Ѥ̾ϥե륷ƥΰȤ¸ߤ뤫⤷ʤ
.\" Ǥʤ⤷ʤޤ֡ȸĤäƤ뤫ɤʬʤޤ
.\" åǻϤޤ̾¾Υץ⻲ȤǤ뤬Ǥʤ̾
.\" Ȥäαƶϼ˰¸롣
.LP
.I oflag
ϥӥåȥޥǡ
.B O_RDONLY

.B O_RDWR
Τ줫ȡʲ˽Ҥ٤¾Υե饰¤Ȥä
ꤹ롣
.TP 1.1i
.B O_RDONLY
ɤ߽ФѤ˥֥Ȥ򥪡ץ󤹤롣
Υե饰ꤷƥץ󤵤줿ͭꡦ֥Ȥϡ
ɤ߽Ф (\fBPROT_READ\fP) ǤΤ
.BR mmap (2)
뤳ȤǤ롣
.TP
.B O_RDWR
ɤ߽񤭥Ѥ˥֥Ȥ򥪡ץ󤹤롣
.TP
.B O_CREAT
¸ߤʤ硢ͭꡦ֥Ȥ롣
֥ȤΥ桼ȥ롼פνͭϡ
ƤӽФץб¸ ID Ȥ졢
.\" ϡLinux Ǥϥե륷ƥ ID ȤΤ
.\" ͤϤۤȤɤĤ¸ ID ƱǤ롣 (MTK, Jul 05)
֥ȤεĥӥåȤ
.I mode
β 9 ӥåȤ˴Ťꤵ롣
ե⡼ɺޥ
.RB ( umask (2)
) ꤵƤͤϡ֥Ȥ˴ؤƤϥꥢ롣
.I mode
뤿˻ѤǤޥ()
.BR open (2)
˵ܤƤ롣
.sp
˺줿ͭꡦ֥ȤĹ 0 ǽ롣
֥Ȥ礭
.BR ftruncate (2)
ȤäǤ롣
ͭꡦ֥ȤȤƿ˳ݤ줿ХȤϼưŪ
0 ˽롣
.TP
.B O_EXCL
.B O_CREAT
˻ꤵƤꡢ
.I name
ǻꤵ줿ͭꡦ֥Ȥ¸ߤ硢
顼֤
֥Ȥ¸߳ǧȡ¸ߤʤäΥ֥Ⱥϡ
ɬϢȤƼ¹Ԥ (performed atomically)
.TP
.B O_TRUNC
ͭꡦ֥ȤǤ¸ߤ硢
Υ֥Ȥ 0 ХȤڤͤ롣
.LP
ƴλ硢
.BR shm_open ()
϶ͭꡦ֥Ȥ򻲾Ȥ뿷ե롦ǥץ֤
Υե롦ǥץϡΥץDz˥ץ󤵤Ƥʤ
ե롦ǥץǺǤ⾮ʿˤʤ뤳Ȥݾڤ롣
.B FD_CLOEXEC
ե饰
.RB ( fcntl (2)
򻲾) Υե롦ǥץꤵ롣
.PP
̾Υե롦ǥץϡθ³Ƽ¹Ԥ
.BR ftruncate (2)
(˺줿֥ȤξΤ) 
.BR mmap (2)
θƤӽФ˻Ѥ롣
.BR mmap (2)
ƤӽФϡե롦ǥץ򥯥Ƥ褯
Ƥꡦޥåԥ󥰤˱ƶͿ뤳ȤϤʤ
.PP
.BR shm_unlink ()
ư
.BR unlink (2)
Ȥ褯Ƥ:
ͭꡦ֥̾٤ƤΥץоݤ
֥Ȥ򥢥ޥåפǥ֥ȤγƤ
бΰƤ˴롣
.BR shm_unlink ()
ǡƱ
.I name
ĥ֥ȤФ
.BR shm_open ()
Ԥȡ
.RB ( O_CREAT
ꤵƤʤ) Ԥ롣
.RB ( O_CREAT
ꤵƤ硢̤Υ֥Ȥ)
.SH ֤
.BR shm_open ()
Υե롦ǥץ֤
Ԥ硢
.BR shm_open ()
 \-1 ֤
.BR shm_unlink ()
ϡ 0 򡢥顼ä \-1 ֤
.SH 顼
Ԥ硢顼θ򼨤
.I errno
ꤵ롣
.I errno
ꤵͤϰʲ̤Ǥ:
.TP
.B EACCES
ͭꥪ֥Ȥ
.BR shm_unlink ()
븢¤ʤä
.TP
.B EACCES
ꤵ줿
.I mode

.I name

.BR shm_open ()
븢¤ʤä⤷ϡ
.B O_TRUNC
ꤵ줿ƤӽФˤϤΥ֥ȤФ񤭹߸¤
ʤä
.TP
.B EEXIST
.B O_CREAT

.B O_EXCL
ξ
.BR shm_open ()
˻ꤵ줿
.I name
ǻꤵ줿ͭꡦ֥Ȥ¸ߤ
.TP
.B EINVAL
.BR shm_open ()
Ϳ줿
.I name
Ǥä
.TP
.B EMFILE
ץץǽʥեξ¤ˤǤãƤ
.TP
.B ENAMETOOLONG
.I name
Ĺ
.B PATH_MAX
ۤƤ롣
.TP
.B ENFILE
ե륷ƥǥץǤեξ¤ã
.TP
.B ENOENT
¸ߤƤʤ
.I name
Υ֥Ȥ
.BR shm_open ()
褦Ȥ
.B O_CREAT
ꤵƤʤä
.TP
.B ENOENT
¸ߤʤ
.I name
Υ֥Ȥ
.BR shm_unlink ()
褦Ȥ
.SH С
δؿ glibc 2.2 ʹߤ󶡤Ƥ롣
.SH 
POSIX.1-2001.
.LP
POSIX.1-2001 ˤϡ˺붦ͭꥪ֥ȤΥ롼׽ͭϡ
ƤӽФץμ¸롼 ID  ֥ƥΥǥեȤΥ롼 ID
Τɤ餫ꤵ롢Ƚ񤫤Ƥ롣
.SH 
.LP
POSIX 
.B O_RDONLY

.B O_TRUNC
˻ꤵ줿ư̤ˤƤ롣Linux Ǥϡ
¸ζͭꡦ֥ȤФڤͤ (truncate) 롣
¾ Unix ƥǤƱǤȤϸ¤ʤ
.LP
Linux 2.4 ˤ POSIX ͭꡦ֥Ȥμ
ѤΥե륷ƥѤ롣Υե륷ƥ̾
.I /dev/shm
˥ޥȤ롣
.SH Ϣ
.BR close (2),
.BR fchmod (2),
.BR fchown (2),
.BR fcntl (2),
.BR fstat (2),
.BR ftruncate (2),
.BR mmap (2),
.BR open (2),
.BR umask (2)