mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
rtems: Change rtems_task_get_affinity() status
In case the processor set is not large enough to contain the processor affinity set of the task return RTEMS_INVALID_SIZE instead of RTEMS_INVALID_NUMBER. This is more in line with other directives since the issue is related to the size of an object. Close #4393.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -49,6 +49,7 @@ static void assert_eno(rtems_status_code sc, int eno)
|
||||
rtems_test_assert(eno == ESRCH);
|
||||
break;
|
||||
case RTEMS_INVALID_NUMBER:
|
||||
case RTEMS_INVALID_SIZE:
|
||||
rtems_test_assert(eno == EINVAL);
|
||||
break;
|
||||
default:
|
||||
@@ -139,7 +140,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);
|
||||
|
||||
Reference in New Issue
Block a user