From da9f5f113332459444a2a89cbb011c2bbea202da Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 9 Oct 2017 15:34:26 +0200 Subject: posix: Remove rtems_pthread_attribute_compare() Update #2514. Close #3174. --- cpukit/posix/Makefile.am | 3 - cpukit/posix/include/rtems/posix/pthreadimpl.h | 8 --- cpukit/posix/src/pthreadattrcompare.c | 93 -------------------------- testsuites/psxtests/psxgetattrnp01/init.c | 68 ++++++++++++++++++- 4 files changed, 67 insertions(+), 105 deletions(-) delete mode 100644 cpukit/posix/src/pthreadattrcompare.c diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am index 627030bcb4..7bd6869c3c 100644 --- a/cpukit/posix/Makefile.am +++ b/cpukit/posix/Makefile.am @@ -150,9 +150,6 @@ libposix_a_SOURCES += src/pthreadatfork.c src/pthreadattrdestroy.c \ src/psxpriorityisvalid.c src/psxtransschedparam.c libposix_a_SOURCES += src/pthreadsetschedprio.c -## RTEMS specific support methods -libposix_a_SOURCES += src/pthreadattrcompare.c - ## PSIGNAL_C_FILES libposix_a_SOURCES += src/psignal.c src/alarm.c src/kill.c src/killinfo.c \ src/kill_r.c src/pause.c src/psignalclearprocesssignals.c \ diff --git a/cpukit/posix/include/rtems/posix/pthreadimpl.h b/cpukit/posix/include/rtems/posix/pthreadimpl.h index 290fbad02e..9e5314b2c2 100644 --- a/cpukit/posix/include/rtems/posix/pthreadimpl.h +++ b/cpukit/posix/include/rtems/posix/pthreadimpl.h @@ -103,14 +103,6 @@ int _POSIX_Thread_Translate_sched_param( Thread_CPU_budget_algorithm_callout *budget_callout ); -/* - * rtems_pthread_attribute_compare - */ -int rtems_pthread_attribute_compare( - const pthread_attr_t *attr1, - const pthread_attr_t *attr2 -); - RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate(void) { _Objects_Allocator_lock(); diff --git a/cpukit/posix/src/pthreadattrcompare.c b/cpukit/posix/src/pthreadattrcompare.c deleted file mode 100644 index 26ab28db33..0000000000 --- a/cpukit/posix/src/pthreadattrcompare.c +++ /dev/null @@ -1,93 +0,0 @@ -/** - * @file - * - * @brief RTEMS specific pthread attribute comparison - * @ingroup POSIX_PTHREADS Private Threads - */ - -/* - * COPYRIGHT (c) 1989-2014. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif -#include - -#include -#include -#include -#include - -int rtems_pthread_attribute_compare( - const pthread_attr_t *attr1, - const pthread_attr_t *attr2 -) -{ - if ( attr1->is_initialized != attr2->is_initialized ) - return 1; - - if ( - attr1->stackaddr != NULL && - attr2->stackaddr != NULL && - attr1->stackaddr != attr2->stackaddr ) - return 1; - - if ( attr1->stacksize != attr2->stacksize ) - return 1; - - if ( attr1->contentionscope != attr2->contentionscope ) - return 1; - - if ( attr1->inheritsched != attr2->inheritsched ) - return 1; - - if ( attr1->schedpolicy != attr2->schedpolicy ) - return 1; - - if (memcmp( - &attr1->schedparam, - &attr2->schedparam, - sizeof(struct sched_param) - )) - return 1; - - #if HAVE_DECL_PTHREAD_ATTR_SETGUARDSIZE - if ( attr1->guardsize != attr2->guardsize ) - return 1; - #endif - - #if defined(_POSIX_THREAD_CPUTIME) - if ( attr1->cputime_clock_allowed != attr2->cputime_clock_allowed ) - return 1; - #endif - - if ( attr1->detachstate != attr2->detachstate ) - return 1; - - if ( attr1->affinitysetsize != attr2->affinitysetsize ) - return 1; - - if (!CPU_EQUAL_S( - attr1->affinitysetsize, - attr1->affinityset, - attr2->affinityset - )) - return 1; - - if (!CPU_EQUAL_S( - attr1->affinitysetsize, - &attr1->affinitysetpreallocated, - &attr2->affinitysetpreallocated - )) - return 1; - - return 0; -} - - diff --git a/testsuites/psxtests/psxgetattrnp01/init.c b/testsuites/psxtests/psxgetattrnp01/init.c index 190e4f498e..e5c3975255 100644 --- a/testsuites/psxtests/psxgetattrnp01/init.c +++ b/testsuites/psxtests/psxgetattrnp01/init.c @@ -33,6 +33,72 @@ pthread_t Thread_id; pthread_attr_t Thread_attr; int max_priority; +static int attribute_compare( + const pthread_attr_t *attr1, + const pthread_attr_t *attr2 +) +{ + if ( attr1->is_initialized != attr2->is_initialized ) + return 1; + + if ( + attr1->stackaddr != NULL && + attr2->stackaddr != NULL && + attr1->stackaddr != attr2->stackaddr ) + return 1; + + if ( attr1->stacksize != attr2->stacksize ) + return 1; + + if ( attr1->contentionscope != attr2->contentionscope ) + return 1; + + if ( attr1->inheritsched != attr2->inheritsched ) + return 1; + + if ( attr1->schedpolicy != attr2->schedpolicy ) + return 1; + + if (memcmp( + &attr1->schedparam, + &attr2->schedparam, + sizeof(struct sched_param) + )) + return 1; + + #if HAVE_DECL_PTHREAD_ATTR_SETGUARDSIZE + if ( attr1->guardsize != attr2->guardsize ) + return 1; + #endif + + #if defined(_POSIX_THREAD_CPUTIME) + if ( attr1->cputime_clock_allowed != attr2->cputime_clock_allowed ) + return 1; + #endif + + if ( attr1->detachstate != attr2->detachstate ) + return 1; + + if ( attr1->affinitysetsize != attr2->affinitysetsize ) + return 1; + + if (!CPU_EQUAL_S( + attr1->affinitysetsize, + attr1->affinityset, + attr2->affinityset + )) + return 1; + + if (!CPU_EQUAL_S( + attr1->affinitysetsize, + &attr1->affinitysetpreallocated, + &attr2->affinitysetpreallocated + )) + return 1; + + return 0; +} + void *Thread_1( void *argument ) @@ -48,7 +114,7 @@ void *Thread_1( puts("Thread - pthread_getattr_np - Verify value"); sc = pthread_getattr_np( Thread_id, &attr ); rtems_test_assert( sc == 0 ); - rtems_test_assert( ! rtems_pthread_attribute_compare(&attr, &Thread_attr) ); + rtems_test_assert( ! attribute_compare(&attr, &Thread_attr) ); param.sched_priority = max_priority; -- cgit v1.2.3