summaryrefslogtreecommitdiffstats
path: root/cpukit/posix
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-03 18:40:31 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-03 18:40:31 +0000
commitecdbb4259ef9e05400042cb246e17971ad01c469 (patch)
tree15d763ed74ef7a0100f17ad6346aa835b5d591af /cpukit/posix
parent2009-07-03 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-ecdbb4259ef9e05400042cb246e17971ad01c469.tar.bz2
2009-07-03 Joel Sherrill <joel.sherrill@OARcorp.com>
* posix/src/sigtimedwait.c: Restructure to improve coverage. Improve comments.
Diffstat (limited to 'cpukit/posix')
-rw-r--r--cpukit/posix/src/sigtimedwait.c32
1 files changed, 24 insertions, 8 deletions
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.
*/