RTEMS: cpukit/include/rtems/confdefs/objectsposix.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
objectsposix.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
13/*
14 * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef _RTEMS_CONFDEFS_OBJECTSPOSIX_H
39#define _RTEMS_CONFDEFS_OBJECTSPOSIX_H
40
41#ifndef __CONFIGURATION_TEMPLATE_h
42#error "Do not include this file directly, use <rtems/confdefs.h> instead"
43#endif
44
45#ifdef CONFIGURE_INIT
46
47#include <rtems/confdefs/threads.h>
48#include <rtems/confdefs/wkspacesupport.h>
49#include <rtems/config.h>
50
51#include <limits.h>
52
53#define _Configure_Memory_for_named_objects( _number, _size ) \
54 ( rtems_resource_maximum_per_allocation( _number ) \
55 * _Configure_From_workspace( _POSIX_PATH_MAX + 1 ) )
56
57#ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
58 #define CONFIGURE_MAXIMUM_POSIX_KEYS 0
59#endif
60
61#ifndef CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
62 #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
63 ( CONFIGURE_MAXIMUM_POSIX_KEYS * \
64 ( CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS ) )
65#endif
66
67#if CONFIGURE_MAXIMUM_POSIX_KEYS > 0 \
68 && CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS < CONFIGURE_MAXIMUM_POSIX_KEYS
69 #error "CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS must be greater than or equal to CONFIGURE_MAXIMUM_POSIX_KEYS"
70#endif
71
72#if CONFIGURE_MAXIMUM_POSIX_KEYS == 0 \
73 && CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS > 0
74 #warning "If CONFIGURE_MAXIMUM_POSIX_KEYS is zero, then CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS should be zero as well"
75#endif
76
77#if CONFIGURE_MAXIMUM_POSIX_KEYS > 0 || CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS > 0
78 #include <rtems/posix/key.h>
79#endif
80
81#if CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES > 0
82 #include <rtems/posix/mqueue.h>
83#endif
84
85#if CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS > 0
86 #include <rtems/posix/psignal.h>
87#endif
88
89#if CONFIGURE_MAXIMUM_POSIX_SEMAPHORES > 0
90 #include <rtems/posix/semaphore.h>
91#endif
92
93#if CONFIGURE_MAXIMUM_POSIX_SHMS > 0
94 #include <rtems/posix/shm.h>
95#endif
96
97#if CONFIGURE_MAXIMUM_POSIX_TIMERS > 0
98 #include <rtems/posix/timer.h>
99#endif
100
101#ifdef __cplusplus
102extern "C" {
103#endif
104
105#if CONFIGURE_MAXIMUM_POSIX_KEYS > 0
106 POSIX_KEYS_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_POSIX_KEYS );
107#endif
108
109#if CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS > 0
110 POSIX_Keys_Key_value_pair _POSIX_Keys_Key_value_pairs[
111 rtems_resource_maximum_per_allocation(
112 CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
113 )
114 ];
115
116 const uint32_t _POSIX_Keys_Key_value_pair_maximum =
117 CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS;
118#endif
119
120#if CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES > 0
121 POSIX_MESSAGE_QUEUE_INFORMATION_DEFINE(
122 CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
123 );
124
125 #define _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES \
126 _Configure_Memory_for_named_objects( \
127 CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES, \
128 sizeof( POSIX_Message_queue_Control ) \
129 )
130#else
131 #define _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES 0
132#endif
133
134#if CONFIGURE_MAXIMUM_POSIX_SEMAPHORES > 0
135 POSIX_SEMAPHORE_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES );
136
137 #define _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES \
138 _Configure_Memory_for_named_objects( \
139 CONFIGURE_MAXIMUM_POSIX_SEMAPHORES, \
140 sizeof( POSIX_Semaphore_Control ) \
141 )
142#else
143 #define _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES 0
144#endif
145
146#if CONFIGURE_MAXIMUM_POSIX_SHMS > 0
147 POSIX_SHM_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_POSIX_SHMS );
148
149 #define _CONFIGURE_MEMORY_FOR_POSIX_SHMS \
150 _Configure_Memory_for_named_objects( \
151 CONFIGURE_MAXIMUM_POSIX_SHMS, \
152 sizeof( POSIX_Shm_Control ) \
153 )
154#else
155 #define _CONFIGURE_MEMORY_FOR_POSIX_SHMS 0
156#endif
157
158#if CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS > 0
159 #ifndef RTEMS_POSIX_API
160 #error "CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS must be zero if POSIX API is disabled"
161 #endif
162
163 const uint32_t _POSIX_signals_Maximum_queued_signals =
164 CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS;
165
166 POSIX_signals_Siginfo_node _POSIX_signals_Siginfo_nodes[
167 CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
168 ];
169
170 #define _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS \
171 _Configure_From_workspace( CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS \
172 * sizeof( POSIX_signals_Siginfo_node ) )
173#else
174 #define _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS 0
175#endif
176
177#if CONFIGURE_MAXIMUM_POSIX_TIMERS > 0
178 #ifndef RTEMS_POSIX_API
179 #error "CONFIGURE_MAXIMUM_POSIX_TIMERS must be zero if POSIX API is disabled"
180 #endif
181
182 POSIX_TIMER_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_POSIX_TIMERS );
183#endif
184
185#ifdef __cplusplus
186}
187#endif
188
189#define _CONFIGURE_MEMORY_FOR_POSIX_OBJECTS \
190 ( _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES \
191 + _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS \
192 + _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES \
193 + _CONFIGURE_MEMORY_FOR_POSIX_SHMS )
194
195#endif /* CONFIGURE_INIT */
196
197#endif /* _RTEMS_CONFDEFS_OBJECTSPOSIX_H */
timer.h
POSIX Timers Internal Support.
POSIX_SEMAPHORE_INFORMATION_DEFINE
#define POSIX_SEMAPHORE_INFORMATION_DEFINE(max)
Macro to define the objects information for the POSIX Semaphore objects.
Definition: semaphore.h:65
POSIX_SHM_INFORMATION_DEFINE
#define POSIX_SHM_INFORMATION_DEFINE(max)
Macro to define the objects information for the POSIX Shared Memory objects.
Definition: shm.h:143
POSIX_TIMER_INFORMATION_DEFINE
#define POSIX_TIMER_INFORMATION_DEFINE(max)
Macro to define the objects information for the POSIX Timer objects.
Definition: timer.h:66
POSIX_KEYS_INFORMATION_DEFINE
#define POSIX_KEYS_INFORMATION_DEFINE(max)
Macro to define the objects information for the POSIX Key objects.
Definition: key.h:119
_POSIX_Keys_Key_value_pairs
POSIX_Keys_Key_value_pair _POSIX_Keys_Key_value_pairs[]
The initial set of POSIX key and value pairs.
Definition: keyzerokvp.c:34
_POSIX_Keys_Key_value_pair_maximum
const uint32_t _POSIX_Keys_Key_value_pair_maximum
The POSIX key and value pairs maximum.
Definition: keyzerokvp.c:36
POSIX_MESSAGE_QUEUE_INFORMATION_DEFINE
#define POSIX_MESSAGE_QUEUE_INFORMATION_DEFINE(max)
Macro to define the objects information for the POSIX Message Queue objects.
Definition: mqueue.h:80
key.h
POSIX Key Private Support.
psignal.h
Internal Information about POSIX Signals.
mqueue.h
POSIX Message Queues Private Private Support.
semaphore.h
Private Support Information for POSIX Semaphores.
shm.h
Internal Support for POSIX Shared Memory.
POSIX_Keys_Key_value_pair
Represents POSIX key and value pair.
Definition: key.h:46
POSIX_signals_Siginfo_node
Definition: psignal.h:29
threads.h
Evaluate Thread Configuration Options.
wkspacesupport.h
Configuration Options Workspace Support Macros.