source: rtems/cpukit/posix/include/rtems/posix/mqueue.h @ 8eaf3bce

4.115
Last change on this file since 8eaf3bce was 8eaf3bce, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/24/11 at 15:09:54

Add missing includes.

  • Property mode set to 100644
File size: 5.5 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
8/*
9 *  COPYRIGHT (c) 1989-2008.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#ifndef _RTEMS_POSIX_MQUEUE_H
20#define _RTEMS_POSIX_MQUEUE_H
21
22#include <signal.h>
23#include <mqueue.h> /* struct mq_attr */
24#include <rtems/score/coremsg.h>
25#include <rtems/score/object.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/*
32 *  Data Structure used to manage a POSIX message queue
33 */
34
35typedef struct {
36   Objects_Control             Object;
37   int                         process_shared;
38   bool                        named;
39   bool                        linked;
40   uint32_t                    open_count;
41   CORE_message_queue_Control  Message_queue;
42   struct sigevent             notification;
43}  POSIX_Message_queue_Control;
44
45typedef struct {
46   Objects_Control              Object;
47   POSIX_Message_queue_Control *Queue;
48   int                          oflag;
49} POSIX_Message_queue_Control_fd;
50
51/*
52 *  The following defines the information control block used to manage
53 *  this class of objects.  The second item is used to manage the set
54 *  of "file descriptors" associated with the message queues.
55 */
56
57POSIX_EXTERN Objects_Information  _POSIX_Message_queue_Information;
58POSIX_EXTERN Objects_Information  _POSIX_Message_queue_Information_fds;
59
60/*
61 *  _POSIX_Message_queue_Manager_initialization
62 *
63 *  DESCRIPTION:
64 *
65 *  This routine performs the initialization necessary for this manager.
66 */
67
68void _POSIX_Message_queue_Manager_initialization(void);
69
70/*
71 *
72 *  _POSIX_Message_queue_Create_support
73 *
74 *  DESCRIPTION:
75 *
76 *  This routine performs the creation of a message queue utilizing the
77 *  core message queue.
78 */
79
80int _POSIX_Message_queue_Create_support(
81  const char                    *name,
82  int                            pshared,
83  struct mq_attr                *attr,
84  POSIX_Message_queue_Control  **message_queue
85);
86
87/*
88 *  _POSIX_Message_queue_Delete
89 *
90 *  DESCRIPTION:
91 *
92 *  This routine supports the mq_unlink and mq_close routines by
93 *  doing most of the work involved with removing a message queue.
94 */
95
96void _POSIX_Message_queue_Delete(
97  POSIX_Message_queue_Control *the_mq
98);
99
100/*
101 *  _POSIX_Message_queue_Receive_support
102 *
103 *  DESCRIPTION:
104 *
105 *  This routine supports the various flavors of receiving a message.
106 */
107
108ssize_t _POSIX_Message_queue_Receive_support(
109  mqd_t               mqdes,
110  char               *msg_ptr,
111  size_t              msg_len,
112  unsigned int       *msg_prio,
113  bool                wait,
114  Watchdog_Interval   timeout
115);
116
117/*
118 *  _POSIX_Message_queue_Send_support
119 *
120 *  DESCRIPTION:
121 *
122 *  This routine posts a message to a specified message queue.
123 */
124
125int _POSIX_Message_queue_Send_support(
126  mqd_t               mqdes,
127  const char         *msg_ptr,
128  size_t              msg_len,
129  uint32_t            msg_prio,
130  bool                wait,
131  Watchdog_Interval   timeout
132);
133
134/*
135 *  _POSIX_Message_queue_Allocate
136 *
137 *  DESCRIPTION:
138 *
139 *  This function allocates a message queue control block from
140 *  the inactive chain of free message queue control blocks.
141 */
142
143RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void );
144
145/*
146 *  _POSIX_Message_queue_Free
147 *
148 *  DESCRIPTION:
149 *
150 *  This routine frees a message queue control block to the
151 *  inactive chain of free message queue control blocks.
152 */
153
154RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Free (
155  POSIX_Message_queue_Control *the_mq
156);
157
158/*
159 *  _POSIX_Message_queue_Get
160 *
161 *  DESCRIPTION:
162 *
163 *  This function maps message queue IDs to message queue control blocks.
164 *  If ID corresponds to a local message queue, then it returns
165 *  the_mq control pointer which maps to ID and location
166 *  is set to OBJECTS_LOCAL.  if the message queue ID is global and
167 *  resides on a remote node, then location is set to OBJECTS_REMOTE,
168 *  and the_message queue is undefined.  Otherwise, location is set
169 *  to OBJECTS_ERROR and the_mq is undefined.
170 */
171
172RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get (
173  Objects_Id         id,
174  Objects_Locations *location
175);
176
177/*
178 *  _POSIX_Message_queue_Is_null
179 *
180 *  DESCRIPTION:
181 *
182 *  This function returns TRUE if the_message_queue is NULL and FALSE otherwise.
183 */
184
185RTEMS_INLINE_ROUTINE bool    _POSIX_Message_queue_Is_null (
186  POSIX_Message_queue_Control *the_mq
187);
188
189/*
190 *  _POSIX_Message_queue_Name_to_id
191 *
192 *  DESCRIPTION:
193 *
194 *  This routine looks up the specified name for a message queue and returns the
195 *  id of the message queue associated with it.
196 */
197
198int _POSIX_Message_queue_Name_to_id(
199  const char          *name,
200  Objects_Id          *id
201);
202
203/*
204 *  _POSIX_Message_queue_Priority_to_core
205 *
206 *  DESCRIPTION:
207 *
208 *  XXX
209 */
210
211RTEMS_INLINE_ROUTINE CORE_message_queue_Submit_types _POSIX_Message_queue_Priority_to_core(
212  unsigned int priority
213);
214
215/*
216 *  _POSIX_Message_queue_Priority_from_core
217 *
218 *  DESCRIPTION:
219 *
220 *  XXX
221 */
222
223RTEMS_INLINE_ROUTINE unsigned int _POSIX_Message_queue_Priority_from_core(
224  CORE_message_queue_Submit_types priority
225);
226
227/*PAGE
228 *
229 *  _POSIX_Message_queue_Translate_core_message_queue_return_code
230 *
231 *  DESCRIPTION:
232 *
233 *  XXX
234 */
235
236int _POSIX_Message_queue_Translate_core_message_queue_return_code(
237  uint32_t   the_message_queue_status
238);
239
240
241#include <rtems/posix/mqueue.inl>
242
243#ifdef __cplusplus
244}
245#endif
246
247#endif
248/*  end of include file */
Note: See TracBrowser for help on using the repository browser.