2 .\" Hey Emacs! This file is -*- nroff -*- source.
4 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved.
27 .\" Translated 2006-04-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
28 .\" Updated 2008-11-09, Akihiro MOTOKI, LDP v3.13
30 .TH MQ_RECEIVE 3 2010-09-20 "Linux" "Linux Programmer's Manual"
32 mq_receive, mq_timedreceive \- メッセージキューからメッセージを受信する
35 .B #include <mqueue.h>
37 .BI "ssize_t mq_receive(mqd_t " mqdes ", char *" msg_ptr ,
38 .BI " size_t " msg_len ", unsigned *" msg_prio );
41 .B #include <mqueue.h>
43 .BI "ssize_t mq_timedreceive(mqd_t " mqdes ", char *" msg_ptr ,
44 .BI " size_t " msg_len ", unsigned *" msg_prio ,
45 .BI " const struct timespec *" abs_timeout );
53 .RB ( feature_test_macros (7)
57 .BR mq_timedreceive ():
59 _XOPEN_SOURCE\ >=\ 600 || _POSIX_C_SOURCE\ >=\ 200112L
66 で参照されるメッセージキューから最も高い優先度を持つ
67 最も古いメッセージを削除し、そのメッセージを
73 が指すバッファの大きさを示す。この値はキューの
81 が指すバッファに受信したメッセージの優先度が格納される。
85 は、新しいメッセージが届くか、関数呼び出しがシグナルハンドラにより
86 中断されるまで、停止 (block) する。
87 メッセージキュー記述 (message queue description) で
95 .BR mq_timedreceive ()
99 メッセージキューが空で、メッセージキュー記述で
101 フラグが有効になっていない場合に、この呼び出しが停止する時間の上限を
103 が指す構造体で指定する点が異なる。この上限は、タイムアウトの時刻を、
104 時刻紀元 (Epoch; 1970-01-01 00:00:00 +0000 (UTC)) からの経過時間
105 (秒とナノ秒の組) で指定する。タイムアウト時刻は以下の構造体で指定する:
110 time_t tv_sec; /* 秒 */
111 long tv_nsec; /* ナノ秒 */
116 メッセージがキューになく、関数呼び出し時にすでにタイムアウト時刻が
118 .BR mq_timedreceive ()
124 .BR mq_timedreceive ()
143 関数呼び出しがシグナルハンドラにより中断された。
156 が 0 未満か 1,000,000,000 より大きい、ということである。
165 メッセージが転送される前に関数呼び出しがタイムアウトした。
170 .BR mq_timedreceive ()
174 .BR mq_timedreceive ()