1 | /** |
---|
2 | * @file rtems/posix/mqueue.inl |
---|
3 | */ |
---|
4 | |
---|
5 | /* rtems/posix/mqueue.inl |
---|
6 | * |
---|
7 | * This include file contains the static inline implementation of the private |
---|
8 | * inlined routines for POSIX Message Queue. |
---|
9 | * |
---|
10 | * COPYRIGHT (c) 1989-1999. |
---|
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.com/license/LICENSE. |
---|
16 | * |
---|
17 | * $Id$ |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef _RTEMS_POSIX_MQUEUE_H |
---|
21 | # error "Never use <rtems/posix/mqueue.inl> directly; include <rtems/posix/mqueue.h> instead." |
---|
22 | #endif |
---|
23 | |
---|
24 | #ifndef _RTEMS_POSIX_MQUEUE_INL |
---|
25 | #define _RTEMS_POSIX_MQUEUE_INL |
---|
26 | |
---|
27 | /*PAGE |
---|
28 | * |
---|
29 | * _POSIX_Message_queue_Allocate |
---|
30 | */ |
---|
31 | |
---|
32 | RTEMS_INLINE_ROUTINE |
---|
33 | POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void ) |
---|
34 | { |
---|
35 | return (POSIX_Message_queue_Control *) |
---|
36 | _Objects_Allocate( &_POSIX_Message_queue_Information ); |
---|
37 | } |
---|
38 | |
---|
39 | /*PAGE |
---|
40 | * |
---|
41 | * _POSIX_Message_queue_Allocate_fd |
---|
42 | */ |
---|
43 | |
---|
44 | RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control_fd * |
---|
45 | _POSIX_Message_queue_Allocate_fd( void ) |
---|
46 | { |
---|
47 | return (POSIX_Message_queue_Control_fd *) |
---|
48 | _Objects_Allocate( &_POSIX_Message_queue_Information_fds ); |
---|
49 | } |
---|
50 | |
---|
51 | /*PAGE |
---|
52 | * |
---|
53 | * _POSIX_Message_queue_Free |
---|
54 | */ |
---|
55 | |
---|
56 | RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Free ( |
---|
57 | POSIX_Message_queue_Control *the_mq |
---|
58 | ) |
---|
59 | { |
---|
60 | _Objects_Free( &_POSIX_Message_queue_Information, &the_mq->Object ); |
---|
61 | } |
---|
62 | |
---|
63 | /*PAGE |
---|
64 | * |
---|
65 | * _POSIX_Message_queue_Free_fd |
---|
66 | */ |
---|
67 | |
---|
68 | RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Free_fd ( |
---|
69 | POSIX_Message_queue_Control_fd *the_mq_fd |
---|
70 | ) |
---|
71 | { |
---|
72 | _Objects_Free( &_POSIX_Message_queue_Information_fds, &the_mq_fd->Object ); |
---|
73 | } |
---|
74 | |
---|
75 | /*PAGE |
---|
76 | * |
---|
77 | * _POSIX_Message_queue_Namespace_remove |
---|
78 | */ |
---|
79 | |
---|
80 | RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Namespace_remove ( |
---|
81 | POSIX_Message_queue_Control *the_mq |
---|
82 | ) |
---|
83 | { |
---|
84 | _Objects_Namespace_remove( |
---|
85 | &_POSIX_Message_queue_Information, &the_mq->Object ); |
---|
86 | } |
---|
87 | |
---|
88 | /*PAGE |
---|
89 | * |
---|
90 | * _POSIX_Message_queue_Get |
---|
91 | */ |
---|
92 | |
---|
93 | RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get ( |
---|
94 | Objects_Id id, |
---|
95 | Objects_Locations *location |
---|
96 | ) |
---|
97 | { |
---|
98 | return (POSIX_Message_queue_Control *) |
---|
99 | _Objects_Get( &_POSIX_Message_queue_Information, id, location ); |
---|
100 | } |
---|
101 | |
---|
102 | /*PAGE |
---|
103 | * |
---|
104 | * _POSIX_Message_queue_Get_fd |
---|
105 | */ |
---|
106 | |
---|
107 | RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control_fd *_POSIX_Message_queue_Get_fd ( |
---|
108 | Objects_Id id, |
---|
109 | Objects_Locations *location |
---|
110 | ) |
---|
111 | { |
---|
112 | return (POSIX_Message_queue_Control_fd *) |
---|
113 | _Objects_Get( &_POSIX_Message_queue_Information_fds, id, location ); |
---|
114 | } |
---|
115 | |
---|
116 | /*PAGE |
---|
117 | * |
---|
118 | * _POSIX_Message_queue_Is_null |
---|
119 | */ |
---|
120 | |
---|
121 | RTEMS_INLINE_ROUTINE boolean _POSIX_Message_queue_Is_null ( |
---|
122 | POSIX_Message_queue_Control *the_mq |
---|
123 | ) |
---|
124 | { |
---|
125 | return !the_mq; |
---|
126 | } |
---|
127 | |
---|
128 | /*PAGE |
---|
129 | * |
---|
130 | * _POSIX_Message_queue_Priority_to_core |
---|
131 | */ |
---|
132 | |
---|
133 | RTEMS_INLINE_ROUTINE CORE_message_queue_Submit_types _POSIX_Message_queue_Priority_to_core( |
---|
134 | unsigned int priority |
---|
135 | ) |
---|
136 | { |
---|
137 | return priority * -1; |
---|
138 | } |
---|
139 | |
---|
140 | /* |
---|
141 | * _POSIX_Message_queue_Priority_from_core |
---|
142 | * |
---|
143 | * DESCRIPTION: |
---|
144 | * |
---|
145 | * XXX |
---|
146 | */ |
---|
147 | |
---|
148 | RTEMS_INLINE_ROUTINE unsigned int _POSIX_Message_queue_Priority_from_core( |
---|
149 | CORE_message_queue_Submit_types priority |
---|
150 | ) |
---|
151 | { |
---|
152 | /* absolute value without a library dependency */ |
---|
153 | return ((priority >= 0) ? priority : -priority); |
---|
154 | } |
---|
155 | |
---|
156 | #endif |
---|
157 | /* end of include file */ |
---|
158 | |
---|