File: msgop.2

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 (429 lines) | stat: -rw-r--r-- 10,320 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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
.\" 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 Tue Oct 22 16:40:11 1996 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified Mon Jul 10 21:09:59 2000 by aeb
.\" Modified 1 Jun 2002, Michael Kerrisk <mtk.manpages@gmail.com>
.\"	Language clean-ups.
.\"	Enhanced and corrected information on msg_qbytes, MSGMNB and MSGMAX
.\"	Added note on restart behavior of msgsnd() and msgrcv()
.\"	Formatting clean-ups (argument and field names marked as .I
.\"		instead of .B)
.\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
.\"     Added notes on capability requirements
.\" Modified, 11 Nov 2004, Michael Kerrisk <mtk.manpages@gmail.com>
.\"	Language and formatting clean-ups
.\"	Added notes on /proc files
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\"         all rights reserved.
.\" Translated 1997-02-23, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Modified 2000-09-23, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated 2002-11-26, Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2005-03-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2006-03-05, Akihiro MOTOKI, catch up to LDP v2.25
.\"
.\"WORD:	message			å
.\"WORD:	operation		
.\"WORD:	queue			塼
.\"WORD:	process			ץ
.\"WORD:	catch			(catch)
.\"WORD:	signal			ʥ
.\"WORD:	suspend			(suspend)
.\"WORD:	sleep			(sleep)
.\"WORD:	block			(block)
.\"WORD:	process-ID		ץID
.\"WORD:	type			
.\"WORD:	policy			
.\"WORD:	super-user		ѡ桼
.\"WORD:	current time		߻
.\"WORD:	implement		
.\"
.TH MSGOP 2 2006-02-02 "Linux" "Linux Programmer's Manual"
.SH ̾
msgop, msgrcv, msgsnd \- å
.SH 
.nf
.B #include <sys/types.h>
.B #include <sys/ipc.h>
.B #include <sys/msg.h>
.sp
.BI "int msgsnd(int " msqid ", const void *" msgp ", size_t " msgsz \
", int " msgflg );
.sp
.BI "ssize_t msgrcv(int " msqid ", void *" msgp ", size_t " msgsz \
", long " msgtyp ,
.BI "               int " msgflg );
.fi
.SH 
ƥॳ
.BR msgsnd ()

.BR msgrcv ()
Ϥ줾졢å塼ؤΥåȡ
åμ˻Ѥ롣ƤӽФץϡ
å뤿ˤϥå塼Ф񤭹ߵĤ
å뤿ˤɤ߽ФĤäƤʤФʤʤ
.PP
ƤӽФץϰʲ˼¤ΤѰդι¤Τؤ
ݥ󥿤
.msgp
ȤϤ
.in +4n
.nf

struct msgbuf {
    long mtype;       /* message type, must be > 0 */
    char mtext[1];    /* message data */
};
.fi
.in
.PP
.I mtext
եɤ (ޤ¾ι¤) ǡ礭
Ǥ
.I msgsz
ǻꤵ롣
Ĺ 0 Υå (Ĥޤ
.I mtext
եɤʤå) ǧƤ롣
.B mtype
եɤϸ̩ǤʤФʤʤ
ͤϡåץǥå򤹤뤿
Ѥ (
.BR msgrcv ()
򻲾ȤΤ)
.PP
.BR msgsnd ()
ƥॳ
.I msgp
ǻꤵ줿åΥԡ
.I msqid
ǻꤵ줿̻Ҥĥå塼ɲä롣
.PP
塼˽ʬʶ̤硢
.BR msgsnd ()
ľ롣
(塼̤ϡå塼Υǡ¤Τ
.I msg_bytes
եɤ롣
塼ˤΥեɤ
.B MSGMNB
˽뤬¤
.BR msgctl (2)
ȤäѹǤ롣)
塼˽ʬʶ̤ʤ硢
ǥեȤǤ
.BR msgsnd ()
϶̤Ǥޤ (block) 롣
.I msgflg

