diff options
Diffstat (limited to 'c/src/exec/posix/src/time.c')
-rw-r--r-- | c/src/exec/posix/src/time.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/c/src/exec/posix/src/time.c b/c/src/exec/posix/src/time.c index 7397635786..f9e5ce835f 100644 --- a/c/src/exec/posix/src/time.c +++ b/c/src/exec/posix/src/time.c @@ -298,12 +298,15 @@ int nanosleep( { Watchdog_Interval ticks; + if ( rqtp->tv_nsec < 0 || rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND ) { + errno = EINVAL; + return -1; + } + /* XXX this is interruptible by a posix signal */ /* XXX rmtp is the time remaining on the timer -- we do not support this */ -/* XXX rmtp may be NULL */ - ticks = _POSIX_Time_Spec_to_interval( rqtp ); _Thread_Disable_dispatch(); @@ -316,7 +319,12 @@ int nanosleep( ); _Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks ); _Thread_Enable_dispatch(); - return 0; /* XXX should account for signal/remaining */ + + if ( rmtp ) { + /* XXX calculate time remaining */ + } + + return 0; /* XXX should account for signal */ } |