RTEMS
msgqsend.c
Go to the documentation of this file.
1 
9 /*
10  * COPYRIGHT (c) 1989-2014.
11  * On-Line Applications Research Corporation (OAR).
12  *
13  * The license and distribution terms for this file may be
14  * found in the file LICENSE in this distribution or at
15  * http://www.rtems.org/license/LICENSE.
16  */
17 
18 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
21 
23 #include <rtems/rtems/statusimpl.h>
24 
26  rtems_id id,
27  const void *buffer,
28  size_t size
29 )
30 {
31  Message_queue_Control *the_message_queue;
32  Thread_queue_Context queue_context;
33  Status_Control status;
34 
35  if ( buffer == NULL ) {
36  return RTEMS_INVALID_ADDRESS;
37  }
38 
39  the_message_queue = _Message_queue_Get( id, &queue_context );
40 
41  if ( the_message_queue == NULL ) {
42 #if defined(RTEMS_MULTIPROCESSING)
43  return _Message_queue_MP_Send( id, buffer, size );
44 #else
45  return RTEMS_INVALID_ID;
46 #endif
47  }
48 
50  &the_message_queue->message_queue,
51  &queue_context
52  );
54  &queue_context,
55  _Message_queue_Core_message_queue_mp_support
56  );
57  status = _CORE_message_queue_Send(
58  &the_message_queue->message_queue,
59  buffer,
60  size,
61  false, /* sender does not block */
62  &queue_context
63  );
64  return _Status_Get( status );
65 }
Thread queue context for the thread queue methods.
Definition: threadq.h:198
Classic Message Queue Manager Implementation.
#define _Thread_queue_Context_set_MP_callout(queue_context, mp_callout)
Sets the MP callout in the thread queue context.
Definition: threadqimpl.h:456
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
Classic Status Implementation.
CORE_message_queue_Control message_queue
Definition: messagedata.h:42
This status code indicates that a specified address was invalid.
Definition: status.h:133
static __inline__ Status_Control _CORE_message_queue_Send(CORE_message_queue_Control *the_message_queue, const void *buffer, size_t size, bool wait, Thread_queue_Context *queue_context)
Sends a message to the message queue.
Definition: coremsgimpl.h:357
This status code indicates that an object identifier was invalid.
Definition: status.h:106
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
rtems_status_code rtems_message_queue_send(rtems_id id, const void *buffer, size_t size)
%
Definition: msgqsend.c:25
static __inline__ void _CORE_message_queue_Acquire_critical(CORE_message_queue_Control *the_message_queue, Thread_queue_Context *queue_context)
Acquires the message queue critical.
Definition: coremsgimpl.h:432