summaryrefslogtreecommitdiffstats
path: root/cpukit/posix
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-10-04 22:08:43 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-10-04 22:08:43 +0000
commitff3c06a5297407d857289aea716c7867cf2399b8 (patch)
tree2bbf28ef1d1243135ea489cae71c454a22501a53 /cpukit/posix
parent2009-10-04 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-ff3c06a5297407d857289aea716c7867cf2399b8.tar.bz2
2009-10-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* posix/include/rtems/posix/psignal.h: Add extern for ualarm timer. * posix/src/alarm.c, posix/src/ualarm.c: Change from switch to if since many enumerated values have no action. * posix/src/psignal.c: Initialize ualarm and alarm timers.
Diffstat (limited to 'cpukit/posix')
-rw-r--r--cpukit/posix/include/rtems/posix/psignal.h2
-rw-r--r--cpukit/posix/src/alarm.c29
-rw-r--r--cpukit/posix/src/psignal.c6
-rw-r--r--cpukit/posix/src/ualarm.c38
4 files changed, 37 insertions, 38 deletions
diff --git a/cpukit/posix/include/rtems/posix/psignal.h b/cpukit/posix/include/rtems/posix/psignal.h
index 7fbd0e274a..608a8519e9 100644
--- a/cpukit/posix/include/rtems/posix/psignal.h
+++ b/cpukit/posix/include/rtems/posix/psignal.h
@@ -63,6 +63,8 @@ extern struct sigaction _POSIX_signals_Vectors[ SIG_ARRAY_MAX ];
extern Watchdog_Control _POSIX_signals_Alarm_timer;
+extern Watchdog_Control _POSIX_signals_Ualarm_timer;
+
extern Thread_queue_Control _POSIX_signals_Wait_queue;
extern Chain_Control _POSIX_signals_Inactive_siginfo;
diff --git a/cpukit/posix/src/alarm.c b/cpukit/posix/src/alarm.c
index abc9ab3240..266df94283 100644
--- a/cpukit/posix/src/alarm.c
+++ b/cpukit/posix/src/alarm.c
@@ -56,23 +56,18 @@ unsigned int alarm(
if ( !the_timer->routine ) {
_Watchdog_Initialize( the_timer, _POSIX_signals_Alarm_TSR, 0, NULL );
} else {
- switch ( _Watchdog_Remove( the_timer ) ) {
- case WATCHDOG_INACTIVE:
- case WATCHDOG_BEING_INSERTED:
- break;
-
- case WATCHDOG_ACTIVE:
- case WATCHDOG_REMOVE_IT:
- /*
- * The stop_time and start_time fields are snapshots of ticks since
- * boot. Since alarm() is dealing in seconds, we must account for
- * this.
- */
-
- remaining = the_timer->initial -
- ((the_timer->stop_time - the_timer->start_time) /
- TOD_TICKS_PER_SECOND);
- break;
+ Watchdog_States state;
+
+ state = _Watchdog_Remove( the_timer );
+ if ( (state == WATCHDOG_ACTIVE) || (state == WATCHDOG_REMOVE_IT) ) {
+ /*
+ * The stop_time and start_time fields are snapshots of ticks since
+ * boot. Since alarm() is dealing in seconds, we must account for
+ * this.
+ */
+
+ remaining = the_timer->initial -
+ ((the_timer->stop_time - the_timer->start_time) / TOD_TICKS_PER_SECOND);
}
}
diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c
index e477cd399e..926d1758da 100644
--- a/cpukit/posix/src/psignal.c
+++ b/cpukit/posix/src/psignal.c
@@ -214,4 +214,10 @@ void _POSIX_signals_Manager_Initialization(void)
} else {
_Chain_Initialize_empty( &_POSIX_signals_Inactive_siginfo );
}
+
+ /*
+ * Initialize the Alarm Timer
+ */
+ _Watchdog_Initialize( &_POSIX_signals_Alarm_timer, NULL, 0, NULL );
+ _Watchdog_Initialize( &_POSIX_signals_Ualarm_timer, NULL, 0, NULL );
}
diff --git a/cpukit/posix/src/ualarm.c b/cpukit/posix/src/ualarm.c
index 6fcc4087ed..8910dac217 100644
--- a/cpukit/posix/src/ualarm.c
+++ b/cpukit/posix/src/ualarm.c
@@ -66,27 +66,23 @@ useconds_t ualarm(
if ( !the_timer->routine ) {
_Watchdog_Initialize( the_timer, _POSIX_signals_Ualarm_TSR, 0, NULL );
} else {
- switch ( _Watchdog_Remove( the_timer ) ) {
- case WATCHDOG_INACTIVE:
- case WATCHDOG_BEING_INSERTED:
- break;
-
- case WATCHDOG_ACTIVE:
- case WATCHDOG_REMOVE_IT:
- /*
- * The stop_time and start_time fields are snapshots of ticks since
- * boot. Since alarm() is dealing in seconds, we must account for
- * this.
- */
-
- ticks = the_timer->initial;
- ticks -= (the_timer->stop_time - the_timer->start_time);
- /* remaining is now in ticks */
-
- _Timespec_From_ticks( ticks, &tp );
- remaining = tp.tv_sec * TOD_MICROSECONDS_PER_SECOND;
- remaining += tp.tv_nsec / 1000;
- break;
+ Watchdog_States state;
+
+ state = _Watchdog_Remove( the_timer );
+ if ( (state == WATCHDOG_ACTIVE) || (state == WATCHDOG_REMOVE_IT) ) {
+ /*
+ * The stop_time and start_time fields are snapshots of ticks since
+ * boot. Since alarm() is dealing in seconds, we must account for
+ * this.
+ */
+
+ ticks = the_timer->initial;
+ ticks -= (the_timer->stop_time - the_timer->start_time);
+ /* remaining is now in ticks */
+
+ _Timespec_From_ticks( ticks, &tp );
+ remaining = tp.tv_sec * TOD_MICROSECONDS_PER_SECOND;
+ remaining += tp.tv_nsec / 1000;
}
}