From 2dd5e6fb320a5309e02570fad93d4b5fc09328a7 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 20 Apr 2016 06:43:11 +0200 Subject: posix: Use _Objects_Get_local() for semaphores This simplifies the code since the object location is no longer used. Remove superfluous header includes. --- cpukit/posix/src/semclose.c | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) (limited to 'cpukit/posix/src/semclose.c') diff --git a/cpukit/posix/src/semclose.c b/cpukit/posix/src/semclose.c index 1468c7fb35..3f18ff1efe 100644 --- a/cpukit/posix/src/semclose.c +++ b/cpukit/posix/src/semclose.c @@ -26,36 +26,24 @@ int sem_close( sem_t *sem ) { - POSIX_Semaphore_Control *the_semaphore; - Objects_Locations location; - ISR_lock_Context lock_context; + POSIX_Semaphore_Control *the_semaphore; + ISR_lock_Context lock_context; _Objects_Allocator_lock(); - the_semaphore = _POSIX_Semaphore_Get_interrupt_disable( - sem, - &location, + the_semaphore = _POSIX_Semaphore_Get( sem, &lock_context ); + + if ( the_semaphore == NULL ) { + _Objects_Allocator_unlock(); + rtems_set_errno_and_return_minus_one( EINVAL ); + } + + _CORE_semaphore_Acquire_critical( + &the_semaphore->Semaphore, &lock_context ); - switch ( location ) { - - case OBJECTS_LOCAL: - _CORE_semaphore_Acquire_critical( - &the_semaphore->Semaphore, - &lock_context - ); - the_semaphore->open_count -= 1; - _POSIX_Semaphore_Delete( the_semaphore, &lock_context ); - _Objects_Allocator_unlock(); - return 0; - -#if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: -#endif - case OBJECTS_ERROR: - break; - } + the_semaphore->open_count -= 1; + _POSIX_Semaphore_Delete( the_semaphore, &lock_context ); _Objects_Allocator_unlock(); - - rtems_set_errno_and_return_minus_one( EINVAL ); + return 0; } -- cgit v1.2.3