removed errors for TOD not set yet.

made nanosleep return -1/EINTR for being interrupted for a signal.
This commit is contained in:
Joel Sherrill
1996-08-13 14:24:00 +00:00
parent aac34f7bbc
commit f48c906895
2 changed files with 18 additions and 18 deletions

View File

@@ -171,10 +171,6 @@ int clock_gettime(
switch ( clock_id ) { switch ( clock_id ) {
case CLOCK_REALTIME: case CLOCK_REALTIME:
#if 0
if ( !_TOD_Is_set() ) /* XXX does posix allow it to not be set? */
set_errno_and_return_minus_one( EINVAL );
#endif
_ISR_Disable( level ); _ISR_Disable( level );
seconds = _TOD_Seconds_since_epoch; seconds = _TOD_Seconds_since_epoch;
@@ -266,8 +262,6 @@ int nanosleep(
if ( rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND ) if ( rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
set_errno_and_return_minus_one( EINVAL ); set_errno_and_return_minus_one( EINVAL );
/* XXX this is interruptible by a posix signal */
ticks = _POSIX_Timespec_to_interval( rqtp ); ticks = _POSIX_Timespec_to_interval( rqtp );
/* /*
@@ -292,7 +286,7 @@ int nanosleep(
); );
_Watchdog_Initialize( _Watchdog_Initialize(
&_Thread_Executing->Timer, &_Thread_Executing->Timer,
_Thread_Delay_ended, /* XXX may need to be POSIX specific */ _Thread_Delay_ended,
_Thread_Executing->Object.id, _Thread_Executing->Object.id,
NULL NULL
); );
@@ -306,10 +300,16 @@ int nanosleep(
_Thread_Executing->Timer.stop_time - _Thread_Executing->Timer.start_time; _Thread_Executing->Timer.stop_time - _Thread_Executing->Timer.start_time;
_POSIX_Interval_to_timespec( ticks, rmtp ); _POSIX_Interval_to_timespec( ticks, rmtp );
/*
* If there is time remaining, then we were interrupted by a signal.
*/
if ( ticks )
set_errno_and_return_minus_one( EINTR );
} }
return 0; /* XXX should account for signal */ return 0;
} }
/*PAGE /*PAGE

View File

@@ -171,10 +171,6 @@ int clock_gettime(
switch ( clock_id ) { switch ( clock_id ) {
case CLOCK_REALTIME: case CLOCK_REALTIME:
#if 0
if ( !_TOD_Is_set() ) /* XXX does posix allow it to not be set? */
set_errno_and_return_minus_one( EINVAL );
#endif
_ISR_Disable( level ); _ISR_Disable( level );
seconds = _TOD_Seconds_since_epoch; seconds = _TOD_Seconds_since_epoch;
@@ -266,8 +262,6 @@ int nanosleep(
if ( rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND ) if ( rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
set_errno_and_return_minus_one( EINVAL ); set_errno_and_return_minus_one( EINVAL );
/* XXX this is interruptible by a posix signal */
ticks = _POSIX_Timespec_to_interval( rqtp ); ticks = _POSIX_Timespec_to_interval( rqtp );
/* /*
@@ -292,7 +286,7 @@ int nanosleep(
); );
_Watchdog_Initialize( _Watchdog_Initialize(
&_Thread_Executing->Timer, &_Thread_Executing->Timer,
_Thread_Delay_ended, /* XXX may need to be POSIX specific */ _Thread_Delay_ended,
_Thread_Executing->Object.id, _Thread_Executing->Object.id,
NULL NULL
); );
@@ -306,10 +300,16 @@ int nanosleep(
_Thread_Executing->Timer.stop_time - _Thread_Executing->Timer.start_time; _Thread_Executing->Timer.stop_time - _Thread_Executing->Timer.start_time;
_POSIX_Interval_to_timespec( ticks, rmtp ); _POSIX_Interval_to_timespec( ticks, rmtp );
/*
* If there is time remaining, then we were interrupted by a signal.
*/
if ( ticks )
set_errno_and_return_minus_one( EINTR );
} }
return 0; /* XXX should account for signal */ return 0;
} }
/*PAGE /*PAGE