logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

mq_send.3p (6274B)


  1. '\" et
  2. .TH MQ_SEND "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. mq_send,
  12. mq_timedsend
  13. \(em send a message to a message queue (\fBREALTIME\fP)
  14. .SH SYNOPSIS
  15. .LP
  16. .nf
  17. #include <mqueue.h>
  18. .P
  19. int mq_send(mqd_t \fImqdes\fP, const char *\fImsg_ptr\fP, size_t \fImsg_len\fP,
  20. unsigned \fImsg_prio\fP);
  21. .P
  22. #include <mqueue.h>
  23. #include <time.h>
  24. .P
  25. int mq_timedsend(mqd_t \fImqdes\fP, const char *\fImsg_ptr\fP, size_t \fImsg_len\fP,
  26. unsigned \fImsg_prio\fP, const struct timespec *\fIabstime\fP);
  27. .fi
  28. .SH DESCRIPTION
  29. The
  30. \fImq_send\fR()
  31. function shall add the message pointed to by the argument
  32. .IR msg_ptr
  33. to the message queue specified by
  34. .IR mqdes .
  35. The
  36. .IR msg_len
  37. argument specifies the length of the message, in bytes, pointed to by
  38. .IR msg_ptr .
  39. The value of
  40. .IR msg_len
  41. shall be less than or equal to the
  42. .IR mq_msgsize
  43. attribute of the message queue, or
  44. \fImq_send\fR()
  45. shall fail.
  46. .P
  47. If the specified message queue is not full,
  48. \fImq_send\fR()
  49. shall behave as if the message is inserted into the message queue at
  50. the position indicated by the
  51. .IR msg_prio
  52. argument. A message with a larger numeric value of
  53. .IR msg_prio
  54. shall be inserted before messages with lower values of
  55. .IR msg_prio .
  56. A message shall be inserted after other messages in the queue, if any,
  57. with equal
  58. .IR msg_prio .
  59. The value of
  60. .IR msg_prio
  61. shall be less than
  62. {MQ_PRIO_MAX}.
  63. .P
  64. If the specified message queue is full and O_NONBLOCK
  65. is not set in the message queue description associated with
  66. .IR mqdes ,
  67. \fImq_send\fR()
  68. shall block until space becomes available to enqueue the message, or
  69. until
  70. \fImq_send\fR()
  71. is interrupted by a signal. If more than one thread is waiting to send
  72. when space becomes available in the message queue and the Priority
  73. Scheduling option is supported, then the thread of the highest priority
  74. that has been waiting the longest shall be unblocked to send its
  75. message. Otherwise, it is unspecified which waiting thread is
  76. unblocked. If the specified message queue is full and O_NONBLOCK is
  77. set in the message queue description associated with
  78. .IR mqdes ,
  79. the message shall not be queued and
  80. \fImq_send\fR()
  81. shall return an error.
  82. .P
  83. The
  84. \fImq_timedsend\fR()
  85. function shall add a message to the message queue specified by
  86. .IR mqdes
  87. in the manner defined for the
  88. \fImq_send\fR()
  89. function. However, if the specified message queue is full and
  90. O_NONBLOCK is not set in the message queue description associated with
  91. .IR mqdes ,
  92. the wait for sufficient room in the queue shall be terminated when the
  93. specified timeout expires. If O_NONBLOCK is set in the message queue
  94. description, this function shall be equivalent to
  95. \fImq_send\fR().
  96. .P
  97. The timeout shall expire when the absolute time specified by
  98. .IR abstime
  99. passes, as measured by the clock on which timeouts are based (that is,
  100. when the value of that clock equals or exceeds
  101. .IR abstime ),
  102. or if the absolute time specified by
  103. .IR abstime
  104. has already been passed at the time of the call.
  105. .P
  106. The timeout shall be based on the CLOCK_REALTIME clock.
  107. The resolution of the timeout shall be the resolution of the clock on
  108. which it is based. The
  109. .IR timespec
  110. argument is defined in the
  111. .IR <time.h>
  112. header.
  113. .P
  114. Under no circumstance shall the operation fail with a timeout if there
  115. is sufficient room in the queue to add the message immediately. The
  116. validity of the
  117. .IR abstime
  118. parameter need not be checked when there is sufficient room in the
  119. queue.
  120. .SH "RETURN VALUE"
  121. Upon successful completion, the
  122. \fImq_send\fR()
  123. and
  124. \fImq_timedsend\fR()
  125. functions shall return a value of zero. Otherwise, no message shall be
  126. enqueued, the functions shall return \-1, and
  127. .IR errno
  128. shall be set to indicate the error.
  129. .SH ERRORS
  130. The
  131. \fImq_send\fR()
  132. and
  133. \fImq_timedsend\fR()
  134. functions shall fail if:
  135. .TP
  136. .BR EAGAIN
  137. The O_NONBLOCK flag is set in the message queue description associated
  138. with
  139. .IR mqdes ,
  140. and the specified message queue is full.
  141. .TP
  142. .BR EBADF
  143. The
  144. .IR mqdes
  145. argument is not a valid message queue descriptor open for writing.
  146. .TP
  147. .BR EINTR
  148. A signal interrupted the call to
  149. \fImq_send\fR()
  150. or
  151. \fImq_timedsend\fR().
  152. .TP
  153. .BR EINVAL
  154. The value of
  155. .IR msg_prio
  156. was outside the valid range.
  157. .TP
  158. .BR EINVAL
  159. The process or thread would have blocked, and the
  160. .IR abstime
  161. parameter specified a nanoseconds field value less than zero or greater
  162. than or equal to 1\|000 million.
  163. .TP
  164. .BR EMSGSIZE
  165. The specified message length,
  166. .IR msg_len ,
  167. exceeds the message size attribute of the message queue.
  168. .TP
  169. .BR ETIMEDOUT
  170. The O_NONBLOCK flag was not set when the message queue was opened, but
  171. the timeout expired before the message could be added to the queue.
  172. .LP
  173. .IR "The following sections are informative."
  174. .SH EXAMPLES
  175. None.
  176. .SH "APPLICATION USAGE"
  177. The value of the symbol
  178. {MQ_PRIO_MAX}
  179. limits the number of priority levels supported by the application.
  180. Message priorities range from 0 to
  181. {MQ_PRIO_MAX}\-1.
  182. .SH RATIONALE
  183. None.
  184. .SH "FUTURE DIRECTIONS"
  185. None.
  186. .SH "SEE ALSO"
  187. .IR "\fImq_open\fR\^(\|)",
  188. .IR "\fImq_receive\fR\^(\|)",
  189. .IR "\fImq_setattr\fR\^(\|)",
  190. .IR "\fItime\fR\^(\|)"
  191. .P
  192. The Base Definitions volume of POSIX.1\(hy2017,
  193. .IR "\fB<mqueue.h>\fP",
  194. .IR "\fB<time.h>\fP"
  195. .\"
  196. .SH COPYRIGHT
  197. Portions of this text are reprinted and reproduced in electronic form
  198. from IEEE Std 1003.1-2017, Standard for Information Technology
  199. -- Portable Operating System Interface (POSIX), The Open Group Base
  200. Specifications Issue 7, 2018 Edition,
  201. Copyright (C) 2018 by the Institute of
  202. Electrical and Electronics Engineers, Inc and The Open Group.
  203. In the event of any discrepancy between this version and the original IEEE and
  204. The Open Group Standard, the original IEEE and The Open Group Standard
  205. is the referee document. The original Standard can be obtained online at
  206. http://www.opengroup.org/unix/online.html .
  207. .PP
  208. Any typographical or formatting errors that appear
  209. in this page are most likely
  210. to have been introduced during the conversion of the source files to
  211. man page format. To report such errors, see
  212. https://www.kernel.org/doc/man-pages/reporting_bugs.html .