2 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .TH mq_send 3 (date) "Linux man-pages (unreleased)"
8 mq_send, mq_timedsend \- send a message to a message queue
11 .RI ( librt ", " \-lrt )
14 .B #include <mqueue.h>
16 .BI "int mq_send(mqd_t " mqdes ", const char " msg_ptr [. msg_len ],
17 .BI " size_t " msg_len ", unsigned int " msg_prio );
20 .B #include <mqueue.h>
22 .BI "int mq_timedsend(mqd_t " mqdes ", const char " msg_ptr [. msg_len ],
23 .BI " size_t " msg_len ", unsigned int " msg_prio ,
24 .BI " const struct timespec *" abs_timeout );
29 Feature Test Macro Requirements for glibc (see
30 .BR feature_test_macros (7)):
35 _POSIX_C_SOURCE >= 200112L
39 adds the message pointed to by
41 to the message queue referred to by the message queue descriptor
45 argument specifies the length of the message pointed to by
47 this length must be less than or equal to the queue's
50 Zero-length messages are allowed.
54 argument is a nonnegative integer that specifies the priority
56 Messages are placed on the queue in decreasing order of priority,
57 with newer messages of the same priority being placed after
58 older messages with the same priority.
61 for details on the range for the message priority.
63 If the message queue is already full
64 (i.e., the number of messages on the queue equals the queue's
66 attribute), then, by default,
68 blocks until sufficient space becomes available to allow the message
69 to be queued, or until the call is interrupted by a signal handler.
72 flag is enabled for the message queue description,
73 then the call instead fails immediately with the error
79 except that if the queue is full and the
81 flag is not enabled for the message queue description, then
83 points to a structure which specifies how long the call will block.
84 This value is an absolute timeout in seconds and nanoseconds
85 since the Epoch, 1970-01-01 00:00:00 +0000 (UTC),
90 If the message queue is full,
91 and the timeout has already expired by the time of the call,
99 return zero; on error, \-1 is returned, with
101 set to indicate the error.
105 The queue was full, and the
107 flag was set for the message queue description referred to by
111 The descriptor specified in
113 was invalid or not opened for writing.
116 The call was interrupted by a signal handler; see
120 The call would have blocked, and
122 was invalid, either because
124 was less than zero, or because
126 was less than zero or greater than 1000 million.
132 attribute of the message queue.
135 The call timed out before a message could be transferred.
137 For an explanation of the terms used in this section, see
145 Interface Attribute Value
149 T} Thread safety MT-Safe
155 POSIX.1-2001, POSIX.1-2008.
159 is a system call, and
161 is a library function layered on top of that system call.