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
|
.\" 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>
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\" all rights reserved.
.\" Translated Sun Feb 23 16:59:36 JST 1997
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\"
.\"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 "November 1, 1993" "Linux 0.99.13" "Linux Programmer's Manual"
.SH ̾
msgop \- å(message)
.SH
.nf
.B
# include <sys/types.h>
.br
.B
# include <sys/ipc.h>
.br
.B
# include <sys/msg.h>
.fi
.sp
.BI "int msgsnd ( int " msqid ,
.BI "struct msgbuf *" msgp ,
.BI "int " msgsz ,
.BI "int " msgflg " )"
.sp
.BI "int msgrcv ( int " msqid ,
.BI "struct msgbuf *" msgp ,
.BI "int " msgsz ,
.BI "long " msgtyp ,
.BI "int " msgflg " )"
.SH
å(message)äꤹ뤿
ƤӽФץϰʲΤ褦ʹ¤ΤƤ롣
.sp
.B
struct msgbuf {
.br
.B
long mtype;
/* message type, must be > 0 */
.br
.B
char mtext[1];
/* message data */
.br
.B
};
.sp
.B mtext
礭
.IR msgsz
ǤʤФʤʤ
¤ΤΥС
.B mtype
ϥåȤץˤäƥåǤ褦
̩ǤʤФʤʤ(
.BR msgrcv
衣)
.PP
ƤӽФץϥå뤿ˤϥ塼(queue)ؤ
ߵĤå뤿ˤϥ塼ؤɤ߹ߵĤ
ʤФʤʤ
.PP
.B msgsnd
ƥࡦ
.I msgp
ǻꤵ줿åΥԡ
.I msqid
ͤǻꤵ줿å塼롣
.PP
.I msgflg
ϡå塼Τ˥塼
.B msg_qbytes
¿ɬפʾưꤹ롣
.B IPC_NOWAIT
ꤵ줿硢å줺ƥࡦϼԤ
.B errno
.BR EAGAIN
ꤷ֤롣ǤʤСΤ褦ʾʤʤ뤫
塼뤫ץ(catch)٤ʥ(signal)
ޤǡץ(process)μ¹Ԥ(suspend)롣
(ߤ褦ʾʤʤХåƥƥࡦ
롢塼줿ϥƥࡦϼԤ
.B errno
.BR EIDRM
ꤵ롢ʥȤäϥƥࡦϼԤ
.B errno
.BR EINTR
ꤵ롣)
.PP
ˤϥå塼ǡ¤ΤϰʲΤ褦
:
.IP
.B msg_lspid
ˤϸƤӽФץΥץ ID ꤵ롣
.IP
.B msg_qnum
1 ä롣
.IP
.B msg_stime
ˤϸ郎ꤵ롣
.PP
.B msgrcv
ƥࡦ
.I msqid
ǻꤷå塼
.I msgp
ˤäƻꤵ줿
.B msgbuf
¤ΤؤȥåɤߤȤꡢˤϡ塼ɤ
å롣
.PP
.I msgsz
ˤ
.I msgp
ǻꤵ줿¤Τ
.B mtext
СκΥХȿꤹ롣
⤷åΥƥȤĹ
.IR msgsz
礭ˤϡ
.I msgflg
.BR MSG_NOERROR
ꤵƤХåΥƥȤڤͤ롢
ǤʤХåϥ塼줺
ƥࡦϼԤ
.B errno
.BR E2BIG
ꤵ롣
.PP
.I msgtyp
ᤷåη(type)ʲΤ褦Ϳ:
.IP
.I msgtyp
.BR 0
ʤС塼κǽˤåɤ߹ޤ롣
.IP
.I msgtyp
.BR 0
礭С
.I msgflg
.B MSG_EXCEPT
ꤵƤʤХ塼κǽ
.I msgtyp
Υåɤ߹ޤ롣
.B MSG_EXCEPT
ꤵƤϥ塼κǽ
.I msgtyp
ʳΥåɤ߹ޤ롣
.IP
.I msgtyp
.BR 0
꾮С
.I msgtyp
ͰʲκǤ⾮ĥ塼κǽΥåɤ߹ޤ롣
.PP
.I msgflg
ˤϰʲΥե饰 0, 1, ʣ( OR)Ϳ:
.IP
.B IPC_NOWAIT
塼ᤵ줿ΥåʤˤϤ֤롣
ƥࡦϼԤ errno ˤ
.BR ENOMSG
ꤵ롣
.IP
.B MSG_EXCEPT
.B 0
礭
.I msgtyp
Ȱ˻Ѥơ
塼κǽ
.IR msgtyp
ʳΥåɤࡣ
.IP
.B MSG_NOERROR
.I msgsz
ХȤĹäϥåΥƥȤڤͤ롣
.PP
ᤵ줿Υå¸ߤ
.IR msgflg
.B IPC_NOWAIT
ꤵƤʤä硢ʲξޤǸƤӽФץ
(block):
.IP
Ƥ뷿Υå塼줿
.IP
å塼ƥफ줿
ξϥƥࡦϼԤ
.B errno
.BR EIDRM
ꤵ롣
.IP
ƤӽФץͤ٤ʥ
ξϥƥࡦϼԤ
.B errno
.BR EINTR
ꤵ롣
.PP
ˤϥå塼ǡ¤ΤϰʲΤ褦
:
.IP
.B msg_lrpid
ˤϸƤӽФץΥץ ID ꤵ롣
.IP
.B msg_qnum
1 롣
.IP
.B msg_rtime
ˤϸ郎ꤵ롣
.SH ֤
ԤˤϤɤδؿ
.B \-1
֤顼
.B errno
˻ؼ롣Ǥʤ
.B msgsnd
.B 0
֤
.B msgrvc
ºݤ
.B mtext
ԡХȿ֤
.SH 顼
.B msgsnd
Ԥˤ
.B errno
˰ʲͤΤɤ줫ꤷ֤:
.TP 11
.B EAGAIN
.B msg_qbytes
塼θ³ĶƤ
.IR mgsflg
.B IPC_NOWAIT
ꤵƤå뤳ȤǤʤä
.TP
.B EACCES
ƤӽФץå塼ФߵĤ
äƤʤ
.TP
.B EFAULT
.I msgp
ؤƤ륢ɥ쥹ǽǤʤ
.TP
.B EIDRM
å塼줿
.TP
.B EINTR
å塼ξ֤(sleep)Ƥˡ
ץ(catch)٤ʥȤä
.TP
.B EINVAL
.I msqid
ŬڤͤǤ뤫
.I mtype
ͤǤʤ
.I msgsz
Ŭڤ(0 ʲƥͤ
.BR MSGMAX
礭)
.TP
.B ENOMEM
.BR msgbuf
˥ԡ뤿νʬʥ꤬ƥ¸ߤʤ
.PP
.B msgrcv
Ԥˤ
.B errno
˰ʲͤΤɤ줫ꤷ֤:
.TP 11
.B E2BIG
åΥƥȤĹ
.I msgsz
礭
.IR msgflg
.B MSG_NOERROR
ꤵƤʤä
.TP
.B EACCES
ƤӽФץå塼Ф
ɤ߹ߵĤäƤʤä
.TP
.B EFAULT
.I msgp
ؤƤ륢ɥ쥹ǽǤʤä
.TP
.B EIDRM
å뤿˥ץ(sleep)Ƥ֤ˡ
å塼줿
.TP
.B EINTR
å뤿˥ץ(sleep)Ƥ֤ˡ
ץͤ٤ʥ
.TP
.B EINVAL
.I msgqid
.I msgsz
.BR 0
꾮
.TP
.B ENOMSG
.I msgflg
.B IPC_NOWAIT
ꤵƤꡢ
å塼ᤵ줿Υå¸ߤʤä
.SH
ʲ
.B msgsnd
ƥࡦ˱ƶ륷ƥ¤Ǥ:
.TP 11
.B MSGMAX
åΥƥȤκ祵: 4080 ХȤꤵƤ롣
.TP
.B MSGMNB
å塼ΥХȡΥǥեȤκ祵: ˰¸
ѡ桼
.B msgctl
ƥࡦǥå塼Υ
.B MSGMNB
礭ͤä뤳ȤǤ롣
.PP
ߤμǤϡƥΤΥåإåο
.RB ( MSGTQL )
ȡƥΤΥåסκХȿ
.RB ( MSGPOOL )
˸ͭξ¤Ϥʤ
.SH
SVr4, SVID.
.SH Ϣ
.BR ipc (5),
.BR msgctl (2),
.BR msgget (2),
.BR msgrcv (2),
.BR msgsnd (2)
|