.B IPC_NOWAIT
ꤵ줿ϡ顼
.B EAGAIN
ǼԤ롣

塼줿礫ʥȤä硢
ߤƤ
.BR msgsnd ()
ϼԤ
(塼줿
.B EIDRM
ʥ
.B EINTR

.I errno
ꤵ)
.RB ( msgsnd "  " msgrcv
ϡȤʥϥɥ
.B SA_RESTART
ꤷƤȤƤ⡢ʥϥɥˤäƳޤ줿
ưŪ˺ƥȤ뤳ȤϷ褷Ƥʤ)
.PP
˽λ硢å塼Υǡ¤ΤϰʲΤ褦
:
.IP
.I msg_lspid
ˤϸƤӽФץΥץ ID ꤵ롣
.IP
.I msg_qnum
 1 ä롣
.IP
.I msg_stime
ˤϸ߻郎ꤵ롣
.PP
.BR msgrcv ()
ƥࡦ
.I msqid
ǻꤵ줿塼å
.I msgp
ǻꤵ줿ХåեˤΥåǼ롣
.PP
.I msgsz
ˤ
.I msgp
ǻꤵ줿¤Τ
.I mtext
СκΥХȿꤹ롣
åΥƥȤĹ
.I msgsz
礭ưϡ
.I msgflg

.B MSG_NOERROR
ꤵƤ뤫ɤǷޤ롣
.B MSG_NOERROR
ꤵƤСåΥƥȤڤͤ
(ڤΤƤ줿ʬϼ)
.B MSG_NOERROR
ꤵƤʤСåϥ塼줺
ƥॳ \-1 ֤ƼԤ
.I errno

.B E2BIG
ꤵ롣
.PP
.I msgtyp
ˤ׵᤹åηꤹ롣
ϰʲΤ褦˻ꤹ:
.IP
.I msgtyp
 0 ʤС塼κǽˤåɤ߹ޤ롣
.IP
.I msgtyp
 0 礭硢
.I msgflg

.B MSG_EXCEPT
ꤵƤʤС
.I msgtyp
Υ塼κǽΥåɤ߹ޤ롣
.B MSG_EXCEPT
ꤵ줿ϡ
.I msgtyp
ʳΥ塼κǽΥåɤ߹ޤ롣
.IP
.I msgtyp
 0 꾮С
.I msgtyp
ͰʲǺǤ⾮ĥ塼κǽΥåɤ߹ޤ롣
.PP
.I msgflg
ˤϡʲΥե饰Ǥդο (0Ĥ) OR ǻꤹ:
.TP
.B IPC_NOWAIT
塼׵ᤵ줿Υåʤˤľ֤롣
ƥॳϼԤ
.I errno
ˤ
.B ENOMSG
ꤵ롣
.TP
.B MSG_EXCEPT
0 礭
.I msgtyp
Ȱ˻Ѥơ
.I msgtyp
ʳΥ塼κǽΥåɤ߹ࡣ
.TP
.B MSG_NOERROR
.I msgsz
ХȤĹäϥåΥƥȤڤͤ롣
.PP
׵ᤵ줿Υå¸ߤ
.I msgflg

.B IPC_NOWAIT
ꤵƤʤä硢ƤӽФץ
ʲΤ줫ξˤʤޤ (block) :
.IP
׵ᤷƤ뷿Υå塼줿
.IP
å塼ƥफ줿
ξ硢ƥॳϼԤ
.I errno

.B EIDRM
ꤵ롣
.IP
ƤӽФץʥͤ
ξ硢ƥࡦϼԤ
.I errno

.B EINTR
ꤵ롣
.PP
¹Ԥ硢å塼Υǡ¤ΤϰʲΤ褦
:
.IP
.I msg_lrpid
ˤϸƤӽФץΥץ ID ꤵ롣
.IP
.I msg_qnum
 1 롣
