[rtems commit] score: Return status in _TOD_Adjust()
Sebastian Huber
sebh at rtems.org
Mon Sep 6 10:25:31 UTC 2021
Module: rtems
Branch: master
Commit: 8abd175669a6ec2e5b46216947e68eaf4bd29cdf
Changeset: http://git.rtems.org/rtems/commit/?id=8abd175669a6ec2e5b46216947e68eaf4bd29cdf
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Sep 3 09:33:01 2021 +0200
score: Return status in _TOD_Adjust()
---
cpukit/include/rtems/score/todimpl.h | 5 ++++-
cpukit/posix/src/adjtime.c | 6 +++++-
cpukit/score/src/coretodadjust.c | 7 +++++--
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/cpukit/include/rtems/score/todimpl.h b/cpukit/include/rtems/score/todimpl.h
index 316a56e..02a7fb1 100644
--- a/cpukit/include/rtems/score/todimpl.h
+++ b/cpukit/include/rtems/score/todimpl.h
@@ -337,8 +337,11 @@ RTEMS_INLINE_ROUTINE void _TOD_Get_timeval(
* specified amount.
*
* @param delta is the amount to adjust.
+ *
+ * @retval STATUS_SUCCESSFUL Successful operation.
+ * @retval other Some error occurred.
*/
-void _TOD_Adjust(
+Status_Control _TOD_Adjust(
const struct timespec *delta
);
diff --git a/cpukit/posix/src/adjtime.c b/cpukit/posix/src/adjtime.c
index ab61693..ec8cb19 100644
--- a/cpukit/posix/src/adjtime.c
+++ b/cpukit/posix/src/adjtime.c
@@ -44,6 +44,7 @@ int adjtime(
)
{
struct timespec delta_as_timespec;
+ Status_Control status;
/*
* Simple validations
@@ -83,7 +84,10 @@ int adjtime(
/*
* Now apply the adjustment
*/
- _TOD_Adjust( &delta_as_timespec );
+ status = _TOD_Adjust( &delta_as_timespec );
+ if ( status != STATUS_SUCCESSFUL ) {
+ rtems_set_errno_and_return_minus_one( STATUS_GET_POSIX( status ) );
+ }
return 0;
}
diff --git a/cpukit/score/src/coretodadjust.c b/cpukit/score/src/coretodadjust.c
index a746b0e..90c9980 100644
--- a/cpukit/score/src/coretodadjust.c
+++ b/cpukit/score/src/coretodadjust.c
@@ -22,12 +22,13 @@
#include <rtems/score/todimpl.h>
-void _TOD_Adjust(
+Status_Control _TOD_Adjust(
const struct timespec *delta
)
{
ISR_lock_Context lock_context;
struct timespec tod;
+ Status_Control status;
/*
* Currently, RTEMS does the adjustment in one movement.
@@ -41,6 +42,8 @@ void _TOD_Adjust(
_TOD_Acquire( &lock_context );
_TOD_Get( &tod );
_Timespec_Add_to( &tod, delta );
- _TOD_Set( &tod, &lock_context );
+ status = _TOD_Set( &tod, &lock_context );
_TOD_Unlock();
+
+ return status;
}
More information about the vc
mailing list