Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:21

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup POSIXAPI
0007  *
0008  * @brief Adds Message Pointed by msg_ptr to Message Queue Reffered by mqdes 
0009  */
0010 
0011 /*
0012  *  NOTE:  The structure of the routines is identical to that of POSIX
0013  *         Message_queues to leave the option of having unnamed message
0014  *         queues at a future date.  They are currently not part of the
0015  *         POSIX standard but unnamed message_queues are.  This is also
0016  *         the reason for the apparently unnecessary tracking of
0017  *         the process_shared attribute.  [In addition to the fact that
0018  *         it would be trivial to add pshared to the mq_attr structure
0019  *         and have process private message queues.]
0020  *
0021  *         This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open
0022  *         time.
0023  *
0024  *  COPYRIGHT (c) 1989-2008.
0025  *  On-Line Applications Research Corporation (OAR).
0026  *
0027  * Redistribution and use in source and binary forms, with or without
0028  * modification, are permitted provided that the following conditions
0029  * are met:
0030  * 1. Redistributions of source code must retain the above copyright
0031  *    notice, this list of conditions and the following disclaimer.
0032  * 2. Redistributions in binary form must reproduce the above copyright
0033  *    notice, this list of conditions and the following disclaimer in the
0034  *    documentation and/or other materials provided with the distribution.
0035  *
0036  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0037  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0038  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0039  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0040  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0041  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0042  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0043  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0044  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0045  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0046  * POSSIBILITY OF SUCH DAMAGE.
0047  */
0048 
0049 #ifdef HAVE_CONFIG_H
0050 #include "config.h"
0051 #endif
0052 
0053 #include <stdarg.h>
0054 
0055 #include <pthread.h>
0056 #include <limits.h>
0057 #include <errno.h>
0058 #include <fcntl.h>
0059 #include <mqueue.h>
0060 
0061 #include <rtems/score/watchdog.h>
0062 #include <rtems/seterr.h>
0063 #include <rtems/posix/mqueueimpl.h>
0064 
0065 /*
0066  *  15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
0067  *
0068  *  NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
0069  */
0070 
0071 int mq_send(
0072   mqd_t         mqdes,
0073   const char   *msg_ptr,
0074   size_t        msg_len,
0075   unsigned int  msg_prio
0076 )
0077 {
0078   return _POSIX_Message_queue_Send_support(
0079     mqdes,
0080     msg_ptr,
0081     msg_len,
0082     msg_prio,
0083     NULL,
0084     _Thread_queue_Enqueue_do_nothing_extra
0085   );
0086 }