diff options
-rw-r--r-- | cpukit/ChangeLog | 5 | ||||
-rw-r--r-- | cpukit/posix/src/sigtimedwait.c | 32 |
2 files changed, 29 insertions, 8 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index caf30fe775..dcbc79c528 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,8 @@ +2009-07-03 Joel Sherrill <joel.sherrill@OARcorp.com> + + * posix/src/sigtimedwait.c: Restructure to improve coverage. Improve + comments. + 2009-07-03 Daniel Hellstrom <daniel@gaisler.com> * sapi/src/exinit.c, score/include/rtems/score/objectmp.h, diff --git a/cpukit/posix/src/sigtimedwait.c b/cpukit/posix/src/sigtimedwait.c index a6b34bc68b..ab53bde1d4 100644 --- a/cpukit/posix/src/sigtimedwait.c +++ b/cpukit/posix/src/sigtimedwait.c @@ -33,18 +33,31 @@ int _POSIX_signals_Get_highest( int signo; for ( signo = SIGRTMIN ; signo <= SIGRTMAX ; signo++ ) { - if ( set & signo_to_mask( signo ) ) - return signo; + if ( set & signo_to_mask( signo ) ) { + goto found_it; + } } -/* XXX - add __SIGFIRSTNOTRT or something like that to newlib signal .h */ + /* + * We assume SIGHUP == 1 and is the first non-real-time signal. + */ + #if (SIGHUP != 1) + #error "Assumption that SIGHUP==1 violated!!" + #endif for ( signo = SIGHUP ; signo <= __SIGLASTNOTRT ; signo++ ) { - if ( set & signo_to_mask( signo ) ) - return signo; + if ( set & signo_to_mask( signo ) ) { + goto found_it; + } } - return 0; + /* + * This is structured this way to eliminate the need to have + * a return 0. This routine will NOT be called unless a signal + * is pending in the set passed in. + */ +found_it: + return signo; } int sigtimedwait( @@ -63,8 +76,11 @@ int sigtimedwait( /* * Error check parameters before disabling interrupts. - * - * NOTE: This is very specifically a RELATIVE not ABSOLUTE time + */ + if ( !set ) + rtems_set_errno_and_return_minus_one( EINVAL ); + + /* NOTE: This is very specifically a RELATIVE not ABSOLUTE time * in the Open Group specification. */ |