File: shmop.2

package info (click to toggle)
manpages-ja 0.4.0.0.20000115-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 8,760 kB
  • ctags: 3
  • sloc: sh: 6,269; perl: 155; makefile: 55
file content (262 lines) | stat: -rw-r--r-- 6,666 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
.\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
.\"
.\" 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.  The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\" 
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Modified Sun Nov 28 17:06:19 1993, Rik Faith <faith@cs.unc.edu>
.\"          with material from Luigi P. Bai <lpb@softint.com>
.\" Portions Copyright 1993 Luigi P. Bai
.\" Modified Tue Oct 22 22:04:23 1996 by Eric S. Raymond <esr@thyrsus.com>
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\"         all rights reserved.
.\" Translated Sun Aug 15 22:51:09 JST 1999
.\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\"
.\"WORD:	shared memory		ͭ
.\"WORD:	segment			
.\"WORD:	super-user		ѡ桼
.\"WORD:	detach			ʬΥ
.\"WORD:	attach			ղ
.\"WORD:	member			С
.\"WORD:	implement		
.\"WORD:	page aligne		ڡ
.\"WORD:	unaligned		ȿ
.\"WORD:	descriptor		ǥץ
.\"WORD:	parameter		ѥ᡼
.\"
.TH SHMOP 2 "November 28, 1993" "Linux 0.99.13" "Linux Programmer's Manual" 
.SH ̾
shmop \- ͭ(shared memory)
.SH 
.nf
.B
# include <sys/types.h>
.B
# include <sys/shm.h>
.fi
.sp
.BI "void *shmat ( int " shmid ,
.BI "const void *" shmaddr ,
.BI "int " shmflg " )"
.sp
.BI "int shmdt ( const void *" shmaddr ")"
.SH 
.B shmat
ؿ
.B shmid
ǻꤵ줿ͭꡦ(shared memory segment)
뤷ץΥǡȤղ(attach)롣
ղä륢ɥ쥹
.I shmaddr
˰ʲΤɤ줫ηǻꤹ:
.IP
.I shmaddr

.BR 0 
ʤСƥ 1 \- 1.5G ϰϤǹ⤤ͤϤ㤤ͤؤȡ
ޥå(map)Ƥʤΰ򸫤Ĥ褦Ȼߤ롣
.IP
.I shmaddr

.B 0
Ǥʤ
.B SHM_RND
 
.IR shmflg
˻ꤵƤϡ
.I shmaddr

.BR SHMLBA
ܿؤڤΤƤ(rounding donw)Τɥ쥹ղäԤʤ
¾ξ
.I shmaddr
ղäԤʤɥ쥹ǡڡ(aligne)˹碌ɬפ롣
.PP
.B SHM_RDONLY

.IR shmflg 
˻ꤵƤϡ
Ȥɤ߹Ѥղä졢ץϤΥȤؤ
ɤ߹ߵĤʤФʤʤ
ǤʤФΥȤɤ߹ߤȽ񤭹ߤΤղä졢
ץϤΥȤɤ߹ߤȽ񤭹ߤεĤɬפ롣
񤭹ѤζͭꡦȤȤǰ¸ߤʤ
.PP
ƤӽФץ
.B brk
ͤղäˤäѲʤ
ΥȤϥץλ(exit)鼫ưŪʬΥ(detach)롣
ƱȤץΥɥ쥹֤ˡɤ߹Ѥɤ߽ξ
ȤղäǤޤʣղä뤳ȤǤ롣
.PP

.B shmat
϶ͭꡦȤ˴Ϣ
.B shmid_ds
¤ΤΥСʲΤ褦˹:
.IP
.B shm_atime
ˤϸߤλꤹ롣
.IP
.B shm_lpid
ˤϸƤӽФץΥץ ID ꤹ롣
.IP
.B shm_nattch
 1 ä롣
