summaryrefslogtreecommitdiffstats
path: root/cpukit/posix
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-29 20:29:05 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-11-02 14:08:32 +0100
commit3e81d52e27ea030fc93580c610c40616ab2b0559 (patch)
tree5fe2bbc0217d90328a9c6d8ad43fb9bb3cbb0ddf /cpukit/posix
parenttests: Use printf() instead of fprintf() (diff)
downloadrtems-3e81d52e27ea030fc93580c610c40616ab2b0559.tar.bz2
posix: Use far future for very long timeouts
Close #3205.
Diffstat (limited to 'cpukit/posix')
-rw-r--r--cpukit/posix/src/nanosleep.c14
-rw-r--r--cpukit/posix/src/sigtimedwait.c16
2 files changed, 8 insertions, 22 deletions
diff --git a/cpukit/posix/src/nanosleep.c b/cpukit/posix/src/nanosleep.c
index f65c91bc17..5bd1b00aa9 100644
--- a/cpukit/posix/src/nanosleep.c
+++ b/cpukit/posix/src/nanosleep.c
@@ -63,7 +63,7 @@ int clock_nanosleep(
)
{
Thread_queue_Context queue_context;
- struct timespec spare_end;
+ struct timespec uptime;
const struct timespec *end;
Thread_Control *executing;
int eno;
@@ -93,16 +93,8 @@ int clock_nanosleep(
);
}
} else {
- if ( !_Watchdog_Is_valid_interval_timespec( rqtp ) ) {
- return EINVAL;
- }
-
- _TOD_Get_zero_based_uptime_as_timespec( &spare_end );
-
- /* In case this overflows, then the enqueue callout will reject it */
- _Timespec_Add_to( &spare_end, rqtp );
-
- end = &spare_end;
+ _TOD_Get_zero_based_uptime_as_timespec( &uptime );
+ end = _Watchdog_Future_timespec( &uptime, rqtp );
_Thread_queue_Context_set_enqueue_timeout_monotonic_timespec(
&queue_context,
end
diff --git a/cpukit/posix/src/sigtimedwait.c b/cpukit/posix/src/sigtimedwait.c
index a0e18adef0..72f4919be9 100644
--- a/cpukit/posix/src/sigtimedwait.c
+++ b/cpukit/posix/src/sigtimedwait.c
@@ -76,6 +76,7 @@ int sigtimedwait(
siginfo_t signal_information;
siginfo_t *the_info;
int signo;
+ struct timespec uptime;
Thread_queue_Context queue_context;
int error;
@@ -92,20 +93,13 @@ int sigtimedwait(
*/
if ( timeout != NULL ) {
- struct timespec end;
-
- if ( !_Watchdog_Is_valid_interval_timespec( timeout ) ) {
- return EINVAL;
- }
-
- _TOD_Get_zero_based_uptime_as_timespec( &end );
-
- /* In case this overflows, then the enqueue callout will reject it */
- _Timespec_Add_to( &end, timeout );
+ const struct timespec *end;
+ _TOD_Get_zero_based_uptime_as_timespec( &uptime );
+ end = _Watchdog_Future_timespec( &uptime, timeout );
_Thread_queue_Context_set_enqueue_timeout_monotonic_timespec(
&queue_context,
- &end
+ end
);
} else {
_Thread_queue_Context_set_enqueue_do_nothing_extra( &queue_context );