[rtems commit] Fix CPU_COPY() usage
Sebastian Huber
sebh at rtems.org
Wed Jun 7 13:29:36 UTC 2017
Module: rtems
Branch: master
Commit: 836f4545dcb75cb399bb498e7a62c20541dac84f
Changeset: http://git.rtems.org/rtems/commit/?id=836f4545dcb75cb399bb498e7a62c20541dac84f
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Jun 7 08:14:30 2017 +0200
Fix CPU_COPY() usage
The original CPU_COPY() support of Newlib <sys/cpuset.h> had the
parameters in the wrong order. This is fixed in Newlib since
2017-05-22.
Update #3023.
---
cpukit/posix/src/pthread.c | 2 +-
cpukit/posix/src/pthreadattrgetaffinitynp.c | 2 +-
cpukit/posix/src/pthreadattrsetaffinitynp.c | 2 +-
cpukit/posix/src/pthreadsetaffinitynp.c | 2 +-
cpukit/score/include/rtems/score/cpusetimpl.h | 2 +-
cpukit/score/src/schedulerpriorityaffinitysmp.c | 4 ++--
testsuites/smptests/smpaffinity01/init.c | 4 ++--
testsuites/smptests/smppsxaffinity02/init.c | 4 ++--
testsuites/sptests/spcpuset01/init.c | 2 +-
testsuites/sptests/spcpuset01/test.c | 2 +-
10 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 65242f7..edbfa13 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -254,7 +254,7 @@ static void _POSIX_Threads_Manager_initialization(void)
_Assert( affinity->setsize == sizeof( attr->affinitysetpreallocated ) );
attr->affinityset = &attr->affinitysetpreallocated;
attr->affinitysetsize = affinity->setsize;
- CPU_COPY( attr->affinityset, affinity->set );
+ CPU_COPY( affinity->set, attr->affinityset );
#endif
_Thread_Initialize_information(
diff --git a/cpukit/posix/src/pthreadattrgetaffinitynp.c b/cpukit/posix/src/pthreadattrgetaffinitynp.c
index e7693fa..6ed5050 100644
--- a/cpukit/posix/src/pthreadattrgetaffinitynp.c
+++ b/cpukit/posix/src/pthreadattrgetaffinitynp.c
@@ -42,7 +42,7 @@ int pthread_attr_getaffinity_np(
if ( cpusetsize != attr->affinitysetsize)
return EINVAL;
- CPU_COPY( cpuset, attr->affinityset );
+ CPU_COPY( attr->affinityset, cpuset );
return 0;
}
#endif
diff --git a/cpukit/posix/src/pthreadattrsetaffinitynp.c b/cpukit/posix/src/pthreadattrsetaffinitynp.c
index af9fd85..e5462ec 100644
--- a/cpukit/posix/src/pthreadattrsetaffinitynp.c
+++ b/cpukit/posix/src/pthreadattrsetaffinitynp.c
@@ -43,7 +43,7 @@ int pthread_attr_setaffinity_np(
if (! _CPU_set_Is_valid( cpuset, cpusetsize ) )
return EINVAL;
- CPU_COPY( attr->affinityset, cpuset );
+ CPU_COPY( cpuset, attr->affinityset );
return 0;
}
diff --git a/cpukit/posix/src/pthreadsetaffinitynp.c b/cpukit/posix/src/pthreadsetaffinitynp.c
index 7959df4..4ce51ec 100644
--- a/cpukit/posix/src/pthreadsetaffinitynp.c
+++ b/cpukit/posix/src/pthreadsetaffinitynp.c
@@ -64,7 +64,7 @@ int pthread_setaffinity_np(
POSIX_API_Control *api;
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
- CPU_COPY( api->Attributes.affinityset, cpuset );
+ CPU_COPY( cpuset, api->Attributes.affinityset );
}
_Thread_State_release( the_thread, &lock_context );
diff --git a/cpukit/score/include/rtems/score/cpusetimpl.h b/cpukit/score/include/rtems/score/cpusetimpl.h
index 6a6bf97..1cb71d6 100644
--- a/cpukit/score/include/rtems/score/cpusetimpl.h
+++ b/cpukit/score/include/rtems/score/cpusetimpl.h
@@ -117,7 +117,7 @@ static inline void _CPU_set_Set(
{
set->set = &set->preallocated;
set->setsize = setsize;
- CPU_COPY( set->set, cpuset );
+ CPU_COPY( cpuset, set->set );
}
/**@}*/
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index 8b54295..45afb57 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -624,7 +624,7 @@ bool _Scheduler_priority_affinity_SMP_Get_affinity(
return false;
}
- CPU_COPY( cpuset, node->Affinity.set );
+ CPU_COPY( node->Affinity.set, cpuset );
return true;
}
@@ -660,7 +660,7 @@ bool _Scheduler_priority_affinity_SMP_Set_affinity(
_Scheduler_priority_affinity_SMP_Block( scheduler, thread, &node->Base.Base.Base );
}
- CPU_COPY( node->Affinity.set, cpuset );
+ CPU_COPY( cpuset, node->Affinity.set );
if ( _States_Is_ready( current_state ) ) {
/*
diff --git a/testsuites/smptests/smpaffinity01/init.c b/testsuites/smptests/smpaffinity01/init.c
index c500cd0..cf95fc5 100644
--- a/testsuites/smptests/smpaffinity01/init.c
+++ b/testsuites/smptests/smpaffinity01/init.c
@@ -177,7 +177,7 @@ void Validate_affinity(void )
/* Change the affinity for each low priority task */
puts("Init - Change affinity on Low priority tasks");
- CPU_COPY(&cpuset1, &cpuset0);
+ CPU_COPY(&cpuset0, &cpuset1);
for (i=0; i<cpu_count; i++){
CPU_CLR(i, &cpuset1);
@@ -193,7 +193,7 @@ void Validate_affinity(void )
}
puts("Init - Validate affinity on Low priority tasks");
- CPU_COPY(&cpuset1, &cpuset0);
+ CPU_COPY(&cpuset0, &cpuset1);
for (i=0; i<cpu_count; i++){
CPU_CLR(i, &cpuset1);
diff --git a/testsuites/smptests/smppsxaffinity02/init.c b/testsuites/smptests/smppsxaffinity02/init.c
index e8acfb1..462462f 100644
--- a/testsuites/smptests/smppsxaffinity02/init.c
+++ b/testsuites/smptests/smppsxaffinity02/init.c
@@ -168,7 +168,7 @@ void Validate_affinity(void )
/* Change the affinity for each low priority task */
puts("Init - Change affinity on Low priority tasks");
- CPU_COPY(&cpuset1, &cpuset0);
+ CPU_COPY(&cpuset0, &cpuset1);
for (i=0; i<cpu_count; i++){
CPU_CLR(i, &cpuset1);
@@ -183,7 +183,7 @@ void Validate_affinity(void )
}
puts("Init - Validate affinity on Low priority tasks");
- CPU_COPY(&cpuset1, &cpuset0);
+ CPU_COPY(&cpuset0, &cpuset1);
for (i=0; i<cpu_count; i++){
CPU_CLR(i, &cpuset1);
diff --git a/testsuites/sptests/spcpuset01/init.c b/testsuites/sptests/spcpuset01/init.c
index 5883707..e8b32aa 100644
--- a/testsuites/sptests/spcpuset01/init.c
+++ b/testsuites/sptests/spcpuset01/init.c
@@ -122,7 +122,7 @@ static void test_cpu_copy_case_1(void)
CPU_ZERO(&set1);
CPU_FILL(&set2);
- CPU_COPY(&set2, &set1);
+ CPU_COPY(&set1, &set2);
/* test if all bits clear in set2 */
for (i=0 ; i<CPU_SETSIZE ; i++) {
diff --git a/testsuites/sptests/spcpuset01/test.c b/testsuites/sptests/spcpuset01/test.c
index 8b4673f..9864b1d 100644
--- a/testsuites/sptests/spcpuset01/test.c
+++ b/testsuites/sptests/spcpuset01/test.c
@@ -103,7 +103,7 @@ static void test_logic01_setup(size_t cpu1, size_t cpu2)
CPU_ZERO(&set1);
CPU_SET(cpu1, &set1);
CPU_SET(cpu2, &set1);
- CPU_COPY(&set2, &set1);
+ CPU_COPY(&set1, &set2);
CPU_CLR(cpu2, &set2);
}
More information about the vc
mailing list