2 .\" Hey Emacs! This file is -*- nroff -*- source.
4 .\" Copyright (C) 2006 Michael Kerrisk <mtk-manpages@gmx.net>
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.
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .TH MQ_SEND 3 2006-02-25 "Linux 2.6.16" "Linux Programmer's Manual"
25 mq_send, mq_timedsend \- send a message to a message queue
28 .B #include <mqueue.h>
30 .BI "mqd_t mq_send(mqd_t " mqdes ", const char *" msg_ptr ,
31 .BI " size_t " msg_len ", unsigned " msg_prio );
33 .B #define _XOPEN_SOURCE 600
35 .B #include <mqueue.h>
37 .BI "mqd_t mq_timedsend(mqd_t " mqdes ", const char *" msg_ptr ,
38 .BI " size_t " msg_len ", unsigned " msg_prio ,
39 .BI " const struct timespec *" abs_timeout );
43 adds the message pointed to by
45 to the message queue referred to by the descriptor
49 argument specifies the length of the message pointed to by
51 this length must be less than or equal to the queue's
54 Zero-length messages are allowed.
58 argument is a non-negative integer that specifies the priority
60 Messages are placed on the queue in decreasing order of priority,
61 with newer messages of the same priority being placed after
62 older messages with the same priority.
64 If the message queue is already full
65 (i.e., the number of messages on the queue equals the queue's
67 attribute), then, by default,
69 blocks until sufficient space becomes available to allow the message
70 to be queued, or until the call is interrupted by a signal handler.
73 flag is enabled for the message queue description,
74 then the call instead fails immediately with the error
80 except that if the queue is full and the
82 flag is not enabled for the message queue description, then
84 points to a structure which specifies a ceiling on the time for which
86 This ceiling is an absolute timeout in seconds and nanoseconds
87 since the Epoch (midnight on the morning of 1 January 1970),
88 specified in the following structure:
93 time_t tv_sec; /* seconds */
94 long tv_nsec; /* nanoseconds */
99 If the message queue is full,
100 and the timeout has already expired by the time of the call,
108 return zero; on error, \-1 is returned, with
110 set to indicate the error.
114 The queue was empty, and the
116 flag was set for the message queue description referred to by
120 The descriptor specified in
128 attribute of the message queue.
131 The call was interrupted by a signal handler.
134 The call would have blocked, and
136 was invalid, either because
138 was less than zero, or because
140 was less than zero or greater than 1000 million.
143 The call timed out before a message could be transferred.
153 .BR feature_test_macros (7),