diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-05 16:23:39 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-08 08:25:28 +0200 |
commit | 44ed3843dc546b94ad54a6e0beb9f3003090a4ca (patch) | |
tree | 3bcfd9b8b41fa77928bf514d58d6371dfe5a3170 /cpukit/posix/src/sigaction.c | |
parent | score: Compatibility with latest Newlib (diff) | |
download | rtems-44ed3843dc546b94ad54a6e0beb9f3003090a4ca.tar.bz2 |
posix: Use proper lock for sigaction()
Update #2555.
Diffstat (limited to '')
-rw-r--r-- | cpukit/posix/src/sigaction.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/cpukit/posix/src/sigaction.c b/cpukit/posix/src/sigaction.c index a2f9028915..177dcd19ab 100644 --- a/cpukit/posix/src/sigaction.c +++ b/cpukit/posix/src/sigaction.c @@ -24,17 +24,8 @@ #include <signal.h> #include <errno.h> -#include <rtems/system.h> -#include <rtems/posix/pthreadimpl.h> #include <rtems/posix/psignalimpl.h> #include <rtems/seterr.h> -#include <rtems/score/isr.h> - -/* - * PARAMETERS_PASSING_S is defined in ptimer.c - */ - -extern void PARAMETERS_PASSING_S (int num_signal, const struct sigaction inf); int sigaction( int sig, @@ -42,7 +33,7 @@ int sigaction( struct sigaction *__restrict oact ) { - ISR_Level level; + ISR_lock_Context lock_context; if ( !sig ) rtems_set_errno_and_return_minus_one( EINVAL ); @@ -60,7 +51,7 @@ int sigaction( if ( sig == SIGKILL ) rtems_set_errno_and_return_minus_one( EINVAL ); - _Thread_Disable_dispatch(); + _POSIX_signals_Acquire( &lock_context ); if ( oact ) *oact = _POSIX_signals_Vectors[ sig ]; @@ -77,17 +68,15 @@ int sigaction( * we can just copy the provided sigaction structure into the vectors. */ - _ISR_Disable( level ); - if ( act->sa_handler == SIG_DFL ) { - _POSIX_signals_Vectors[ sig ] = _POSIX_signals_Default_vectors[ sig ]; - } else { - _POSIX_signals_Clear_process_signals( sig ); - _POSIX_signals_Vectors[ sig ] = *act; - } - _ISR_Enable( level ); + if ( act->sa_handler == SIG_DFL ) { + _POSIX_signals_Vectors[ sig ] = _POSIX_signals_Default_vectors[ sig ]; + } else { + _POSIX_signals_Clear_process_signals( sig ); + _POSIX_signals_Vectors[ sig ] = *act; + } } - _Thread_Enable_dispatch(); + _POSIX_signals_Release( &lock_context ); return 0; } |