[rtems commit] posix: Use proper lock for sigaction()

Sebastian Huber sebh at rtems.org
Tue Apr 12 05:57:42 UTC 2016


Module:    rtems
Branch:    master
Commit:    44ed3843dc546b94ad54a6e0beb9f3003090a4ca
Changeset: http://git.rtems.org/rtems/commit/?id=44ed3843dc546b94ad54a6e0beb9f3003090a4ca

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Apr  5 16:23:39 2016 +0200

posix: Use proper lock for sigaction()

Update #2555.

---

 cpukit/posix/src/sigaction.c | 29 +++++++++--------------------
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/cpukit/posix/src/sigaction.c b/cpukit/posix/src/sigaction.c
index a2f9028..177dcd1 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;
 }




More information about the vc mailing list