forked from Imagelibrary/rtems
posix: pthread_sigmask should return error number when fail
According to the Posix specification: Upon successful completion pthread_sigmask() shall return 0; otherwise, it shall return the corresponding error number.
This commit is contained in:
@@ -58,8 +58,9 @@ int pthread_sigmask(
|
||||
{
|
||||
POSIX_API_Control *api;
|
||||
|
||||
if ( !set && !oset )
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
if ( !set && !oset ) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
api = _Thread_Get_executing()->API_Extensions[ THREAD_API_POSIX ];
|
||||
|
||||
@@ -80,7 +81,7 @@ int pthread_sigmask(
|
||||
api->signals_unblocked = ~*set;
|
||||
break;
|
||||
default:
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
/* XXX are there critical section problems here? */
|
||||
|
||||
@@ -57,7 +57,15 @@ int sigprocmask(
|
||||
*/
|
||||
|
||||
#if defined(RTEMS_POSIX_API)
|
||||
return pthread_sigmask( how, set, oset );
|
||||
int status;
|
||||
|
||||
status = pthread_sigmask( how, set, oset );
|
||||
|
||||
if ( status == 0 ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
@@ -535,15 +535,15 @@ void *POSIX_Init(
|
||||
puts( "Init: sigaction - EINVAL (SIGKILL)" );
|
||||
|
||||
status = pthread_sigmask( SIG_BLOCK, NULL, NULL );
|
||||
if ( status != -1 )
|
||||
if ( status != EINVAL )
|
||||
printf( "status = %d\n", status );
|
||||
rtems_test_assert( errno == EINVAL );
|
||||
rtems_test_assert( status == EINVAL );
|
||||
puts( "Init: pthread_sigmask - EINVAL (set and oset invalid)" );
|
||||
|
||||
status = pthread_sigmask( 999, &pending_set, NULL );
|
||||
if ( status != -1 )
|
||||
if ( status != EINVAL )
|
||||
printf( "status = %d\n", status );
|
||||
rtems_test_assert( errno == EINVAL );
|
||||
rtems_test_assert( status == EINVAL );
|
||||
puts( "Init: pthread_sigmask - EINVAL (how invalid)" );
|
||||
|
||||
status = sigpending( NULL );
|
||||
@@ -557,14 +557,14 @@ void *POSIX_Init(
|
||||
if ( status != -1 )
|
||||
printf( "status = %d\n", status );
|
||||
rtems_test_assert( errno == EINVAL );
|
||||
puts( "Init: pthread_sigmask - EINVAL (timout->nsec invalid < 0)" );
|
||||
puts( "Init: sigtimedwait - EINVAL (timout->nsec invalid < 0)" );
|
||||
|
||||
timeout.tv_nsec = 0x7fffffff;
|
||||
status = sigtimedwait( &mask, &info, &timeout );
|
||||
if ( status != -1 )
|
||||
printf( "status = %d\n", status );
|
||||
rtems_test_assert( errno == EINVAL );
|
||||
puts( "Init: pthread_sigmask - EINVAL (timout->nsec invalid to large)" );
|
||||
puts( "Init: sigtimedwait - EINVAL (timout->nsec invalid to large)" );
|
||||
|
||||
status = pthread_kill( Init_id, 999 );
|
||||
rtems_test_assert( status == EINVAL );
|
||||
|
||||
@@ -99,8 +99,8 @@ Init: sigaction - EINVAL (SIGKILL)
|
||||
Init: pthread_sigmask - EINVAL (set and oset invalid)
|
||||
Init: pthread_sigmask - EINVAL (how invalid)
|
||||
Init: sigpending - EINVAL (set invalid)
|
||||
Init: pthread_sigmask - EINVAL (timout->nsec invalid < 0)
|
||||
Init: pthread_sigmask - EINVAL (timout->nsec invalid to large)
|
||||
Init: sigtimedwait - EINVAL (timout->nsec invalid < 0)
|
||||
Init: sigtimedwait - EINVAL (timout->nsec invalid to large)
|
||||
Init: pthread_kill - EINVAL (sig invalid)
|
||||
Init: pthread_kill - EINVAL (signal = 0)
|
||||
Init: pthread_kill - SUCCESSFUL (signal = SIG_IGN)
|
||||
|
||||
Reference in New Issue
Block a user