summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-05 06:44:07 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-06 09:08:21 +0200
commit3c89525608320951e998d65f9fb3c0bb02dc78be (patch)
treec5857a0b932604baf0389cbc51cdc8eaf1c40a1b
parent7d217001ab977a343d26a9be8859924c99347652 (diff)
downloadrtems-3c89525608320951e998d65f9fb3c0bb02dc78be.tar.bz2
posix: Make _POSIX_signals_Check_signal() static
-rw-r--r--cpukit/posix/Makefile.am2
-rw-r--r--cpukit/posix/include/rtems/posix/psignalimpl.h9
-rw-r--r--cpukit/posix/src/psignal.c74
-rw-r--r--cpukit/posix/src/psignalchecksignal.c113
4 files changed, 75 insertions, 123 deletions
diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am
index dcedf5b77d..ed62232b72 100644
--- a/cpukit/posix/Makefile.am
+++ b/cpukit/posix/Makefile.am
@@ -147,7 +147,7 @@ endif
## PSIGNAL_C_FILES
libposix_a_SOURCES += src/psignal.c src/alarm.c src/kill.c src/killinfo.c \
src/kill_r.c src/pause.c src/psignalclearprocesssignals.c \
- src/psignalsetprocesssignals.c src/psignalchecksignal.c \
+ src/psignalsetprocesssignals.c \
src/psignalclearsignals.c src/psignalunblockthread.c src/pthreadkill.c \
src/pthreadsigmask.c src/sigaction.c
endif
diff --git a/cpukit/posix/include/rtems/posix/psignalimpl.h b/cpukit/posix/include/rtems/posix/psignalimpl.h
index eeb060e029..7c1424c199 100644
--- a/cpukit/posix/include/rtems/posix/psignalimpl.h
+++ b/cpukit/posix/include/rtems/posix/psignalimpl.h
@@ -96,15 +96,6 @@ bool _POSIX_signals_Unblock_thread(
);
/**
- * @brief Check POSIX signal.
- */
-bool _POSIX_signals_Check_signal(
- POSIX_API_Control *api,
- int signo,
- bool is_global
-);
-
-/**
* @brief Clear POSIX signals.
*/
bool _POSIX_signals_Clear_signals(
diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c
index 18aad9667e..354fb33adb 100644
--- a/cpukit/posix/src/psignal.c
+++ b/cpukit/posix/src/psignal.c
@@ -107,6 +107,80 @@ Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ];
(STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) == \
(STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL))
+static void _POSIX_signals_Check_signal(
+ POSIX_API_Control *api,
+ int signo,
+ bool is_global
+)
+{
+ siginfo_t siginfo_struct;
+ sigset_t saved_signals_unblocked;
+ Thread_Wait_information stored_thread_wait_information;
+ Thread_Control *executing;
+
+ if ( ! _POSIX_signals_Clear_signals( api, signo, &siginfo_struct,
+ is_global, true, true ) )
+ return;
+
+ /*
+ * Since we made a union of these, only one test is necessary but this is
+ * safer.
+ */
+ #if defined(RTEMS_DEBUG)
+ assert( _POSIX_signals_Vectors[ signo ].sa_handler ||
+ _POSIX_signals_Vectors[ signo ].sa_sigaction );
+ #endif
+
+ /*
+ * Just to prevent sending a signal which is currently being ignored.
+ */
+ if ( _POSIX_signals_Vectors[ signo ].sa_handler == SIG_IGN )
+ return;
+
+ /*
+ * Block the signals requested in sa_mask
+ */
+ saved_signals_unblocked = api->signals_unblocked;
+ api->signals_unblocked &= ~_POSIX_signals_Vectors[ signo ].sa_mask;
+
+ executing = _Thread_Get_executing();
+
+ /*
+ * We have to save the blocking information of the current wait queue
+ * because the signal handler may subsequently go on and put the thread
+ * on a wait queue, for its own purposes.
+ */
+ memcpy( &stored_thread_wait_information, &executing->Wait,
+ sizeof( stored_thread_wait_information ));
+
+ /*
+ * Here, the signal handler function executes
+ */
+ switch ( _POSIX_signals_Vectors[ signo ].sa_flags ) {
+ case SA_SIGINFO:
+ (*_POSIX_signals_Vectors[ signo ].sa_sigaction)(
+ signo,
+ &siginfo_struct,
+ NULL /* context is undefined per 1003.1b-1993, p. 66 */
+ );
+ break;
+ default:
+ (*_POSIX_signals_Vectors[ signo ].sa_handler)( signo );
+ break;
+ }
+
+ /*
+ * Restore the blocking information
+ */
+ memcpy( &executing->Wait, &stored_thread_wait_information,
+ sizeof( executing->Wait ));
+
+ /*
+ * Restore the previous set of unblocked signals
+ */
+ api->signals_unblocked = saved_signals_unblocked;
+}
+
void _POSIX_signals_Action_handler(
Thread_Control *executing,
Thread_Action *action,
diff --git a/cpukit/posix/src/psignalchecksignal.c b/cpukit/posix/src/psignalchecksignal.c
deleted file mode 100644
index 990bcc2c34..0000000000
--- a/cpukit/posix/src/psignalchecksignal.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * @file
- *
- * @brief POSIX Signals Check Signal
- * @ingroup POSIX_SIGNALS
- */
-
-/*
- * COPYRIGHT (c) 1989-2007.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if defined(RTEMS_DEBUG)
- #include <assert.h>
-#endif
-#include <errno.h>
-#include <pthread.h>
-#include <signal.h>
-#include <string.h>
-
-#include <rtems/system.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/seterr.h>
-#include <rtems/posix/threadsup.h>
-#include <rtems/posix/psignalimpl.h>
-#include <rtems/posix/pthreadimpl.h>
-#include <stdio.h>
-
-bool _POSIX_signals_Check_signal(
- POSIX_API_Control *api,
- int signo,
- bool is_global
-)
-{
- siginfo_t siginfo_struct;
- sigset_t saved_signals_unblocked;
- Thread_Wait_information stored_thread_wait_information;
- Thread_Control *executing;
-
- if ( ! _POSIX_signals_Clear_signals( api, signo, &siginfo_struct,
- is_global, true, true ) )
- return false;
-
- /*
- * Since we made a union of these, only one test is necessary but this is
- * safer.
- */
- #if defined(RTEMS_DEBUG)
- assert( _POSIX_signals_Vectors[ signo ].sa_handler ||
- _POSIX_signals_Vectors[ signo ].sa_sigaction );
- #endif
-
- /*
- * Just to prevent sending a signal which is currently being ignored.
- */
- if ( _POSIX_signals_Vectors[ signo ].sa_handler == SIG_IGN )
- return false;
-
- /*
- * Block the signals requested in sa_mask
- */
- saved_signals_unblocked = api->signals_unblocked;
- api->signals_unblocked &= ~_POSIX_signals_Vectors[ signo ].sa_mask;
-
- executing = _Thread_Get_executing();
-
- /*
- * We have to save the blocking information of the current wait queue
- * because the signal handler may subsequently go on and put the thread
- * on a wait queue, for its own purposes.
- */
- memcpy( &stored_thread_wait_information, &executing->Wait,
- sizeof( stored_thread_wait_information ));
-
- /*
- * Here, the signal handler function executes
- */
- switch ( _POSIX_signals_Vectors[ signo ].sa_flags ) {
- case SA_SIGINFO:
- (*_POSIX_signals_Vectors[ signo ].sa_sigaction)(
- signo,
- &siginfo_struct,
- NULL /* context is undefined per 1003.1b-1993, p. 66 */
- );
- break;
- default:
- (*_POSIX_signals_Vectors[ signo ].sa_handler)( signo );
- break;
- }
-
- /*
- * Restore the blocking information
- */
- memcpy( &executing->Wait, &stored_thread_wait_information,
- sizeof( executing->Wait ));
-
- /*
- * Restore the previous set of unblocked signals
- */
- api->signals_unblocked = saved_signals_unblocked;
-
- return true;
-}