[rtems commit] posix: Avoid workspace for queued signals
Sebastian Huber
sebh at rtems.org
Wed Apr 10 07:50:25 UTC 2019
Module: rtems
Branch: master
Commit: 1bf2f160e258b729c1fb5ac7abd486e4757a9149
Changeset: http://git.rtems.org/rtems/commit/?id=1bf2f160e258b729c1fb5ac7abd486e4757a9149
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Sat Apr 6 14:26:00 2019 +0200
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 dfc917c..066919a 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 4632128..4a078c5 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 3a1bd41..efc4bcc 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 188ba73..41d68ea 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 <rtems at embedded-brains.de>
+ * Copyright 2018, 2019 embedded brains GmbH <rtems at embedded-brains.de>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,3 +32,5 @@
#include <rtems/posix/psignal.h>
const uint32_t _POSIX_signals_Maximum_queued_signals;
+
+POSIX_signals_Siginfo_node _POSIX_signals_Siginfo_nodes[ 0 ];
More information about the vc
mailing list