1 | /* rtems/posix/mqueue.h |
---|
2 | * |
---|
3 | * This include file contains all the private support information for |
---|
4 | * POSIX Message Queues. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
12 | * notice must appear in all copies of this file and its derivatives. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __RTEMS_POSIX_MESSAGE_QUEUE_h |
---|
18 | #define __RTEMS_POSIX_MESSAGE_QUEUE_h |
---|
19 | |
---|
20 | #ifdef __cplusplus |
---|
21 | extern "C" { |
---|
22 | #endif |
---|
23 | |
---|
24 | #include <rtems/score/coremsg.h> |
---|
25 | #include <rtems/score/object.h> |
---|
26 | |
---|
27 | /* |
---|
28 | * Data Structure used to manage a POSIX message queue |
---|
29 | */ |
---|
30 | |
---|
31 | typedef struct { |
---|
32 | Objects_Control Object; |
---|
33 | int process_shared; |
---|
34 | int flags; |
---|
35 | boolean named; |
---|
36 | boolean linked; |
---|
37 | boolean blocking; |
---|
38 | unsigned32 open_count; |
---|
39 | CORE_message_queue_Control Message_queue; |
---|
40 | struct sigevent notification; |
---|
41 | } POSIX_Message_queue_Control; |
---|
42 | |
---|
43 | /* |
---|
44 | * The following defines the information control block used to manage |
---|
45 | * this class of objects. |
---|
46 | */ |
---|
47 | |
---|
48 | EXTERN Objects_Information _POSIX_Message_queue_Information; |
---|
49 | |
---|
50 | /* |
---|
51 | * _POSIX_Message_queue_Manager_initialization |
---|
52 | * |
---|
53 | * DESCRIPTION: |
---|
54 | * |
---|
55 | * This routine performs the initialization necessary for this manager. |
---|
56 | */ |
---|
57 | |
---|
58 | void _POSIX_Message_queue_Manager_initialization( |
---|
59 | unsigned32 maximum_message_queues |
---|
60 | ); |
---|
61 | |
---|
62 | /* |
---|
63 | * |
---|
64 | * _POSIX_Message_queue_Create_support |
---|
65 | * |
---|
66 | * DESCRIPTION: |
---|
67 | * |
---|
68 | * This routine performs the creation of a message queue utilizing the |
---|
69 | * core message queue. |
---|
70 | */ |
---|
71 | |
---|
72 | int _POSIX_Message_queue_Create_support( |
---|
73 | const char *name, |
---|
74 | int pshared, |
---|
75 | unsigned int oflag, |
---|
76 | struct mq_attr *attr, |
---|
77 | POSIX_Message_queue_Control **message_queue |
---|
78 | ); |
---|
79 | |
---|
80 | /* |
---|
81 | * |
---|
82 | * _POSIX_Message_queue_Send_support |
---|
83 | * |
---|
84 | * DESCRIPTION: |
---|
85 | * |
---|
86 | * This routine posts a message to a specified message queue. |
---|
87 | */ |
---|
88 | |
---|
89 | int _POSIX_Message_queue_Send_support( |
---|
90 | mqd_t mqdes, |
---|
91 | const char *msg_ptr, |
---|
92 | unsigned32 msg_len, |
---|
93 | Priority_Control msg_prio, |
---|
94 | Watchdog_Interval timeout |
---|
95 | ); |
---|
96 | |
---|
97 | /* |
---|
98 | * _POSIX_Message_queue_Allocate |
---|
99 | * |
---|
100 | * DESCRIPTION: |
---|
101 | * |
---|
102 | * This function allocates a message queue control block from |
---|
103 | * the inactive chain of free message queue control blocks. |
---|
104 | */ |
---|
105 | |
---|
106 | STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void ); |
---|
107 | |
---|
108 | /* |
---|
109 | * _POSIX_Message_queue_Free |
---|
110 | * |
---|
111 | * DESCRIPTION: |
---|
112 | * |
---|
113 | * This routine frees a message queue control block to the |
---|
114 | * inactive chain of free message queue control blocks. |
---|
115 | */ |
---|
116 | |
---|
117 | STATIC INLINE void _POSIX_Message_queue_Free ( |
---|
118 | POSIX_Message_queue_Control *the_mq |
---|
119 | ); |
---|
120 | |
---|
121 | /* |
---|
122 | * _POSIX_Message_queue_Get |
---|
123 | * |
---|
124 | * DESCRIPTION: |
---|
125 | * |
---|
126 | * This function maps message queue IDs to message queue control blocks. |
---|
127 | * If ID corresponds to a local message queue, then it returns |
---|
128 | * the_mq control pointer which maps to ID and location |
---|
129 | * is set to OBJECTS_LOCAL. if the message queue ID is global and |
---|
130 | * resides on a remote node, then location is set to OBJECTS_REMOTE, |
---|
131 | * and the_message queue is undefined. Otherwise, location is set |
---|
132 | * to OBJECTS_ERROR and the_mq is undefined. |
---|
133 | */ |
---|
134 | |
---|
135 | STATIC INLINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get ( |
---|
136 | Objects_Id id, |
---|
137 | Objects_Locations *location |
---|
138 | ); |
---|
139 | |
---|
140 | /* |
---|
141 | * _POSIX_Message_queue_Is_null |
---|
142 | * |
---|
143 | * DESCRIPTION: |
---|
144 | * |
---|
145 | * This function returns TRUE if the_message_queue is NULL and FALSE otherwise. |
---|
146 | */ |
---|
147 | |
---|
148 | STATIC INLINE boolean _POSIX_Message_queue_Is_null ( |
---|
149 | POSIX_Message_queue_Control *the_mq |
---|
150 | ); |
---|
151 | |
---|
152 | /* |
---|
153 | * _POSIX_Message_queue_Name_to_id |
---|
154 | * |
---|
155 | * DESCRIPTION: |
---|
156 | * |
---|
157 | * XXX |
---|
158 | */ |
---|
159 | |
---|
160 | int _POSIX_Message_queue_Name_to_id( |
---|
161 | const char *name, |
---|
162 | Objects_Id *id |
---|
163 | ); |
---|
164 | |
---|
165 | /* |
---|
166 | * _POSIX_Message_queue_Priority_to_core |
---|
167 | * |
---|
168 | * DESCRIPTION: |
---|
169 | * |
---|
170 | * XXX |
---|
171 | */ |
---|
172 | |
---|
173 | STATIC INLINE Priority_Control _POSIX_Message_queue_Priority_to_core( |
---|
174 | unsigned int priority |
---|
175 | ); |
---|
176 | |
---|
177 | #include <rtems/posix/mqueue.inl> |
---|
178 | #include <rtems/posix/mqueuemp.h> |
---|
179 | |
---|
180 | #ifdef __cplusplus |
---|
181 | } |
---|
182 | #endif |
---|
183 | |
---|
184 | #endif |
---|
185 | /* end of include file */ |
---|
186 | |
---|