posix: Protect access to _POSIX_signals_Vectors

Assume the sigaction() is called only from thread context.  Protect
against concurrent sigaction() invocations by different threads.
This commit is contained in:
Sebastian Huber
2013-08-27 10:48:16 +02:00
parent 23de794d15
commit 58a5889610
+6 -11
View File
@@ -44,9 +44,6 @@ int sigaction(
{
ISR_Level level;
if ( oact )
*oact = _POSIX_signals_Vectors[ sig ];
if ( !sig )
rtems_set_errno_and_return_minus_one( EINVAL );
@@ -63,6 +60,11 @@ int sigaction(
if ( sig == SIGKILL )
rtems_set_errno_and_return_minus_one( EINVAL );
_Thread_Disable_dispatch();
if ( oact )
*oact = _POSIX_signals_Vectors[ sig ];
/*
* Evaluate the new action structure and set the global signal vector
* appropriately.
@@ -85,14 +87,7 @@ int sigaction(
_ISR_Enable( level );
}
/*
* No need to evaluate or dispatch because:
*
* + If we were ignoring the signal before, none could be pending
* now (signals not posted when SIG_IGN).
* + If we are now ignoring a signal that was previously pending,
* we clear the pending signal indicator.
*/
_Thread_Enable_dispatch();
return 0;
}