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 Receive Message from Message Queue
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 
0025 /*
0026  *  COPYRIGHT (c) 1989-2008.
0027  *  On-Line Applications Research Corporation (OAR).
0028  *
0029  * Redistribution and use in source and binary forms, with or without
0030  * modification, are permitted provided that the following conditions
0031  * are met:
0032  * 1. Redistributions of source code must retain the above copyright
0033  *    notice, this list of conditions and the following disclaimer.
0034  * 2. Redistributions in binary form must reproduce the above copyright
0035  *    notice, this list of conditions and the following disclaimer in the
0036  *    documentation and/or other materials provided with the distribution.
0037  *
0038  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0039  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0040  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0041  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0042  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0043  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0044  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0045  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0046  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0047  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0048  * POSSIBILITY OF SUCH DAMAGE.
0049  */
0050 
0051 #ifdef HAVE_CONFIG_H
0052 #include "config.h"
0053 #endif
0054 
0055 #include <rtems/posix/mqueueimpl.h>
0056 
0057 /*
0058  *  15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
0059  *
0060  *  NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
0061  */
0062 
0063 ssize_t mq_timedreceive(
0064   mqd_t                  mqdes,
0065   char                  *__restrict msg_ptr,
0066   size_t                 msg_len,
0067   unsigned int          *__restrict msg_prio,
0068   const struct timespec *__restrict abstime
0069 )
0070 {
0071   return _POSIX_Message_queue_Receive_support(
0072     mqdes,
0073     msg_ptr,
0074     msg_len,
0075     msg_prio,
0076     abstime,
0077     _Thread_queue_Add_timeout_realtime_timespec
0078   );
0079 }