summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/sigtimedwait.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-23 13:37:59 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-26 21:44:31 +0200
commitdce487912d98835b8168e755b60514f5a8592b27 (patch)
tree8778547fbb0f2dbb07bb6a83f28d3f4464924141 /cpukit/posix/src/sigtimedwait.c
parentposix: Fix sem_init() with too large initial value (diff)
downloadrtems-dce487912d98835b8168e755b60514f5a8592b27.tar.bz2
score: Add Status_Control for all APIs
Unify the status codes of the Classic and POSIX API to use the new enum Status_Control. This eliminates the Thread_Control::Wait::timeout_code field and the timeout parameter of _Thread_queue_Enqueue_critical() and _MPCI_Send_request_packet(). It gets rid of the status code translation tables and instead uses simple bit operations to get the status for a particular API. This enables translation of status code constants at compile time. Add _Thread_Wait_get_status() to avoid direct access of thread internal data structures.
Diffstat (limited to 'cpukit/posix/src/sigtimedwait.c')
-rw-r--r--cpukit/posix/src/sigtimedwait.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/cpukit/posix/src/sigtimedwait.c b/cpukit/posix/src/sigtimedwait.c
index 77dbe533ca..ddc2884d68 100644
--- a/cpukit/posix/src/sigtimedwait.c
+++ b/cpukit/posix/src/sigtimedwait.c
@@ -18,14 +18,12 @@
#include "config.h"
#endif
-#include <pthread.h>
#include <signal.h>
-#include <errno.h>
#include <rtems/posix/pthreadimpl.h>
#include <rtems/posix/psignalimpl.h>
+#include <rtems/posix/posixapi.h>
#include <rtems/score/threadqimpl.h>
-#include <rtems/seterr.h>
#include <rtems/score/isr.h>
static int _POSIX_signals_Get_lowest(
@@ -78,6 +76,7 @@ int sigtimedwait(
siginfo_t *the_info;
int signo;
ISR_lock_Context lock_context;
+ int error;
/*
* Error check parameters before disabling interrupts.
@@ -150,7 +149,6 @@ int sigtimedwait(
the_info->si_signo = -1;
- executing->Wait.return_code = EINTR;
executing->Wait.option = *set;
executing->Wait.return_argument = the_info;
_Thread_queue_Enqueue_critical(
@@ -159,7 +157,6 @@ int sigtimedwait(
executing,
STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL,
interval,
- EAGAIN,
&lock_context
);
@@ -182,10 +179,17 @@ int sigtimedwait(
* was not in our set.
*/
- if ( (executing->Wait.return_code != EINTR)
- || !(*set & signo_to_mask( the_info->si_signo )) ) {
- errno = executing->Wait.return_code;
- return -1;
+ error = _POSIX_Get_error_after_wait( executing );
+
+ if (
+ error != EINTR
+ || ( *set & signo_to_mask( the_info->si_signo ) ) == 0
+ ) {
+ if ( error == ETIMEDOUT ) {
+ error = EAGAIN;
+ }
+
+ rtems_set_errno_and_return_minus_one( error );
}
return the_info->si_signo;