2004-05-21 Joel Sherrill <joel@OARcorp.com>

PR 628/rtems
	* src/killinfo.c, src/pthreadkill.c, src/ptimer1.c, src/sigaction.c,
	src/sigaddset.c, src/sigsuspend.c: Signal set of 0 is supposed to
	return EINVAL.  In addition timer_create needed to return an error
	if the clock was not CLOCK_REALTIME.
This commit is contained in:
Joel Sherrill
2004-05-21 20:16:39 +00:00
parent 0732eb4997
commit cfc43898e6
7 changed files with 41 additions and 10 deletions

View File

@@ -1,3 +1,11 @@
2004-05-21 Joel Sherrill <joel@OARcorp.com>
PR 628/rtems
* src/killinfo.c, src/pthreadkill.c, src/ptimer1.c, src/sigaction.c,
src/sigaddset.c, src/sigsuspend.c: Signal set of 0 is supposed to
return EINVAL. In addition timer_create needed to return an error
if the clock was not CLOCK_REALTIME.
2004-05-21 Joel Sherrill <joel@OARcorp.com> 2004-05-21 Joel Sherrill <joel@OARcorp.com>
PR 629/rtems PR 629/rtems

View File

@@ -66,10 +66,13 @@ int killinfo(
rtems_set_errno_and_return_minus_one( ESRCH ); rtems_set_errno_and_return_minus_one( ESRCH );
/* /*
* Validate the signal passed if not 0. * Validate the signal passed.
*/ */
if ( sig && !is_valid_signo(sig) ) { if ( !sig )
rtems_set_errno_and_return_minus_one( EINVAL );
if ( !is_valid_signo(sig) ) {
rtems_set_errno_and_return_minus_one( EINVAL ); rtems_set_errno_and_return_minus_one( EINVAL );
} }
@@ -77,7 +80,7 @@ int killinfo(
* If the signal is being ignored, then we are out of here. * If the signal is being ignored, then we are out of here.
*/ */
if ( !sig || _POSIX_signals_Vectors[ sig ].sa_handler == SIG_IGN ) { if ( _POSIX_signals_Vectors[ sig ].sa_handler == SIG_IGN ) {
return 0; return 0;
} }

View File

@@ -34,7 +34,10 @@ int pthread_kill(
Thread_Control *the_thread; Thread_Control *the_thread;
Objects_Locations location; Objects_Locations location;
if ( sig && !is_valid_signo(sig) ) if ( !sig )
rtems_set_errno_and_return_minus_one( EINVAL );
if ( !is_valid_signo(sig) )
rtems_set_errno_and_return_minus_one( EINVAL ); rtems_set_errno_and_return_minus_one( EINVAL );
/* commented out when posix timers added /* commented out when posix timers added

View File

@@ -271,6 +271,9 @@ int timer_create(
rtems_id timer_id; /* created timer identifier */ rtems_id timer_id; /* created timer identifier */
int timer_pos; /* Position in the table of timers */ int timer_pos; /* Position in the table of timers */
if ( clock_id != CLOCK_REALTIME )
rtems_set_errno_and_return_minus_one( EINVAL );
/* /*
* The data of the structure evp are checked in order to verify if they * The data of the structure evp are checked in order to verify if they
* are coherent. * are coherent.
@@ -283,6 +286,12 @@ int timer_create(
/* The value of the field sigev_notify is not valid */ /* The value of the field sigev_notify is not valid */
rtems_set_errno_and_return_minus_one( EINVAL ); rtems_set_errno_and_return_minus_one( EINVAL );
} }
if ( !evp->sigev_signo )
rtems_set_errno_and_return_minus_one( EINVAL );
if ( !is_valid_signo(evp->sigev_signo) )
rtems_set_errno_and_return_minus_one( EINVAL );
} }
/* /*

View File

@@ -43,7 +43,7 @@ int sigaction(
*oact = _POSIX_signals_Vectors[ sig ]; *oact = _POSIX_signals_Vectors[ sig ];
if ( !sig ) if ( !sig )
return 0; rtems_set_errno_and_return_minus_one( EINVAL );
if ( !is_valid_signo(sig) ) if ( !is_valid_signo(sig) )
rtems_set_errno_and_return_minus_one( EINVAL ); rtems_set_errno_and_return_minus_one( EINVAL );

View File

@@ -32,7 +32,7 @@ int sigaddset(
rtems_set_errno_and_return_minus_one( EINVAL ); rtems_set_errno_and_return_minus_one( EINVAL );
if ( !signo ) if ( !signo )
return 0; rtems_set_errno_and_return_minus_one( EINVAL );
if ( !is_valid_signo(signo) ) if ( !is_valid_signo(signo) )
rtems_set_errno_and_return_minus_one( EINVAL ); rtems_set_errno_and_return_minus_one( EINVAL );

View File

@@ -1,7 +1,7 @@
/* /*
* 3.3.7 Wait for a Signal, P1003.1b-1993, p. 75 * 3.3.7 Wait for a Signal, P1003.1b-1993, p. 75
* *
* COPYRIGHT (c) 1989-1999. * COPYRIGHT (c) 1989-2004.
* On-Line Applications Research Corporation (OAR). * On-Line Applications Research Corporation (OAR).
* *
* The license and distribution terms for this file may be * The license and distribution terms for this file may be
@@ -21,6 +21,7 @@
#include <rtems/system.h> #include <rtems/system.h>
#include <rtems/posix/pthread.h> #include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h> #include <rtems/posix/psignal.h>
#include <rtems/seterr.h>
int sigsuspend( int sigsuspend(
const sigset_t *sigmask const sigset_t *sigmask
@@ -41,5 +42,12 @@ int sigsuspend(
(void) sigprocmask( SIG_SETMASK, &saved_signals_blocked, NULL ); (void) sigprocmask( SIG_SETMASK, &saved_signals_blocked, NULL );
/*
* 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 );
return status; return status;
} }