[PATCH] rtems: Change rtems_task_get_affinity() status

Gedare Bloom gedare at rtems.org
Tue Apr 27 16:06:11 UTC 2021


This is an API visible change. Please add a ticket.

On Mon, Apr 26, 2021 at 5:54 AM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
> Return RTEMS_INVALID_SIZE if the processor set is too small to contain
> the processor affinity set of the task.
> ---
>  cpukit/include/rtems/score/schedulerimpl.h | 2 +-
>  cpukit/include/rtems/score/status.h        | 2 ++
>  cpukit/score/src/schedulergetaffinity.c    | 2 +-
>  testsuites/smptests/smpaffinity01/init.c   | 2 +-
>  testsuites/sptests/spscheduler01/init.c    | 2 +-
>  5 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/cpukit/include/rtems/score/schedulerimpl.h b/cpukit/include/rtems/score/schedulerimpl.h
> index 397789372c..65c600b583 100644
> --- a/cpukit/include/rtems/score/schedulerimpl.h
> +++ b/cpukit/include/rtems/score/schedulerimpl.h
> @@ -695,7 +695,7 @@ RTEMS_INLINE_ROUTINE const Processor_mask *_Scheduler_Get_processors(
>   *
>   * @retval STATUS_SUCCESSFUL The operation succeeded.
>   *
> - * @retval STATUS_INVALID_NUMBER The processor set was too small.
> + * @retval STATUS_INVALID_SIZE The processor set was too small.
>   */
>  Status_Control _Scheduler_Get_affinity(
>    Thread_Control *the_thread,
> diff --git a/cpukit/include/rtems/score/status.h b/cpukit/include/rtems/score/status.h
> index ba3910d40d..236ae52d7b 100644
> --- a/cpukit/include/rtems/score/status.h
> +++ b/cpukit/include/rtems/score/status.h
> @@ -118,6 +118,8 @@ typedef enum {
>      STATUS_BUILD( STATUS_CLASSIC_INVALID_NUMBER, EINVAL ),
>    STATUS_INVALID_PRIORITY =
>      STATUS_BUILD( STATUS_CLASSIC_INVALID_PRIORITY, EINVAL ),
> +  STATUS_INVALID_SIZE =
> +    STATUS_BUILD( STATUS_CLASSIC_INVALID_SIZE, EINVAL ),
>    STATUS_MAXIMUM_COUNT_EXCEEDED =
>      STATUS_BUILD( STATUS_CLASSIC_UNSATISFIED, EOVERFLOW ),
>    STATUS_MESSAGE_INVALID_SIZE =
> diff --git a/cpukit/score/src/schedulergetaffinity.c b/cpukit/score/src/schedulergetaffinity.c
> index 99dc53609d..867b25e0ea 100644
> --- a/cpukit/score/src/schedulergetaffinity.c
> +++ b/cpukit/score/src/schedulergetaffinity.c
> @@ -51,7 +51,7 @@ Status_Control _Scheduler_Get_affinity(
>    _Scheduler_Release_critical( scheduler, &lock_context );
>
>    if ( status == PROCESSOR_MASK_COPY_LOSSLESS ) {
> -    return STATUS_INVALID_NUMBER;
> +    return STATUS_INVALID_SIZE;
>    }
>
>    return STATUS_SUCCESSFUL;
> diff --git a/testsuites/smptests/smpaffinity01/init.c b/testsuites/smptests/smpaffinity01/init.c
> index 5d79259e9f..9ec687d816 100644
> --- a/testsuites/smptests/smpaffinity01/init.c
> +++ b/testsuites/smptests/smpaffinity01/init.c
> @@ -85,7 +85,7 @@ void Validate_getaffinity_errors(void)
>      "Init - rtems_task_get_affinity - Invalid cpusetsize - RTEMS_INVALID_NUMBER"
>    );
>    sc = rtems_task_get_affinity( Init_id,  1, &cpuset );
> -  rtems_test_assert( sc == RTEMS_INVALID_NUMBER );
> +  rtems_test_assert( sc == RTEMS_INVALID_SIZE );
>
>    /* Verify rtems_task_get_affinity validates cpuset */
>    puts("Init - rtems_task_get_affinity - Invalid cpuset - RTEMS_INVALID_ADDRESS");
> diff --git a/testsuites/sptests/spscheduler01/init.c b/testsuites/sptests/spscheduler01/init.c
> index 5ed17057d3..69fcea6c57 100644
> --- a/testsuites/sptests/spscheduler01/init.c
> +++ b/testsuites/sptests/spscheduler01/init.c
> @@ -139,7 +139,7 @@ static void test_task_get_set_affinity(void)
>    rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
>
>    sc = task_get_affinity(RTEMS_SELF, 0, &cpuset);
> -  rtems_test_assert(sc == RTEMS_INVALID_NUMBER);
> +  rtems_test_assert(sc == RTEMS_INVALID_SIZE);
>
>    sc = task_set_affinity(RTEMS_SELF, 0, &cpuset);
>    rtems_test_assert(sc == RTEMS_INVALID_NUMBER);
> --
> 2.26.2
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list