diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-27 16:38:15 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-27 16:38:15 +0000 |
commit | c9bc2cf62f6d24f609e6e9b426b86b80c342ba88 (patch) | |
tree | 4618cbad89ffca0c410b2c285b8896a9c10660ef /cpukit | |
parent | 2010-07-27 Vinu Rajashekhar <vinutheraj@gmail.com> (diff) | |
download | rtems-c9bc2cf62f6d24f609e6e9b426b86b80c342ba88.tar.bz2 |
2010-07-27 Vinu Rajashekhar <vinutheraj@gmail.com>
PR 1629/cpukit
* posix/src/sigsuspend.c: sigsuspend() was not completely following the
POSIX specification.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 6 | ||||
-rw-r--r-- | cpukit/posix/src/sigsuspend.c | 18 |
2 files changed, 17 insertions, 7 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index c39aeba2a2..e55b3b7a96 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,5 +1,11 @@ 2010-07-27 Vinu Rajashekhar <vinutheraj@gmail.com> + PR 1629/cpukit + * posix/src/sigsuspend.c: sigsuspend() was not completely following the + POSIX specification. + +2010-07-27 Vinu Rajashekhar <vinutheraj@gmail.com> + PR 1630/cpukit * posix/src/psignalchecksignal.c, posix/src/sigtimedwait.c: sigtimedwait() was not completely following the POSIX specification. diff --git a/cpukit/posix/src/sigsuspend.c b/cpukit/posix/src/sigsuspend.c index aa330bc71c..606e8556f5 100644 --- a/cpukit/posix/src/sigsuspend.c +++ b/cpukit/posix/src/sigsuspend.c @@ -15,6 +15,7 @@ #include "config.h" #endif +#include <assert.h> #include <signal.h> #include <errno.h> @@ -28,17 +29,21 @@ int sigsuspend( ) { sigset_t saved_signals_blocked; - sigset_t all_signals; + sigset_t current_unblocked_signals; int status; POSIX_API_Control *api; api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ]; + /* + * We use SIG_BLOCK and not SIG_SETMASK because there may be + * signals which might be pending, which might get caught here. + * We want the signals to be caught inside sigtimedwait. + */ status = sigprocmask( SIG_BLOCK, sigmask, &saved_signals_blocked ); - (void) sigfillset( &all_signals ); - - status = sigtimedwait( &all_signals, NULL, NULL ); + current_unblocked_signals = ~(*sigmask); + status = sigtimedwait( ¤t_unblocked_signals, NULL, NULL ); (void) sigprocmask( SIG_SETMASK, &saved_signals_blocked, NULL ); @@ -46,8 +51,7 @@ int sigsuspend( * sigtimedwait() returns the signal number while sigsuspend() * is supposed to return -1 and EINTR when a signal is caught. */ - if ( status != -1 ) - rtems_set_errno_and_return_minus_one( EINTR ); + assert ( status != -1 ); - return status; + rtems_set_errno_and_return_minus_one( EINTR ); } |