summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/include/rtems/score/todimpl.h25
-rw-r--r--cpukit/posix/src/clocksettime.c9
-rw-r--r--cpukit/rtems/src/clockset.c9
-rw-r--r--cpukit/score/src/coretodhookrun.c30
-rw-r--r--cpukit/score/src/coretodset.c12
5 files changed, 41 insertions, 44 deletions
diff --git a/cpukit/include/rtems/score/todimpl.h b/cpukit/include/rtems/score/todimpl.h
index 5287c976f5..b54d9a950c 100644
--- a/cpukit/include/rtems/score/todimpl.h
+++ b/cpukit/include/rtems/score/todimpl.h
@@ -18,6 +18,7 @@
#ifndef _RTEMS_SCORE_TODIMPL_H
#define _RTEMS_SCORE_TODIMPL_H
+#include <rtems/score/status.h>
#include <rtems/score/timestamp.h>
#include <rtems/score/timecounterimpl.h>
#include <rtems/score/watchdog.h>
@@ -197,10 +198,10 @@ static inline void _TOD_Release( ISR_lock_Context *lock_context )
* _TOD_Acquire(). The caller must be the owner of the TOD lock. This
* function will release the TOD lock.
*
- * @retval true on success
- * @retval false on failure
+ * @retval STATUS_SUCCESSFUL Successful operation.
+ * @retval other Some error occurred.
*/
-bool _TOD_Set(
+Status_Control _TOD_Set(
const struct timespec *tod,
ISR_lock_Context *lock_context
);
@@ -370,7 +371,7 @@ typedef struct TOD_Hook {
Chain_Node Node;
/** This is the TOD action hook that is invoked. */
- bool (*handler)(TOD_Action, const struct timespec *);
+ Status_Control ( *handler )( TOD_Action, const struct timespec * );
} TOD_Hook;
/**
@@ -384,9 +385,6 @@ extern Chain_Control _TOD_Hooks;
* This method is used to add a hook to the TOD action set.
*
* @brief hook is the action hook to register.
- *
- * @retval true if the hook is added.
- * @retval false if the hook cannot be added.
*/
void _TOD_Hook_Register(
TOD_Hook *hook
@@ -398,9 +396,6 @@ void _TOD_Hook_Register(
* This method is used to remove a hook from the TOD action set.
*
* @brief hook is the action hook to unregister.
- *
- * @retval true if the hook is unregister.
- * @retval false if the hook cannot be unregister.
*/
void _TOD_Hook_Unregister(
TOD_Hook *hook
@@ -411,13 +406,13 @@ void _TOD_Hook_Unregister(
*
* This method is used to invoke the set of TOD action hooks.
*
- * @brief action is the action which triggered this run.
- * @brief tod is the current tod
+ * @brief action The action which triggered this run.
+ * @brief tod The current time of day.
*
- * @retval true if the hooks can be run.
- * @retval false if the hook cannot be run.
+ * @retval STATUS_SUCCESSFUL Successful operation.
+ * @retval other Some error occurred.
*/
-bool _TOD_Hook_Run(
+Status_Control _TOD_Hook_Run(
TOD_Action action,
const struct timespec *tod
);
diff --git a/cpukit/posix/src/clocksettime.c b/cpukit/posix/src/clocksettime.c
index bfae46feee..5bb6f2f14b 100644
--- a/cpukit/posix/src/clocksettime.c
+++ b/cpukit/posix/src/clocksettime.c
@@ -32,7 +32,7 @@ int clock_settime(
const struct timespec *tp
)
{
- bool retval;
+ Status_Control status;
if ( !tp )
rtems_set_errno_and_return_minus_one( EINVAL );
@@ -45,10 +45,11 @@ int clock_settime(
_TOD_Lock();
_TOD_Acquire( &lock_context );
- retval = _TOD_Set( tp, &lock_context );
+ status = _TOD_Set( tp, &lock_context );
_TOD_Unlock();
- if ( retval == false ) {
- rtems_set_errno_and_return_minus_one( EPERM );
+
+ if ( status != STATUS_SUCCESSFUL ) {
+ rtems_set_errno_and_return_minus_one( STATUS_GET_POSIX( status ) );
}
}
#ifdef _POSIX_CPUTIME
diff --git a/cpukit/rtems/src/clockset.c b/cpukit/rtems/src/clockset.c
index a885fe1169..f60efb4c11 100644
--- a/cpukit/rtems/src/clockset.c
+++ b/cpukit/rtems/src/clockset.c
@@ -26,7 +26,7 @@ rtems_status_code rtems_clock_set(
const rtems_time_of_day *tod
)
{
- bool retval;
+ Status_Control status;
if ( !tod )
return RTEMS_INVALID_ADDRESS;
@@ -41,13 +41,10 @@ rtems_status_code rtems_clock_set(
_TOD_Lock();
_TOD_Acquire( &lock_context );
- retval = _TOD_Set( &tod_as_timespec, &lock_context );
+ status = _TOD_Set( &tod_as_timespec, &lock_context );
_TOD_Unlock();
- if ( retval == true ) {
- return RTEMS_SUCCESSFUL;
- }
- return RTEMS_IO_ERROR;
+ return STATUS_GET_CLASSIC( status );
}
return RTEMS_INVALID_CLOCK;
diff --git a/cpukit/score/src/coretodhookrun.c b/cpukit/score/src/coretodhookrun.c
index ae9cf66dfc..c0acc6e5fb 100644
--- a/cpukit/score/src/coretodhookrun.c
+++ b/cpukit/score/src/coretodhookrun.c
@@ -42,31 +42,35 @@
#include <rtems/score/assert.h>
#include <rtems/score/chainimpl.h>
-bool _TOD_Hook_Run(
+Status_Control _TOD_Hook_Run(
TOD_Action action,
const struct timespec *tod
)
{
- Chain_Node *the_node;
- bool retval = true;
+ const Chain_Node *the_node;
+ Status_Control status;
+
+ status = STATUS_SUCCESSFUL;
/*
* This is assumed to be called only from _TOD_Set() which is supposed
- * to be called only while holding the TOD lock.
+ * to be called only while holding the TOD lock.
*/
_Assert( _TOD_Is_owner() );
- for ( the_node = _Chain_First( &_TOD_Hooks );
- !_Chain_Is_tail( &_TOD_Hooks, the_node ) ;
- the_node = the_node->next ) {
- TOD_Hook *the_hook = (TOD_Hook *) the_node;
-
- retval = (the_hook->handler)( action, tod );
- if ( retval == false ) {
+ for (
+ the_node = _Chain_Immutable_first( &_TOD_Hooks );
+ !_Chain_Is_tail( &_TOD_Hooks, the_node );
+ the_node = _Chain_Immutable_next( the_node )
+ ) {
+ const TOD_Hook *the_hook;
+
+ the_hook = (const TOD_Hook *) the_node;
+ status = ( *the_hook->handler )( action, tod );
+ if ( status != STATUS_SUCCESSFUL ) {
break;
}
}
- return retval;
+ return status;
}
-
diff --git a/cpukit/score/src/coretodset.c b/cpukit/score/src/coretodset.c
index 94ecd0b322..ed840ece2b 100644
--- a/cpukit/score/src/coretodset.c
+++ b/cpukit/score/src/coretodset.c
@@ -22,7 +22,7 @@
#include <rtems/score/assert.h>
#include <rtems/score/watchdogimpl.h>
-bool _TOD_Set(
+Status_Control _TOD_Set(
const struct timespec *tod,
ISR_lock_Context *lock_context
)
@@ -31,14 +31,14 @@ bool _TOD_Set(
uint64_t tod_as_ticks;
uint32_t cpu_max;
uint32_t cpu_index;
- bool retval;
+ Status_Control status;
_Assert( _TOD_Is_owner() );
- retval = _TOD_Hook_Run( TOD_ACTION_SET_CLOCK, tod );
- if ( retval == false ) {
+ status = _TOD_Hook_Run( TOD_ACTION_SET_CLOCK, tod );
+ if ( status != STATUS_SUCCESSFUL ) {
_TOD_Release( lock_context );
- return false;
+ return status;
}
timespec2bintime( tod, &tod_as_bintime );
@@ -75,5 +75,5 @@ bool _TOD_Set(
_TOD.is_set = true;
- return true;
+ return STATUS_SUCCESSFUL;
}