source: rtems/cpukit/posix/include/rtems/posix/mqueue.h @ eb08acf

4.115
Last change on this file since eb08acf was eb08acf, checked in by Mathew Kallada <matkallada@…>, on 12/15/12 at 20:41:05

posix: Doxygen Enhancement Task #8

http://www.google-melange.com/gci/task/view/google/gci2012/8003213

  • Property mode set to 100644
File size: 7.3 KB
Line 
1/**
2 * @file rtems/posix/mqueue.h
3 *
4 * This include file contains all the private support information for
5 * POSIX Message Queues.
6 *
7 *  The structure of the routines is identical to that of POSIX
8 *  Message_queues to leave the option of having unnamed message
9 *  queues at a future date.  They are currently not part of the
10 *  POSIX standard but unnamed message_queues are.  This is also
11 *  the reason for the apparently unnecessary tracking of
12 *  the process_shared attribute.  [In addition to the fact that
13 *  it would be trivial to add pshared to the mq_attr structure
14 *  and have process private message queues.]
15 *
16 *  This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open
17 *  time.
18 */
19
20/*
21 *  COPYRIGHT (c) 1989-2011.
22 *  On-Line Applications Research Corporation (OAR).
23 *
24 *  The license and distribution terms for this file may be
25 *  found in the file LICENSE in this distribution or at
26 *  http://www.rtems.com/license/LICENSE.
27 */
28
29#ifndef _RTEMS_POSIX_MQUEUE_H
30#define _RTEMS_POSIX_MQUEUE_H
31
32#include <signal.h>
33#include <mqueue.h> /* struct mq_attr */
34#include <rtems/score/coremsg.h>
35#include <rtems/score/object.h>
36#include <rtems/posix/posixapi.h>
37
38/**
39 *  @defgroup POSIX_MQUEUE_P Message Queues Private Support Information
40 *
41 *  @ingroup POSIX
42 */
43/**@{*/
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48/**
49 *  @ingroup POSIX_MQUEUE
50 */
51
52/*
53 *  Data Structure used to manage a POSIX message queue
54 */
55
56typedef struct {
57   Objects_Control             Object;
58   int                         process_shared;
59   bool                        named;
60   bool                        linked;
61   uint32_t                    open_count;
62   CORE_message_queue_Control  Message_queue;
63   struct sigevent             notification;
64}  POSIX_Message_queue_Control;
65
66typedef struct {
67   Objects_Control              Object;
68   POSIX_Message_queue_Control *Queue;
69   int                          oflag;
70} POSIX_Message_queue_Control_fd;
71
72/*
73 *  The following defines the information control block used to manage
74 *  this class of objects.  The second item is used to manage the set
75 *  of "file descriptors" associated with the message queues.
76 */
77
78POSIX_EXTERN Objects_Information  _POSIX_Message_queue_Information;
79POSIX_EXTERN Objects_Information  _POSIX_Message_queue_Information_fds;
80
81/*
82 *  @brief Initializes message_queue Manager Related Data Structures
83 *
84 *  DESCRIPTION:
85 *
86 *  This routine performs the initialization necessary for this manager.
87 *
88 *  NOTE:  The structure of the routines is identical to that of POSIX
89 *         Message_queues to leave the option of having unnamed message
90 *         queues at a future date.  They are currently not part of the
91 *         POSIX standard but unnamed message_queues are.  This is also
92 *         the reason for the apparently unnecessary tracking of
93 *         the process_shared attribute.  [In addition to the fact that
94 *         it would be trivial to add pshared to the mq_attr structure
95 *         and have process private message queues.]
96 *
97 *         This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open
98 *         time.
99 *
100 */
101
102void _POSIX_Message_queue_Manager_initialization(void);
103
104/*
105 *
106 *  _POSIX_Message_queue_Create_support
107 *
108 *  DESCRIPTION:
109 *
110 *  This routine performs the creation of a message queue utilizing the
111 *  core message queue.
112 */
113
114int _POSIX_Message_queue_Create_support(
115  const char                    *name,
116  size_t                         name_len,
117  int                            pshared,
118  struct mq_attr                *attr,
119  POSIX_Message_queue_Control  **message_queue
120);
121
122/**
123 *  @brief POSIX Delete Message Queue
124 *
125 *  DESCRIPTION:
126 *
127 *  This routine supports the mq_unlink and mq_close routines by
128 *  doing most of the work involved with removing a message queue.
129 */
130void _POSIX_Message_queue_Delete(
131  POSIX_Message_queue_Control *the_mq
132);
133
134/*
135 *  @brief POSIX Message Queue Receive Support
136 *
137 *  DESCRIPTION:
138 *
139 *  This routine supports the various flavors of receiving a message.
140 *
141 *  NOTE:  The structure of the routines is identical to that of POSIX
142 *         Message_queues to leave the option of having unnamed message
143 *         queues at a future date.  They are currently not part of the
144 *         POSIX standard but unnamed message_queues are.  This is also
145 *         the reason for the apparently unnecessary tracking of
146 *         the process_shared attribute.  [In addition to the fact that
147 *         it would be trivial to add pshared to the mq_attr structure
148 *         and have process private message queues.]
149 *
150 *         This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open
151 *         time.
152 */
153
154ssize_t _POSIX_Message_queue_Receive_support(
155  mqd_t               mqdes,
156  char               *msg_ptr,
157  size_t              msg_len,
158  unsigned int       *msg_prio,
159  bool                wait,
160  Watchdog_Interval   timeout
161);
162
163/*
164 *  _POSIX_Message_queue_Send_support
165 *
166 *  DESCRIPTION:
167 *
168 *  This routine posts a message to a specified message queue.
169 */
170
171int _POSIX_Message_queue_Send_support(
172  mqd_t               mqdes,
173  const char         *msg_ptr,
174  size_t              msg_len,
175  unsigned int        msg_prio,
176  bool                wait,
177  Watchdog_Interval   timeout
178);
179
180/*
181 *  _POSIX_Message_queue_Allocate
182 *
183 *  DESCRIPTION:
184 *
185 *  This function allocates a message queue control block from
186 *  the inactive chain of free message queue control blocks.
187 */
188
189RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void );
190
191/*
192 *  _POSIX_Message_queue_Free
193 *
194 *  DESCRIPTION:
195 *
196 *  This routine frees a message queue control block to the
197 *  inactive chain of free message queue control blocks.
198 */
199
200RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Free (
201  POSIX_Message_queue_Control *the_mq
202);
203
204/*
205 *  _POSIX_Message_queue_Get
206 *
207 *  DESCRIPTION:
208 *
209 *  This function maps message queue IDs to message queue control blocks.
210 *  If ID corresponds to a local message queue, then it returns
211 *  the_mq control pointer which maps to ID and location
212 *  is set to OBJECTS_LOCAL.  if the message queue ID is global and
213 *  resides on a remote node, then location is set to OBJECTS_REMOTE,
214 *  and the_message queue is undefined.  Otherwise, location is set
215 *  to OBJECTS_ERROR and the_mq is undefined.
216 */
217
218RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get (
219  Objects_Id         id,
220  Objects_Locations *location
221);
222
223/*
224 *  _POSIX_Message_queue_Is_null
225 *
226 *  DESCRIPTION:
227 *
228 *  This function returns TRUE if the_message_queue is NULL and FALSE otherwise.
229 */
230
231RTEMS_INLINE_ROUTINE bool    _POSIX_Message_queue_Is_null (
232  POSIX_Message_queue_Control *the_mq
233);
234
235/*
236 *  _POSIX_Message_queue_Priority_to_core
237 *
238 *  DESCRIPTION:
239 *
240 *  XXX
241 */
242
243RTEMS_INLINE_ROUTINE CORE_message_queue_Submit_types _POSIX_Message_queue_Priority_to_core(
244  unsigned int priority
245);
246
247/*
248 *  _POSIX_Message_queue_Priority_from_core
249 *
250 *  DESCRIPTION:
251 *
252 *  XXX
253 */
254
255RTEMS_INLINE_ROUTINE unsigned int _POSIX_Message_queue_Priority_from_core(
256  CORE_message_queue_Submit_types priority
257);
258
259/*
260 *  _POSIX_Message_queue_Translate_core_message_queue_return_code
261 *
262 *  DESCRIPTION:
263 *
264 *  XXX
265 */
266
267int _POSIX_Message_queue_Translate_core_message_queue_return_code(
268  uint32_t   the_message_queue_status
269);
270
271
272#include <rtems/posix/mqueue.inl>
273
274#ifdef __cplusplus
275}
276#endif
277/**@}*/
278#endif
279/*  end of include file */
Note: See TracBrowser for help on using the repository browser.