forked from Imagelibrary/rtems
2008-08-19 Tim FitzGeorge <tim.fitzgeorge@astrium.eads.net>
PR 1296/cpukit. * posix/src/timersettime.c: POSIX timers use incorrect repeat interval. This patch fixes the following problems in timer_settime: 1) Uses value.it_interval for repeat period. 2) Corrects test for incorrect value of it_value.tv_nsec (should reject 1000000000).
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2008-08-19 Tim FitzGeorge <tim.fitzgeorge@astrium.eads.net>
|
||||
|
||||
PR 1296/cpukit.
|
||||
* posix/src/timersettime.c: POSIX timers use incorrect repeat interval.
|
||||
This patch fixes the following problems in timer_settime: 1) Uses
|
||||
value.it_interval for repeat period. 2) Corrects test for incorrect
|
||||
value of it_value.tv_nsec (should reject 1000000000).
|
||||
|
||||
2008-08-19 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* score/inline/rtems/score/threadmp.inl: Add include of
|
||||
|
||||
@@ -36,14 +36,17 @@ int timer_settime(
|
||||
POSIX_Timer_Control *ptimer;
|
||||
Objects_Locations location;
|
||||
boolean activated;
|
||||
uint32_t initial_period;
|
||||
struct itimerspec normalize;
|
||||
|
||||
if ( !value )
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
/* First, it verifies if the structure "value" is correct */
|
||||
if ( ( value->it_value.tv_nsec > TOD_NANOSECONDS_PER_SECOND ) ||
|
||||
( value->it_value.tv_nsec < 0 ) ) {
|
||||
if ( ( value->it_value.tv_nsec >= TOD_NANOSECONDS_PER_SECOND ) ||
|
||||
( value->it_value.tv_nsec < 0 ) ||
|
||||
( value->it_interval.tv_nsec >= TOD_NANOSECONDS_PER_SECOND) ||
|
||||
( value->it_interval.tv_nsec < 0 )) {
|
||||
/* The number of nanoseconds is not correct */
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
}
|
||||
@@ -57,7 +60,7 @@ int timer_settime(
|
||||
/* Convert absolute to relative time */
|
||||
if (flags == TIMER_ABSTIME) {
|
||||
/* Check for seconds in the past */
|
||||
if ( _Timespec_Greater_than( &normalize.it_value, &_TOD_Now ) )
|
||||
if ( _Timespec_Greater_than( &_TOD_Now, &normalize.it_value ) )
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
_Timespec_Subtract( &_TOD_Now, &normalize.it_value, &normalize.it_value );
|
||||
}
|
||||
@@ -88,11 +91,13 @@ int timer_settime(
|
||||
}
|
||||
|
||||
/* Convert from seconds and nanoseconds to ticks */
|
||||
ptimer->ticks = _Timespec_To_ticks( &normalize.it_value );
|
||||
ptimer->ticks = _Timespec_To_ticks( &value->it_interval );
|
||||
initial_period = _Timespec_To_ticks( &normalize.it_value );
|
||||
|
||||
|
||||
activated = _POSIX_Timer_Insert_helper(
|
||||
&ptimer->Timer,
|
||||
ptimer->ticks,
|
||||
initial_period,
|
||||
ptimer->Object.id,
|
||||
_POSIX_Timer_TSR,
|
||||
ptimer
|
||||
|
||||
Reference in New Issue
Block a user