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

4.115
Last change on this file since cf301c9 was cf301c9, checked in by Alex Ivanov <alexivanov97@…>, on 01/07/13 at 14:53:43

posix: Doxygen Clean Up Task #1

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