[PATCH 4/5] posix: Avoid workspace for queued signals

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Apr 9 07:10:47 UTC 2019


---
 cpukit/include/rtems/confdefs.h      |  4 ++++
 cpukit/include/rtems/posix/psignal.h |  2 ++
 cpukit/posix/src/psignal.c           | 26 +++++++++-----------------
 3 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index dfc917ccfe..066919a7dc 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -2862,6 +2862,10 @@ struct _reent *__getreent(void)
     #if CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS > 0
       const uint32_t _POSIX_signals_Maximum_queued_signals =
         CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS;
+
+      POSIX_signals_Siginfo_node _POSIX_signals_Siginfo_nodes[
+        CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
+      ];
     #endif
 
     #if CONFIGURE_MAXIMUM_POSIX_TIMERS > 0
diff --git a/cpukit/include/rtems/posix/psignal.h b/cpukit/include/rtems/posix/psignal.h
index 4632128598..4a078c57aa 100644
--- a/cpukit/include/rtems/posix/psignal.h
+++ b/cpukit/include/rtems/posix/psignal.h
@@ -33,5 +33,7 @@ typedef struct {
 
 extern const uint32_t _POSIX_signals_Maximum_queued_signals;
 
+extern POSIX_signals_Siginfo_node _POSIX_signals_Siginfo_nodes[];
+
 #endif
 /* end of file */
diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c
index 3a1bd41cad..545abab476 100644
--- a/cpukit/posix/src/psignal.c
+++ b/cpukit/posix/src/psignal.c
@@ -100,10 +100,7 @@ Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ];
 
 static void _POSIX_signals_Manager_Initialization(void)
 {
-  uint32_t   signo;
-  uint32_t   maximum_queued_signals;
-
-  maximum_queued_signals = _POSIX_signals_Maximum_queued_signals;
+  uint32_t signo;
 
   memcpy(
     _POSIX_signals_Vectors,
@@ -121,21 +118,16 @@ static void _POSIX_signals_Manager_Initialization(void)
   /*
    *  Allocate the siginfo pools.
    */
-  for ( signo=1 ; signo<= SIGRTMAX ; signo++ )
+  for ( signo=1 ; signo<= SIGRTMAX ; signo++ ) {
     _Chain_Initialize_empty( &_POSIX_signals_Siginfo[ signo ] );
-
-  if ( maximum_queued_signals ) {
-    _Chain_Initialize(
-      &_POSIX_signals_Inactive_siginfo,
-      _Workspace_Allocate_or_fatal_error(
-        maximum_queued_signals * sizeof( POSIX_signals_Siginfo_node )
-      ),
-      maximum_queued_signals,
-      sizeof( POSIX_signals_Siginfo_node )
-    );
-  } else {
-    _Chain_Initialize_empty( &_POSIX_signals_Inactive_siginfo );
   }
+
+  _Chain_Initialize(
+    &_POSIX_signals_Inactive_siginfo,
+    &_POSIX_signals_Siginfo_nodes[ 0 ],
+    _POSIX_signals_Maximum_queued_signals,
+    sizeof( POSIX_signals_Siginfo_nodes[ 0 ] )
+  );
 }
 
 RTEMS_SYSINIT_ITEM(
-- 
2.16.4




More information about the devel mailing list