From 1bf2f160e258b729c1fb5ac7abd486e4757a9149 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Sat, 6 Apr 2019 14:26:00 +0200 Subject: posix: Avoid workspace for queued signals --- cpukit/include/rtems/confdefs.h | 4 ++++ cpukit/include/rtems/posix/psignal.h | 2 ++ cpukit/posix/src/psignal.c | 26 +++++++++----------------- cpukit/posix/src/psignalconfig.c | 4 +++- 4 files changed, 18 insertions(+), 18 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..efc4bcc653 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( diff --git a/cpukit/posix/src/psignalconfig.c b/cpukit/posix/src/psignalconfig.c index 188ba739e6..41d68eaee1 100644 --- a/cpukit/posix/src/psignalconfig.c +++ b/cpukit/posix/src/psignalconfig.c @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2018, embedded brains GmbH + * Copyright 2018, 2019 embedded brains GmbH * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,3 +32,5 @@ #include const uint32_t _POSIX_signals_Maximum_queued_signals; + +POSIX_signals_Siginfo_node _POSIX_signals_Siginfo_nodes[ 0 ]; -- cgit v1.2.3