summaryrefslogtreecommitdiffstats
path: root/cpukit/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-04-26 11:22:39 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-04-27 19:40:13 +0200
commit9d82150f5a83e8dcf985de26799f99f7c46ec515 (patch)
treefe568eaa83c10f1bfa6374dbe92649fac93681b6 /cpukit/include
parentrtems: Change rtems_task_get_affinity() status (diff)
downloadrtems-9d82150f5a83e8dcf985de26799f99f7c46ec515.tar.bz2
Return status code for _Scheduler_Set_affinity()
This avoids having conditional statements to get the API-specific status code.
Diffstat (limited to 'cpukit/include')
-rw-r--r--cpukit/include/rtems/score/scheduler.h12
-rw-r--r--cpukit/include/rtems/score/scheduleredfsmp.h9
-rw-r--r--cpukit/include/rtems/score/schedulerimpl.h27
-rw-r--r--cpukit/include/rtems/score/schedulerpriorityaffinitysmp.h6
4 files changed, 35 insertions, 19 deletions
diff --git a/cpukit/include/rtems/score/scheduler.h b/cpukit/include/rtems/score/scheduler.h
index 7a566cf44d..da1e030ab8 100644
--- a/cpukit/include/rtems/score/scheduler.h
+++ b/cpukit/include/rtems/score/scheduler.h
@@ -21,6 +21,7 @@
#define _RTEMS_SCORE_SCHEDULER_H
#include <rtems/score/thread.h>
+#include <rtems/score/status.h>
#ifdef __cplusplus
extern "C" {
@@ -228,7 +229,7 @@ typedef struct {
#if defined(RTEMS_SMP)
/** @see _Scheduler_Set_affinity() */
- bool ( *set_affinity )(
+ Status_Control ( *set_affinity )(
const Scheduler_Control *,
Thread_Control *,
Scheduler_Node *,
@@ -581,10 +582,13 @@ void _Scheduler_default_Start_idle(
* @param node This parameter is unused.
* @param affinity The new processor affinity set for the thread.
*
- * @retval true The processor set of the scheduler is a subset of the affinity set.
- * @retval false The processor set of the scheduler is not a subset of the affinity set.
+ * @retval STATUS_SUCCESSFUL The affinity is a subset of the online
+ * processors.
+ *
+ * @retval STATUS_INVALID_NUMBER The affinity is not a subset of the online
+ * processors.
*/
- bool _Scheduler_default_Set_affinity(
+ Status_Control _Scheduler_default_Set_affinity(
const Scheduler_Control *scheduler,
Thread_Control *thread,
Scheduler_Node *node,
diff --git a/cpukit/include/rtems/score/scheduleredfsmp.h b/cpukit/include/rtems/score/scheduleredfsmp.h
index 69dcd1ab3f..6fef6fb86a 100644
--- a/cpukit/include/rtems/score/scheduleredfsmp.h
+++ b/cpukit/include/rtems/score/scheduleredfsmp.h
@@ -330,10 +330,13 @@ void _Scheduler_EDF_SMP_Start_idle(
* @param node This parameter is unused.
* @param affinity The new processor affinity set for the thread.
*
- * @retval true The processor set of the scheduler is a subset of the affinity set.
- * @retval false The processor set of the scheduler is not a subset of the affinity set.
+ * @retval STATUS_SUCCESSFUL The processor set of the scheduler is a subset of
+ * the affinity set.
+ *
+ * @retval STATUS_INVALID_NUMBER The processor set of the scheduler is not a
+ * subset of the affinity set.
*/
-bool _Scheduler_EDF_SMP_Set_affinity(
+Status_Control _Scheduler_EDF_SMP_Set_affinity(
const Scheduler_Control *scheduler,
Thread_Control *thread,
Scheduler_Node *node,
diff --git a/cpukit/include/rtems/score/schedulerimpl.h b/cpukit/include/rtems/score/schedulerimpl.h
index 65c600b583..595d6291b4 100644
--- a/cpukit/include/rtems/score/schedulerimpl.h
+++ b/cpukit/include/rtems/score/schedulerimpl.h
@@ -711,10 +711,12 @@ Status_Control _Scheduler_Get_affinity(
* @param node This parameter is unused.
* @param affinity The processor mask to check.
*
- * @retval true @a affinity is a subset of the online processors.
- * @retval false @a affinity is not a subset of the online processors.
+ * @retval STATUS_SUCCESSFUL The affinity is a subset of the online processors.
+ *
+ * @retval STATUS_INVALID_NUMBER The affinity is not a subset of the online
+ * processors.
*/
-RTEMS_INLINE_ROUTINE bool _Scheduler_default_Set_affinity_body(
+RTEMS_INLINE_ROUTINE Status_Control _Scheduler_default_Set_affinity_body(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node,
@@ -724,7 +726,12 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_default_Set_affinity_body(
(void) scheduler;
(void) the_thread;
(void) node;
- return _Processor_mask_Is_subset( affinity, _SMP_Get_online_processors() );
+
+ if ( !_Processor_mask_Is_subset( affinity, _SMP_Get_online_processors() ) ) {
+ return STATUS_INVALID_NUMBER;
+ }
+
+ return STATUS_SUCCESSFUL;
}
/**
@@ -734,10 +741,12 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_default_Set_affinity_body(
* @param cpusetsize The size of @a cpuset.
* @param cpuset The cpuset to set the affinity.
*
- * @retval true The operation succeeded.
- * @retval false The operation did not succeed.
+ * @retval STATUS_SUCCESSFUL The operation succeeded.
+ *
+ * @retval STATUS_INVALID_NUMBER The processor set was not a valid new
+ * processor affinity set for the thread.
*/
-bool _Scheduler_Set_affinity(
+Status_Control _Scheduler_Set_affinity(
Thread_Control *the_thread,
size_t cpusetsize,
const cpu_set_t *cpuset
@@ -1318,12 +1327,12 @@ RTEMS_INLINE_ROUTINE Status_Control _Scheduler_Set(
if (
_Scheduler_Get_processor_count( new_scheduler ) == 0
- || !( *new_scheduler->Operations.set_affinity )(
+ || ( *new_scheduler->Operations.set_affinity )(
new_scheduler,
the_thread,
new_scheduler_node,
&the_thread->Scheduler.Affinity
- )
+ ) != STATUS_SUCCESSFUL
) {
_Scheduler_Release_critical( new_scheduler, &lock_context );
_Priority_Plain_insert(
diff --git a/cpukit/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/include/rtems/score/schedulerpriorityaffinitysmp.h
index 3d5ccaae10..772a83f541 100644
--- a/cpukit/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -213,10 +213,10 @@ Thread_Control *_Scheduler_priority_affinity_SMP_Remove_processor(
* @param[in, out] node The scheduler node.
* @param affinity The new affinity set.
*
- * @retval true if successful
- * @retval false if unsuccessful
+ * @retval STATUS_SUCCESSFUL if successful
+ * @retval STATUS_INVALID_NUMBER if unsuccessful
*/
-bool _Scheduler_priority_affinity_SMP_Set_affinity(
+Status_Control _Scheduler_priority_affinity_SMP_Set_affinity(
const Scheduler_Control *scheduler,
Thread_Control *thread,
Scheduler_Node *node,