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_SEND 3 2010-09-20 "Linux" "Linux Programmer's Manual"
33 .\"O mq_send, mq_timedsend \- send a message to a message queue
34 mq_send, mq_timedsend \- ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Ë¥á¥Ã¥»¡¼¥¸¤òÁ÷¿®¤¹¤ë
38 .B #include <mqueue.h>
40 .BI "int mq_send(mqd_t " mqdes ", const char *" msg_ptr ,
41 .BI " size_t " msg_len ", unsigned " msg_prio );
44 .B #include <mqueue.h>
46 .BI "int mq_timedsend(mqd_t " mqdes ", const char *" msg_ptr ,
47 .BI " size_t " msg_len ", unsigned " msg_prio ,
48 .BI " const struct timespec *" abs_timeout );
51 .\"O Link with \fI\-lrt\fP.
52 \fI\-lrt\fP ¤Ç¥ê¥ó¥¯¤¹¤ë¡£
56 .\"O Feature Test Macro Requirements for glibc (see
57 .\"O .BR feature_test_macros (7)):
58 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
59 .RB ( feature_test_macros (7)
65 _XOPEN_SOURCE\ >=\ 600 || _POSIX_C_SOURCE\ >=\ 200112L
71 .\"O adds the message pointed to by
73 .\"O to the message queue referred to by the descriptor
77 .\"O argument specifies the length of the message pointed to by
79 .\"O this length must be less than or equal to the queue's
82 .\"O Zero-length messages are allowed.
86 ¤Ç»²¾È¤µ¤ì¤ë¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Ë
88 ¤¬»Ø¤¹¥á¥Ã¥»¡¼¥¸¤òÄɲ乤롣
92 ¤¬»Ø¤¹¥á¥Ã¥»¡¼¥¸¤ÎŤµ¤ò¼¨¤¹¡£¤³¤ÎŤµ¤Ï¥¥å¡¼¤Î
94 °À°Ê²¼¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
95 Ťµ¤¬ 0 ¤Î¥á¥Ã¥»¡¼¥¸¤âǧ¤á¤é¤ì¤Æ¤¤¤ë¡£
99 .\"O argument is a nonnegative integer that specifies the priority
100 .\"O of this message.
101 .\"O Messages are placed on the queue in decreasing order of priority,
102 .\"O with newer messages of the same priority being placed after
103 .\"O older messages with the same priority.
105 °ú¤¿ô¤Ï¡¢¥á¥Ã¥»¡¼¥¸¤ÎÍ¥ÀèÅÙ¤ò»ØÄꤹ¤ëÉé¤Ç¤Ê¤¤À°¿ô¤Ç¤¢¤ë¡£
106 ¥á¥Ã¥»¡¼¥¸¤ÏÍ¥ÀèÅ٤ι߽ç¤Ç¥¥å¡¼¤Ë³ÊǼ¤µ¤ì¡¢Æ±¤¸Í¥ÀèÅ٤ο·¤·¤¤¥á¥Ã¥»¡¼¥¸¤Ï
107 Ʊ¤¸Í¥ÀèÅ٤θŤ¤¥á¥Ã¥»¡¼¥¸¤Î¸å¤í¤Ë³ÊǼ¤µ¤ì¤ë¡£
109 .\"O If the message queue is already full
110 .\"O (i.e., the number of messages on the queue equals the queue's
112 .\"O attribute), then, by default,
114 .\"O blocks until sufficient space becomes available to allow the message
115 .\"O to be queued, or until the call is interrupted by a signal handler.
118 .\"O flag is enabled for the message queue description,
119 .\"O then the call instead fails immediately with the error
121 ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤¬¤¹¤Ç¤Ë°ìÇդξì¹ç
122 (¤¹¤Ê¤ï¤Á¡¢¥¥å¡¼¤ËÆþ¤Ã¤Æ¤¤¤ë¥á¥Ã¥»¡¼¥¸¿ô¤¬¥¥å¡¼¤Î
124 °À¤ÈÅù¤·¤¤¾ì¹ç)¡¢¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢
126 ¤Ï¡¢¥á¥Ã¥»¡¼¥¸¤ò¥¥å¡¼¥¤¥ó¥°¤¹¤ë¤Î¤Ë½½Ê¬¤Ê¶õ´Ö¤¬¤Ç¤¤ë¤«¡¢
127 ´Ø¿ô¸Æ¤Ó½Ð¤·¤¬¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Ë¤è¤êÃæÃǤµ¤ì¤ë¤Þ¤Ç¡¢Ää»ß (block) ¤¹¤ë¡£
128 ¥á¥Ã¥»¡¼¥¸¥¥å¡¼µ½Ò (message queue description) ¤Ç
130 ¥Õ¥é¥°¤¬Í¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢
136 .\"O .BR mq_timedsend ()
137 .\"O behaves just like
139 .\"O except that if the queue is full and the
141 .\"O flag is not enabled for the message queue description, then
143 .\"O points to a structure which specifies a ceiling on the time for which
144 .\"O the call will block.
145 .\"O This ceiling is an absolute timeout in seconds and nanoseconds
146 .\"O since the Epoch, 1970-01-01 00:00:00 +0000 (UTC), and it is
147 .\"O specified in the following structure:
151 ¤ÈÁ´¤¯Æ±¤¸Æ°ºî¤ò¤¹¤ë¤¬¡¢
152 ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤¬°ìÇդǡ¢¥á¥Ã¥»¡¼¥¸¥¥å¡¼µ½Ò¤Ç
154 ¥Õ¥é¥°¤¬Í¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¡¢¤³¤Î¸Æ¤Ó½Ð¤·¤¬Ää»ß¤¹¤ë»þ´Ö¤Î¾å¸Â¤ò
156 ¤¬»Ø¤¹¹½Â¤ÂΤǻØÄꤹ¤ëÅÀ¤¬°Û¤Ê¤ë¡£¤³¤Î¾å¸Â¤Ï¡¢¥¿¥¤¥à¥¢¥¦¥È¤Î»þ¹ï¤ò
157 »þ¹ïµª¸µ (Epoch; 1970-01-01 00:00:00 +0000 (UTC)) ¤«¤é¤Î·Ð²á»þ´Ö
158 (ÉäȥʥÎÉäÎÁÈ) ¤Ç»ØÄꤹ¤ë¡£¥¿¥¤¥à¥¢¥¦¥È»þ¹ï¤Ï°Ê²¼¤Î¹½Â¤ÂΤǻØÄꤹ¤ë:
163 .\"O time_t tv_sec; /* seconds */
164 .\"O long tv_nsec; /* nanoseconds */
165 time_t tv_sec; /* ÉÃ */
166 long tv_nsec; /* ¥Ê¥ÎÉà */
171 .\"O If the message queue is full,
172 .\"O and the timeout has already expired by the time of the call,
173 .\"O .BR mq_timedsend ()
174 .\"O returns immediately.
175 ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤¬°ìÇդǡ¢´Ø¿ô¸Æ¤Ó½Ð¤·»þ¤Ë¤¹¤Ç¤Ë¥¿¥¤¥à¥¢¥¦¥È»þ¹ï¤¬
179 .\"O .SH RETURN VALUE
184 .\"O .BR mq_timedsend ()
185 .\"O return zero; on error, \-1 is returned, with
187 .\"O set to indicate the error.
193 ¥¨¥é¡¼¤Î¾ì¹ç¡¢\-1 ¤òÊÖ¤·¡¢
195 ¤Ë¥¨¥é¡¼¤ò¼¨¤¹ÃͤòÀßÄꤹ¤ë¡£
200 .\"O The queue was full, and the
202 .\"O flag was set for the message queue description referred to by
206 ¤Ç»²¾È¤µ¤ì¤ë¥á¥Ã¥»¡¼¥¸¥¥å¡¼µ½Ò¤Ç
208 ¥Õ¥é¥°¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤¿¡£
211 .\"O The descriptor specified in
215 ¤Ç»ØÄꤵ¤ì¤¿µ½Ò»Ò¤¬ÉÔÀµ¤Ç¤¢¤ë¡£
218 .\"O The call was interrupted by a signal handler; see
220 ´Ø¿ô¸Æ¤Ó½Ð¤·¤¬¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Ë¤è¤êÃæÃǤµ¤ì¤¿¡£
225 .\"O The call would have blocked, and
227 .\"O was invalid, either because
229 .\"O was less than zero, or because
231 .\"O was less than zero or greater than 1000 million.
232 ´Ø¿ô¸Æ¤Ó½Ð¤·¤ÏÄä»ß¤¹¤ë¤Ï¤º¤Ç¤¢¤Ã¤¿¤¬¡¢
240 ¤¬ 0 ̤Ëþ¤« 1,000,000,000 ¤è¤êÂ礤¤¡¢¤È¤¤¤¦¤³¤È¤Ç¤¢¤ë¡£
244 .\"O was greater than the
246 .\"O attribute of the message queue.
250 °À¤è¤ê¤âÂ礤«¤Ã¤¿¡£
253 .\"O The call timed out before a message could be transferred.
254 ¥á¥Ã¥»¡¼¥¸¤¬Å¾Á÷¤µ¤ì¤ëÁ°¤Ë´Ø¿ô¸Æ¤Ó½Ð¤·¤¬¥¿¥¤¥à¥¢¥¦¥È¤·¤¿¡£
255 .\"O .SH CONFORMING TO
261 .\"O .BR mq_timedsend ()
262 .\"O is a system call, and
264 .\"O is a library function layered on top of that system call.
267 ¤Ï¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ç¤¢¤ë¡£
271 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤òÍѤ¤¤Æ¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¡£