summaryrefslogtreecommitdiffstats
path: root/cpukit/posix
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2004-05-21 20:19:33 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2004-05-21 20:19:33 +0000
commit138aa38dead219cc0687187780040a9a20ba3dec (patch)
tree620f8780e4f7bde3fc7e87762312d42982f20127 /cpukit/posix
parent58accdd0835f9544a4e1ad0f88ef8d5ea815dd83 (diff)
downloadrtems-138aa38dead219cc0687187780040a9a20ba3dec.tar.bz2
2004-05-21 Joel Sherrill <joel@OARcorp.com>
PR 628/rtems * posix/src/killinfo.c, posix/src/pthreadkill.c, posix/src/ptimer1.c, posix/src/sigaction.c, posix/src/sigaddset.c, posix/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.
Diffstat (limited to 'cpukit/posix')
-rw-r--r--cpukit/posix/src/killinfo.c10
-rw-r--r--cpukit/posix/src/pthreadkill.c5
-rw-r--r--cpukit/posix/src/ptimer1.c9
-rw-r--r--cpukit/posix/src/sigaction.c2
-rw-r--r--cpukit/posix/src/sigaddset.c2
-rw-r--r--cpukit/posix/src/sigsuspend.c10
6 files changed, 30 insertions, 8 deletions
diff --git a/cpukit/posix/src/killinfo.c b/cpukit/posix/src/killinfo.c
index 945306e697..b275a0b764 100644
--- a/cpukit/posix/src/killinfo.c
+++ b/cpukit/posix/src/killinfo.c
@@ -66,18 +66,20 @@ int killinfo(
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 );
- }
/*
* 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;
}
diff --git a/cpukit/posix/src/pthreadkill.c b/cpukit/posix/src/pthreadkill.c
index 6a1a7b4c86..c6624eb8be 100644
--- a/cpukit/posix/src/pthreadkill.c
+++ b/cpukit/posix/src/pthreadkill.c
@@ -34,7 +34,10 @@ int pthread_kill(
Thread_Control *the_thread;
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 );
/* commented out when posix timers added
diff --git a/cpukit/posix/src/ptimer1.c b/cpukit/posix/src/ptimer1.c
index 6f7ec2466f..368dff43ff 100644
--- a/cpukit/posix/src/ptimer1.c
+++ b/cpukit/posix/src/ptimer1.c
@@ -271,6 +271,9 @@ int timer_create(
rtems_id timer_id; /* created timer identifier */
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
* are coherent.
@@ -283,6 +286,12 @@ int timer_create(
/* The value of the field sigev_notify is not valid */
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 );
}
/*
diff --git a/cpukit/posix/src/sigaction.c b/cpukit/posix/src/sigaction.c
index b986d97ba1..a8d48f9f3b 100644
--- a/cpukit/posix/src/sigaction.c
+++ b/cpukit/posix/src/sigaction.c
@@ -43,7 +43,7 @@ int sigaction(
*oact = _POSIX_signals_Vectors[ sig ];
if ( !sig )
- return 0;
+ rtems_set_errno_and_return_minus_one( EINVAL );
if ( !is_valid_signo(sig) )
rtems_set_errno_and_return_minus_one( EINVAL );
diff --git a/cpukit/posix/src/sigaddset.c b/cpukit/posix/src/sigaddset.c
index 7f738771b0..5ac0fe0f17 100644
--- a/cpukit/posix/src/sigaddset.c
+++ b/cpukit/posix/src/sigaddset.c
@@ -32,7 +32,7 @@ int sigaddset(
rtems_set_errno_and_return_minus_one( EINVAL );
if ( !signo )
- return 0;
+ rtems_set_errno_and_return_minus_one( EINVAL );
if ( !is_valid_signo(signo) )
rtems_set_errno_and_return_minus_one( EINVAL );
diff --git a/cpukit/posix/src/sigsuspend.c b/cpukit/posix/src/sigsuspend.c
index aca97a868d..aa330bc71c 100644
--- a/cpukit/posix/src/sigsuspend.c
+++ b/cpukit/posix/src/sigsuspend.c
@@ -1,7 +1,7 @@
/*
* 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).
*
* The license and distribution terms for this file may be
@@ -21,6 +21,7 @@
#include <rtems/system.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/psignal.h>
+#include <rtems/seterr.h>
int sigsuspend(
const sigset_t *sigmask
@@ -41,5 +42,12 @@ int sigsuspend(
(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;
}