nanosleep: negative value for tv_sec is no longer an error. It now

is changed into being a 0 delay.
This commit is contained in:
Joel Sherrill
1996-09-05 20:29:07 +00:00
parent f254b93fd8
commit 9a5cbef006
2 changed files with 20 additions and 8 deletions

View File

@@ -245,11 +245,14 @@ int nanosleep(
struct timespec *rmtp
)
{
Watchdog_Interval ticks;
Watchdog_Interval ticks;
struct timespec *the_rqtp;
if ( !rqtp )
set_errno_and_return_minus_one( EINVAL );
the_rqtp = (struct timespec *)rqtp;
/*
* Return EAGAIN if the delay interval is negative.
*
@@ -257,13 +260,16 @@ int nanosleep(
* FSU pthreads shares this behavior.
*/
if ( rqtp->tv_sec < 0 || rqtp->tv_nsec < 0 )
if ( the_rqtp->tv_sec < 0 )
the_rqtp->tv_sec = 0;
if ( /* the_rqtp->tv_sec < 0 || */ the_rqtp->tv_nsec < 0 )
set_errno_and_return_minus_one( EAGAIN );
if ( rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
if ( the_rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
set_errno_and_return_minus_one( EINVAL );
ticks = _POSIX_Timespec_to_interval( rqtp );
ticks = _POSIX_Timespec_to_interval( the_rqtp );
/*
* This behavior is also beyond the POSIX specification but is

View File

@@ -245,11 +245,14 @@ int nanosleep(
struct timespec *rmtp
)
{
Watchdog_Interval ticks;
Watchdog_Interval ticks;
struct timespec *the_rqtp;
if ( !rqtp )
set_errno_and_return_minus_one( EINVAL );
the_rqtp = (struct timespec *)rqtp;
/*
* Return EAGAIN if the delay interval is negative.
*
@@ -257,13 +260,16 @@ int nanosleep(
* FSU pthreads shares this behavior.
*/
if ( rqtp->tv_sec < 0 || rqtp->tv_nsec < 0 )
if ( the_rqtp->tv_sec < 0 )
the_rqtp->tv_sec = 0;
if ( /* the_rqtp->tv_sec < 0 || */ the_rqtp->tv_nsec < 0 )
set_errno_and_return_minus_one( EAGAIN );
if ( rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
if ( the_rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
set_errno_and_return_minus_one( EINVAL );
ticks = _POSIX_Timespec_to_interval( rqtp );
ticks = _POSIX_Timespec_to_interval( the_rqtp );
/*
* This behavior is also beyond the POSIX specification but is