.IP
.I msg_rtime
ˤϸߤλ郎ꤵ롣
.SH ֤
Ԥϡɤδؿ \-1 ֤顼
.I errno
ɽ롣硢
.BR msgsnd ()
 0 ֤
.BR msgrcv ()

.I mtext
˼ºݤ˥ԡХȿ֤
.SH 顼
.BR msgsnd ()
Ԥ硢
.B errno
˰ʲͤΤ줫ꤵ:
.TP 11
.B EACCES
ƤӽФץˤϥå塼Ф񤭹ߵĤʤ
.B CAP_IPC_OWNER
ѥӥƥʤ
.TP
.B EAGAIN
.I msg_qbytes
塼¤ĶƤᡢå뤳ȤǤ
.I msgflg

.B IPC_NOWAIT
ꤵƤ
.TP
.B EFAULT
.I msgp
ؤƤ륢ɥ쥹ǽǤʤ
.TP
.B EIDRM
å塼줿
.TP
.B EINTR
å塼׵ᤷޤߤƤˡ
ץʥͤ
.TP
.B EINVAL
.I msqid
ŬڤͤǤ뤫
.I mtype
ͤǤʤ
.I msgsz
Ŭڤ (0 ʲƥǷޤ
.B MSGMAX
礭) Ǥ롣
.TP
.B ENOMEM
.I msgp
ؤåΥԡΤ˽ʬʥ꤬ƥ¸ߤʤ
.PP
.BR msgrcv ()
Ԥˤ
.I errno
˰ʲͤΤ줫ꤵ:
.TP 11
.B E2BIG
åΥƥȤĹ
.I msgsz
.I msgflg

.B MSG_NOERROR
ꤵƤʤä
.TP
.B EACCES
ƤӽФץˤϥå塼Фɤ߹ߵĤʤ
.B CAP_IPC_OWNER
ѥӥƥʤ
.TP
.B EAGAIN
塼ˤϥåʤ
.I msgflg

.B IPC_NOWAIT
ꤵ줿
.TP
.B EFAULT
.I msgp
ؤƤ륢ɥ쥹ǽǤʤ
.TP
.B EIDRM
å뤿˥ץߤƤ֤ˡ
å塼줿
.TP
.B EINTR
å뤿˥ץߤƤ֤ˡ
ץʥͤ
.TP
.B EINVAL
.I msgqid

.I msgsz
 0 꾮
.TP
.B ENOMSG
.I msgflg

.B IPC_NOWAIT
ꤵƤꡢ
å塼׵ᤵ줿Υå¸ߤʤä
.SH 
SVr4, POSIX.1-2001.
.SH 
.I msgp
ϡ libc4, libc5, glibc 2.0, glibc 2.1 Ǥ
\fIstruct msgbuf *\fP Ƥ롣glibc 2.2 ʹߤǤϡ
SUSv2  SUSv3 ׵̤ꡢ\fIvoid *\fP Ƥ롣

ʲ
.B msgsnd
ƥࡦ˱ƶ륷ƥ¤Ǥ:
.TP 11
.B MSGMAX
åΥƥȤκ祵: 8192 Х
(Linux Ǥϡͤ
.I /proc/sys/kernel/msgmax
ͳɤ߽ФѹǤ)
.TP
.B MSGMNB
Хñ̤ǤΥå塼ΥǥեȤκ祵 : 16384 Хȡ
(Linux Ǥϡͤ
.I /proc/sys/kernel/msgmnb
ͳɤ߽ФѹǤ)
ѡ桼
.BR msgctl (2)
ƥॳǥå塼Υ
.B MSGMNB
礭ͤ䤹ȤǤ롣
.PP
ߤμǤϡƥΤΥåإåκ
.RB ( MSGTQL )
ȡƥΤΥåסκХȿ
.RB ( MSGPOOL )
˴ؤƼ¸¤Ϥʤ
.SH Ϣ
.BR msgctl (2),
.BR msgget (2),
.BR capabilities (7),
.BR mq_overview (7),
.BR svipc (7)