forked from Imagelibrary/rtems
2010-07-27 Vinu Rajashekhar <vinutheraj@gmail.com>
PR 1629/cpukit * posix/src/sigsuspend.c: sigsuspend() was not completely following the POSIX specification.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
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>
|
2010-07-27 Vinu Rajashekhar <vinutheraj@gmail.com>
|
||||||
|
|
||||||
PR 1630/cpukit
|
PR 1630/cpukit
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
@@ -28,17 +29,21 @@ int sigsuspend(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
sigset_t saved_signals_blocked;
|
sigset_t saved_signals_blocked;
|
||||||
sigset_t all_signals;
|
sigset_t current_unblocked_signals;
|
||||||
int status;
|
int status;
|
||||||
POSIX_API_Control *api;
|
POSIX_API_Control *api;
|
||||||
|
|
||||||
api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
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 );
|
status = sigprocmask( SIG_BLOCK, sigmask, &saved_signals_blocked );
|
||||||
|
|
||||||
(void) sigfillset( &all_signals );
|
current_unblocked_signals = ~(*sigmask);
|
||||||
|
status = sigtimedwait( ¤t_unblocked_signals, NULL, NULL );
|
||||||
status = sigtimedwait( &all_signals, NULL, NULL );
|
|
||||||
|
|
||||||
(void) sigprocmask( SIG_SETMASK, &saved_signals_blocked, NULL );
|
(void) sigprocmask( SIG_SETMASK, &saved_signals_blocked, NULL );
|
||||||
|
|
||||||
@@ -46,8 +51,7 @@ int sigsuspend(
|
|||||||
* sigtimedwait() returns the signal number while sigsuspend()
|
* sigtimedwait() returns the signal number while sigsuspend()
|
||||||
* is supposed to return -1 and EINTR when a signal is caught.
|
* is supposed to return -1 and EINTR when a signal is caught.
|
||||||
*/
|
*/
|
||||||
if ( status != -1 )
|
assert ( status != -1 );
|
||||||
rtems_set_errno_and_return_minus_one( EINTR );
|
|
||||||
|
|
||||||
return status;
|
rtems_set_errno_and_return_minus_one( EINTR );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user