summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/posix
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-11-22 19:14:51 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-14 07:03:29 +0100
commit21275b58a5a69c3c838082ffc8a7a3641f32ea9a (patch)
treed331e17c15d71f107d0f14581a93ddf768b05813 /cpukit/include/rtems/posix
parentrtems: Use object information to get config max (diff)
downloadrtems-21275b58a5a69c3c838082ffc8a7a3641f32ea9a.tar.bz2
score: Static Objects_Information initialization
Statically allocate the objects information together with the initial set of objects either via <rtems/confdefs.h>. Provide default object informations with zero objects via librtemscpu.a. This greatly simplifies the workspace size estimate. RTEMS applications which do not use the unlimited objects option are easier to debug since all objects reside now in statically allocated objects of the right types. Close #3621.
Diffstat (limited to 'cpukit/include/rtems/posix')
-rw-r--r--cpukit/include/rtems/posix/key.h42
-rw-r--r--cpukit/include/rtems/posix/keyimpl.h5
-rw-r--r--cpukit/include/rtems/posix/mqueue.h31
-rw-r--r--cpukit/include/rtems/posix/mqueueimpl.h6
-rw-r--r--cpukit/include/rtems/posix/pthread.h8
-rw-r--r--cpukit/include/rtems/posix/pthreadimpl.h6
-rw-r--r--cpukit/include/rtems/posix/semaphore.h29
-rw-r--r--cpukit/include/rtems/posix/semaphoreimpl.h6
-rw-r--r--cpukit/include/rtems/posix/shm.h25
-rw-r--r--cpukit/include/rtems/posix/shmimpl.h2
-rw-r--r--cpukit/include/rtems/posix/sigset.h3
-rw-r--r--cpukit/include/rtems/posix/timer.h24
-rw-r--r--cpukit/include/rtems/posix/timerimpl.h6
13 files changed, 152 insertions, 41 deletions
diff --git a/cpukit/include/rtems/posix/key.h b/cpukit/include/rtems/posix/key.h
index 1f09916f06..a710855b93 100644
--- a/cpukit/include/rtems/posix/key.h
+++ b/cpukit/include/rtems/posix/key.h
@@ -71,6 +71,24 @@ typedef struct {
} POSIX_Keys_Key_value_pair;
/**
+ * @brief The initial set of POSIX key and value pairs.
+ *
+ * This array is provided via <rtems/confdefs.h> in case POSIX key and value
+ * pairs are configured. The POSIX key and value pair count in this array must
+ * be equal to
+ * _Objects_Maximum_per_allocation( _POSIX_Keys_Key_value_pair_maximum ).
+ */
+extern POSIX_Keys_Key_value_pair _POSIX_Keys_Key_value_pairs[];
+
+/**
+ * @brief The POSIX key and value pairs maximum.
+ *
+ * This value is provided via <rtems/confdefs.h> in case POSIX key and value
+ * pairs are configured. The OBJECTS_UNLIMITED_OBJECTS flag may be set.
+ */
+extern const uint32_t _POSIX_Keys_Key_value_pair_maximum;
+
+/**
* @brief The data structure used to manage a POSIX key.
*/
typedef struct {
@@ -85,6 +103,30 @@ typedef struct {
Chain_Control Key_value_pairs;
} POSIX_Keys_Control;
+/**
+ * @brief The POSIX Key objects information.
+ */
+extern Objects_Information _POSIX_Keys_Information;
+
+/**
+ * @brief Macro to define the objects information for the POSIX Key objects.
+ *
+ * This macro should only be used by <rtems/confdefs.h>.
+ *
+ * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag
+ * may be set).
+ */
+#define POSIX_KEYS_INFORMATION_DEFINE( max ) \
+ OBJECTS_INFORMATION_DEFINE( \
+ _POSIX_Keys, \
+ OBJECTS_POSIX_API, \
+ OBJECTS_POSIX_KEYS, \
+ POSIX_Keys_Control, \
+ max, \
+ OBJECTS_NO_STRING_NAME, \
+ NULL \
+ )
+
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/include/rtems/posix/keyimpl.h b/cpukit/include/rtems/posix/keyimpl.h
index 1148123638..d27244fe81 100644
--- a/cpukit/include/rtems/posix/keyimpl.h
+++ b/cpukit/include/rtems/posix/keyimpl.h
@@ -37,11 +37,6 @@ extern "C" {
*/
/**
- * @brief The information control block used to manage this class of objects.
- */
-extern Objects_Information _POSIX_Keys_Information;
-
-/**
* @brief This freechain is used as a memory pool for POSIX_Keys_Key_value_pair.
*/
extern Freechain_Control _POSIX_Keys_Keypool;
diff --git a/cpukit/include/rtems/posix/mqueue.h b/cpukit/include/rtems/posix/mqueue.h
index bec82ee3d9..84010e7d4f 100644
--- a/cpukit/include/rtems/posix/mqueue.h
+++ b/cpukit/include/rtems/posix/mqueue.h
@@ -31,11 +31,13 @@
#ifndef _RTEMS_POSIX_MQUEUE_H
#define _RTEMS_POSIX_MQUEUE_H
-#include <signal.h>
-#include <mqueue.h> /* struct mq_attr */
#include <rtems/score/coremsg.h>
#include <rtems/score/objectdata.h>
+#include <limits.h>
+#include <mqueue.h>
+#include <signal.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -61,7 +63,30 @@ typedef struct {
int oflag;
} POSIX_Message_queue_Control;
-extern const uint32_t _Configuration_POSIX_Maximum_message_queues;
+/**
+ * @brief The POSIX Message Queue objects information.
+ */
+extern Objects_Information _POSIX_Message_queue_Information;
+
+/**
+ * @brief Macro to define the objects information for the POSIX Message Queue
+ * objects.
+ *
+ * This macro should only be used by <rtems/confdefs.h>.
+ *
+ * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag
+ * may be set).
+ */
+#define POSIX_MESSAGE_QUEUE_INFORMATION_DEFINE( max ) \
+ OBJECTS_INFORMATION_DEFINE( \
+ _POSIX_Message_queue, \
+ OBJECTS_POSIX_API, \
+ OBJECTS_POSIX_MESSAGE_QUEUES, \
+ POSIX_Message_queue_Control, \
+ max, \
+ _POSIX_PATH_MAX, \
+ NULL \
+ )
/** @} */
diff --git a/cpukit/include/rtems/posix/mqueueimpl.h b/cpukit/include/rtems/posix/mqueueimpl.h
index 28381ad54b..14573287ad 100644
--- a/cpukit/include/rtems/posix/mqueueimpl.h
+++ b/cpukit/include/rtems/posix/mqueueimpl.h
@@ -31,12 +31,6 @@ extern "C" {
#endif
/**
- * This defines the information control block used to manage
- * this class of objects.
- */
-extern Objects_Information _POSIX_Message_queue_Information;
-
-/**
* @brief Delete a POSIX Message Queue
*
* This routine supports the mq_unlink and mq_close routines by
diff --git a/cpukit/include/rtems/posix/pthread.h b/cpukit/include/rtems/posix/pthread.h
index 25bf40ef27..9b59fd922d 100644
--- a/cpukit/include/rtems/posix/pthread.h
+++ b/cpukit/include/rtems/posix/pthread.h
@@ -38,8 +38,6 @@ extern "C" {
extern const size_t _Configuration_POSIX_Minimum_stack_size;
-extern const uint32_t _Configuration_POSIX_Maximum_threads;
-
/**
* @brief POSIX threads initialize user threads body.
*
@@ -48,6 +46,12 @@ extern const uint32_t _Configuration_POSIX_Maximum_threads;
*/
extern void _POSIX_Threads_Initialize_user_threads_body(void);
+/**
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+extern Thread_Information _POSIX_Threads_Information;
+
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/include/rtems/posix/pthreadimpl.h b/cpukit/include/rtems/posix/pthreadimpl.h
index be44716983..abb4d0f942 100644
--- a/cpukit/include/rtems/posix/pthreadimpl.h
+++ b/cpukit/include/rtems/posix/pthreadimpl.h
@@ -42,12 +42,6 @@ extern "C" {
*/
#define PTHREAD_MINIMUM_STACK_SIZE _Configuration_POSIX_Minimum_stack_size
-/**
- * The following defines the information control block used to manage
- * this class of objects.
- */
-extern Thread_Information _POSIX_Threads_Information;
-
#if defined(RTEMS_POSIX_API)
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Sporadic_timer_insert(
Thread_Control *the_thread,
diff --git a/cpukit/include/rtems/posix/semaphore.h b/cpukit/include/rtems/posix/semaphore.h
index 16b6d711cc..db36b39c9d 100644
--- a/cpukit/include/rtems/posix/semaphore.h
+++ b/cpukit/include/rtems/posix/semaphore.h
@@ -19,9 +19,11 @@
#ifndef _RTEMS_POSIX_SEMAPHORE_H
#define _RTEMS_POSIX_SEMAPHORE_H
-#include <semaphore.h>
#include <rtems/score/objectdata.h>
+#include <limits.h>
+#include <semaphore.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -46,7 +48,30 @@ typedef struct {
uint32_t open_count;
} POSIX_Semaphore_Control;
-extern const uint32_t _Configuration_POSIX_Maximum_named_semaphores;
+/**
+ * @brief The POSIX Semaphore objects information.
+ */
+extern Objects_Information _POSIX_Semaphore_Information;
+
+/**
+ * @brief Macro to define the objects information for the POSIX Semaphore
+ * objects.
+ *
+ * This macro should only be used by <rtems/confdefs.h>.
+ *
+ * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag
+ * may be set).
+ */
+#define POSIX_SEMAPHORE_INFORMATION_DEFINE( max ) \
+ OBJECTS_INFORMATION_DEFINE( \
+ _POSIX_Semaphore, \
+ OBJECTS_POSIX_API, \
+ OBJECTS_POSIX_SEMAPHORES, \
+ POSIX_Semaphore_Control, \
+ max, \
+ _POSIX_PATH_MAX, \
+ NULL \
+ )
/** @} */
diff --git a/cpukit/include/rtems/posix/semaphoreimpl.h b/cpukit/include/rtems/posix/semaphoreimpl.h
index 5ae6a300fa..b662d001cb 100644
--- a/cpukit/include/rtems/posix/semaphoreimpl.h
+++ b/cpukit/include/rtems/posix/semaphoreimpl.h
@@ -34,12 +34,6 @@ extern "C" {
*/
#define POSIX_SEMAPHORE_MAGIC 0x5d367fe7UL
-/**
- * This defines the information control block used to manage
- * this class of objects.
- */
-extern Objects_Information _POSIX_Semaphore_Information;
-
RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *
_POSIX_Semaphore_Allocate_unprotected( void )
{
diff --git a/cpukit/include/rtems/posix/shm.h b/cpukit/include/rtems/posix/shm.h
index ae0416e1fe..3d10e65fea 100644
--- a/cpukit/include/rtems/posix/shm.h
+++ b/cpukit/include/rtems/posix/shm.h
@@ -126,7 +126,30 @@ typedef struct {
time_t ctime;
} POSIX_Shm_Control;
-extern const uint32_t _Configuration_POSIX_Maximum_shms;
+/**
+ * @brief The POSIX Shared Memory objects information.
+ */
+extern Objects_Information _POSIX_Shm_Information;
+
+/**
+ * @brief Macro to define the objects information for the POSIX Shared Memory
+ * objects.
+ *
+ * This macro should only be used by <rtems/confdefs.h>.
+ *
+ * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag
+ * may be set).
+ */
+#define POSIX_SHM_INFORMATION_DEFINE( max ) \
+ OBJECTS_INFORMATION_DEFINE( \
+ _POSIX_Shm, \
+ OBJECTS_POSIX_API, \
+ OBJECTS_POSIX_SHMS, \
+ POSIX_Shm_Control, \
+ max, \
+ _POSIX_PATH_MAX, \
+ NULL \
+ )
/**
* @brief object_create operation for shm objects stored in RTEMS Workspace.
diff --git a/cpukit/include/rtems/posix/shmimpl.h b/cpukit/include/rtems/posix/shmimpl.h
index f16af8123d..6882119a83 100644
--- a/cpukit/include/rtems/posix/shmimpl.h
+++ b/cpukit/include/rtems/posix/shmimpl.h
@@ -31,8 +31,6 @@ extern "C" {
* @{
*/
-extern Objects_Information _POSIX_Shm_Information;
-
RTEMS_INLINE_ROUTINE POSIX_Shm_Control *_POSIX_Shm_Allocate_unprotected( void )
{
return (POSIX_Shm_Control *)
diff --git a/cpukit/include/rtems/posix/sigset.h b/cpukit/include/rtems/posix/sigset.h
index 96bcc086ba..6f46f61104 100644
--- a/cpukit/include/rtems/posix/sigset.h
+++ b/cpukit/include/rtems/posix/sigset.h
@@ -19,7 +19,8 @@
#ifndef _RTEMS_POSIX_SIGSET_H
#define _RTEMS_POSIX_SIGSET_H
-#include <signal.h> // sigset_t
+#include <stdbool.h>
+#include <signal.h>
/*
* Currently 32 signals numbered 1-32 are defined
diff --git a/cpukit/include/rtems/posix/timer.h b/cpukit/include/rtems/posix/timer.h
index 2cbc56e873..0b7a91e256 100644
--- a/cpukit/include/rtems/posix/timer.h
+++ b/cpukit/include/rtems/posix/timer.h
@@ -50,7 +50,29 @@ typedef struct {
struct timespec time; /* Time at which the timer was started */
} POSIX_Timer_Control;
-extern const uint32_t _Configuration_POSIX_Maximum_timers;
+/**
+ * @brief The POSIX Timer objects information.
+ */
+extern Objects_Information _POSIX_Timer_Information;
+
+/**
+ * @brief Macro to define the objects information for the POSIX Timer objects.
+ *
+ * This macro should only be used by <rtems/confdefs.h>.
+ *
+ * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag
+ * may be set).
+ */
+#define POSIX_TIMER_INFORMATION_DEFINE( max ) \
+ OBJECTS_INFORMATION_DEFINE( \
+ _POSIX_Timer, \
+ OBJECTS_POSIX_API, \
+ OBJECTS_POSIX_TIMERS, \
+ POSIX_Timer_Control, \
+ max, \
+ OBJECTS_NO_STRING_NAME, \
+ NULL \
+ )
/** @} */
diff --git a/cpukit/include/rtems/posix/timerimpl.h b/cpukit/include/rtems/posix/timerimpl.h
index 42a814c992..2b4eec1e24 100644
--- a/cpukit/include/rtems/posix/timerimpl.h
+++ b/cpukit/include/rtems/posix/timerimpl.h
@@ -52,12 +52,6 @@ extern "C" {
#endif
/**
- * The following defines the information control block used to manage
- * this class of objects.
- */
-extern Objects_Information _POSIX_Timer_Information;
-
-/**
* @brief POSIX Timer Allocate
*
* This function allocates a timer control block from