[PATCH 17/38] Optional POSIX Signals initialization
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Jan 26 15:37:43 UTC 2016
Update #2408.
---
cpukit/posix/include/rtems/posix/psignalimpl.h | 5 ----
cpukit/posix/src/psignal.c | 9 ++++++-
cpukit/sapi/src/posixapi.c | 1 -
cpukit/score/include/rtems/sysinit.h | 1 +
testsuites/sptests/spsysinit01/init.c | 36 ++++++++++++++++++++++++++
5 files changed, 45 insertions(+), 7 deletions(-)
diff --git a/cpukit/posix/include/rtems/posix/psignalimpl.h b/cpukit/posix/include/rtems/posix/psignalimpl.h
index d7e1afa..b887084 100644
--- a/cpukit/posix/include/rtems/posix/psignalimpl.h
+++ b/cpukit/posix/include/rtems/posix/psignalimpl.h
@@ -72,11 +72,6 @@ extern Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ];
* Internal routines
*/
-/**
- * @brief POSIX signals manager initialization.
- */
-void _POSIX_signals_Manager_Initialization(void);
-
#define _POSIX_signals_Acquire( lock_context ) \
_Thread_queue_Acquire( &_POSIX_signals_Wait_queue, lock_context )
diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c
index f00bcdb..08b049b 100644
--- a/cpukit/posix/src/psignal.c
+++ b/cpukit/posix/src/psignal.c
@@ -33,6 +33,7 @@
#include <rtems/posix/pthreadimpl.h>
#include <rtems/config.h>
#include <rtems/seterr.h>
+#include <rtems/sysinit.h>
/*
* Ensure we have the same number of vectors and default vector entries
@@ -166,7 +167,7 @@ void _POSIX_signals_Action_handler(
executing->Wait.return_code = hold_errno;
}
-void _POSIX_signals_Manager_Initialization(void)
+static void _POSIX_signals_Manager_Initialization(void)
{
uint32_t signo;
uint32_t maximum_queued_signals;
@@ -213,3 +214,9 @@ void _POSIX_signals_Manager_Initialization(void)
_Chain_Initialize_empty( &_POSIX_signals_Inactive_siginfo );
}
}
+
+RTEMS_SYSINIT_ITEM(
+ _POSIX_signals_Manager_Initialization,
+ RTEMS_SYSINIT_POSIX_SIGNALS,
+ RTEMS_SYSINIT_ORDER_MIDDLE
+);
diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c
index 60fa17e..1c54b77 100644
--- a/cpukit/sapi/src/posixapi.c
+++ b/cpukit/sapi/src/posixapi.c
@@ -64,7 +64,6 @@ void _POSIX_API_Initialize(void)
_POSIX_Key_Manager_initialization();
#ifdef RTEMS_POSIX_API
- _POSIX_signals_Manager_Initialization();
_POSIX_Threads_Manager_initialization();
_POSIX_Condition_variables_Manager_initialization();
_POSIX_Mutex_Manager_initialization();
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index faef223..a6cb32f 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -42,6 +42,7 @@ extern "C" {
#define RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY 000348
#define RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC 000349
#define RTEMS_SYSINIT_CLASSIC_BARRIER 00034a
+#define RTEMS_SYSINIT_POSIX_SIGNALS 000360
#define RTEMS_SYSINIT_IDLE_THREADS 000380
#define RTEMS_SYSINIT_BSP_LIBC 000400
#define RTEMS_SYSINIT_BEFORE_DRIVERS 000500
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index 31e691e..328851d 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -17,6 +17,7 @@
#endif
#include <assert.h>
+#include <string.h>
#include <stdlib.h>
#include <rtems.h>
@@ -25,6 +26,9 @@
#include <rtems/test.h>
#include <rtems/extensionimpl.h>
+#ifdef RTEMS_POSIX_API
+#include <rtems/posix/psignalimpl.h>
+#endif /* RTEMS_POSIX_API */
#include <rtems/rtems/barrierimpl.h>
#include <rtems/rtems/dpmemimpl.h>
#include <rtems/rtems/messageimpl.h>
@@ -74,6 +78,10 @@ typedef enum {
CLASSIC_RATE_MONOTONIC_POST,
CLASSIC_BARRIER_PRE,
CLASSIC_BARRIER_POST,
+#ifdef RTEMS_POSIX_API
+ POSIX_SIGNALS_PRE,
+ POSIX_SIGNALS_POST,
+#endif /* RTEMS_POSIX_API */
IDLE_THREADS_PRE,
IDLE_THREADS_POST,
BSP_LIBC_PRE,
@@ -309,6 +317,34 @@ LAST(RTEMS_SYSINIT_CLASSIC_BARRIER)
next_step(CLASSIC_BARRIER_POST);
}
+#ifdef RTEMS_POSIX_API
+
+FIRST(RTEMS_SYSINIT_POSIX_SIGNALS)
+{
+ assert(
+ memcmp(
+ &_POSIX_signals_Vectors,
+ _POSIX_signals_Default_vectors,
+ sizeof(_POSIX_signals_Vectors)
+ ) != 0
+ );
+ next_step(POSIX_SIGNALS_PRE);
+}
+
+LAST(RTEMS_SYSINIT_POSIX_SIGNALS)
+{
+ assert(
+ memcmp(
+ &_POSIX_signals_Vectors,
+ _POSIX_signals_Default_vectors,
+ sizeof(_POSIX_signals_Vectors)
+ ) == 0
+ );
+ next_step(POSIX_SIGNALS_POST);
+}
+
+#endif /* RTEMS_POSIX_API */
+
FIRST(RTEMS_SYSINIT_IDLE_THREADS)
{
assert(_System_state_Is_before_initialization(_System_state_Get()));
--
1.8.4.5
More information about the devel
mailing list