.PP
ͭꡦȤ˺(delete)ޡ
ղä뤳Ȥդ뤳ȡ
.PP
.B shmdt
ؿϸƤӽФץΥǡȤ
.IR shmaddr 
ǻꤵ줿ɥ쥹֤줿ͭꡦȤ
ʬΥ(detach)롣
ʬΥ붦ͭꡦȤϸ(ץΥɥ쥹֤)
ղäƤΤɤ줫ǤʤФʤ餺
.I shmaddr
Ϥղä
.B shmat
֤ͤʤФʤʤ
.PP

.B shmdt
ϤζͭꡦȤ˴Ϣ
.B shmid_ds
¤ΤΥСʲΤ褦˹:
.IP
.B shm_dtime
ˤϸߤλ郎ꤵ롣
.IP
.B shm_lpid
ˤϸƤӽФץΥץ ID ꤵ롣
.IP
.B shm_nattch
 1 롣⤷ 0 ˤʤꡢޡä
ΥȤϺ롣
.PP
ƤӽФץΥ桼֤Ƥΰϥޥå(unmap)
.PP
.SH ƥࡦ
.TP
.B fork()
.B fork()
塢ҥץղä줿ͭꡦȤѾ롣
.TP
.B exec()
.B exec()
塢Ƥղä줿ͭꡦȤʬΥ
(˲Ϥʤ)
.TP
.B exit()
.B exit()
ˤơƤղä줿ͭꡦȤʬΥ롣
.PP
.SH ֤
ԤˤϤɤδؿ 
.B \-1
֤
.B errno
˥顼Ŧ롢
Ǥʤ
.B shmat
ղä줿ͭꡦȤΥɥ쥹֤
.B shmdt

.BR 0 
֤
.SH 顼
.B shmat
Ԥ硢
.B errno
˰ʲͤΤɤ줫ꤷ֤:
.TP 11
.B EACCES
ƤӽФץ׵ᤵ줿ղäɬפʥĤʤ
.TP
.B EINVAL
.I shmid
ͤǤ롢ȿ(unaligned)(㤨Сڡ˹äƤ餺
\fBSHM_RND\fP ꤵƤʤ) ޤ
.I shmaddr
Ǥ뤫
.BR brk
ؤղä˼Ԥ
.TP
.B ENOMEM
ǥץ(descriptor)ڡơ֥ΤΥ
Ƥ뤳ȤǤʤ
.PP
.B shmdt
ؿ
.IR shmaddr 
ղä줿ͭꡦȤ¸ߤʤΤ߼Ԥ
Τ褦ʾˤ
.B errno

.BR EINVAL
ꤵ롣
.SH 
.BR fork (2)
ƥࡦ¹Ԥ硢
ҥץƤղä줿ͭꡦȤѾ롣
.PP
.BR execve (2)
ƥࡦ¹Ԥ˥ץղäƤ
ͭꡦȤϡ̤ΥץˤղäƤʤ
.PP
ʲ
.B shmat
ƥࡦ˱ƶ륷ƥࡦѥ᡼Ǥ:
.TP 11
.B SHMLBA
Ȥζɥ쥹κǾܿڡ˹äƤʤФʤʤ
ߤμǤ
.B SHMBLA
ͤ
.BR PAGE_SIZE 
Ǥ롣
.PP
ߤμǤϡץȤ
ͭꡦȤκ
.RB ( SHMSEG )
˸ͭ¤¸ߤʤ
.SH 
SVr4SVIDSVr4 ˤ¾ EMFILE 顼֤ˤĤƤεҤ롣
SVID-v4 Ǥ \fIshmaddr\fP η
.B "char *"

.B "const void *" 
ˡ\fIshmat\fP() ֤ͤη
.B "char *"

.BR "void *"
ѹ줿(Linux Ǥ libc4  libc5 Υץȥ
.B "char *"
ϤǤꡢglibc2 Υץȥפ
.BR "void *"
Ǥ)
.SH Ϣ
.BR ipc (5),
.BR shmctl (2),
.BR shmget (2)