From bdc468a9c52ff89ff79fab84a1cbc6bfa8c872ca Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 22 Sep 2017 08:22:11 +0200 Subject: posix: Allow PTHREAD_PROCESS_SHARED for rwlocks Close #3153. --- cpukit/posix/src/prwlockinit.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'cpukit') diff --git a/cpukit/posix/src/prwlockinit.c b/cpukit/posix/src/prwlockinit.c index 34ab1aeff1..ffce8149a9 100644 --- a/cpukit/posix/src/prwlockinit.c +++ b/cpukit/posix/src/prwlockinit.c @@ -58,9 +58,7 @@ int pthread_rwlock_init( const pthread_rwlockattr_t *attr ) { - POSIX_RWLock_Control *the_rwlock; - pthread_rwlockattr_t default_attr; - const pthread_rwlockattr_t *the_attr; + POSIX_RWLock_Control *the_rwlock; /* * Error check parameters @@ -68,28 +66,14 @@ int pthread_rwlock_init( if ( !rwlock ) return EINVAL; - /* - * If the user passed in NULL, use the default attributes - */ - if ( attr ) { - the_attr = attr; - } else { - (void) pthread_rwlockattr_init( &default_attr ); - the_attr = &default_attr; - } - - /* - * Now start error checking the attributes that we are going to use - */ - if ( !the_attr->is_initialized ) - return EINVAL; + if ( attr != NULL ) { + if ( !attr->is_initialized ) { + return EINVAL; + } - switch ( the_attr->process_shared ) { - case PTHREAD_PROCESS_PRIVATE: /* only supported values */ - break; - case PTHREAD_PROCESS_SHARED: - default: + if ( !_POSIX_Is_valid_pshared( attr->process_shared ) ) { return EINVAL; + } } the_rwlock = _POSIX_RWLock_Allocate(); -- cgit v1.2.3