diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-18 06:23:27 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-21 07:29:38 +0200 |
commit | 90f1265e5dffe0f834ee9c55640a34fd90be8f12 (patch) | |
tree | 93be90c5b980b2be8d07eac95a9a50c539888cfa /cpukit/posix | |
parent | score: Close barrier object before flush (diff) | |
download | rtems-90f1265e5dffe0f834ee9c55640a34fd90be8f12.tar.bz2 |
score: Fix _CORE_semaphore_Flush()
Use proper CORE_semaphore_Status for _CORE_semaphore_Flush() and
_CORE_semaphore_Destroy() operations.
Close #2696.
Diffstat (limited to 'cpukit/posix')
-rw-r--r-- | cpukit/posix/include/rtems/posix/semaphoreimpl.h | 1 | ||||
-rw-r--r-- | cpukit/posix/src/semaphorecreatesupp.c | 12 | ||||
-rw-r--r-- | cpukit/posix/src/semaphoredeletesupp.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/semaphoretranslatereturncode.c | 2 |
4 files changed, 8 insertions, 9 deletions
diff --git a/cpukit/posix/include/rtems/posix/semaphoreimpl.h b/cpukit/posix/include/rtems/posix/semaphoreimpl.h index 8608e6f33d..41bfdad65a 100644 --- a/cpukit/posix/include/rtems/posix/semaphoreimpl.h +++ b/cpukit/posix/include/rtems/posix/semaphoreimpl.h @@ -58,7 +58,6 @@ RTEMS_INLINE_ROUTINE void _POSIX_Semaphore_Free ( POSIX_Semaphore_Control *the_semaphore ) { - _CORE_semaphore_Destroy( &the_semaphore->Semaphore ); _Objects_Free( &_POSIX_Semaphore_Information, &the_semaphore->Object ); } diff --git a/cpukit/posix/src/semaphorecreatesupp.c b/cpukit/posix/src/semaphorecreatesupp.c index 9a24e0a724..79db8888d8 100644 --- a/cpukit/posix/src/semaphorecreatesupp.c +++ b/cpukit/posix/src/semaphorecreatesupp.c @@ -54,11 +54,6 @@ int _POSIX_Semaphore_Create_support( if (pshared != 0) rtems_set_errno_and_return_minus_one( ENOSYS ); - the_semaphore = _POSIX_Semaphore_Allocate_unprotected(); - if ( !the_semaphore ) { - rtems_set_errno_and_return_minus_one( ENOSPC ); - } - /* * Make a copy of the user's string for name just in case it was * dynamically constructed. @@ -66,13 +61,18 @@ int _POSIX_Semaphore_Create_support( if ( name_arg != NULL ) { name = _Workspace_String_duplicate( name_arg, name_len ); if ( !name ) { - _POSIX_Semaphore_Free( the_semaphore ); rtems_set_errno_and_return_minus_one( ENOMEM ); } } else { name = NULL; } + the_semaphore = _POSIX_Semaphore_Allocate_unprotected(); + if ( !the_semaphore ) { + _Workspace_Free( name ); + rtems_set_errno_and_return_minus_one( ENOSPC ); + } + the_semaphore->process_shared = pshared; if ( name ) { diff --git a/cpukit/posix/src/semaphoredeletesupp.c b/cpukit/posix/src/semaphoredeletesupp.c index 650cdcdcdd..4394674699 100644 --- a/cpukit/posix/src/semaphoredeletesupp.c +++ b/cpukit/posix/src/semaphoredeletesupp.c @@ -36,7 +36,7 @@ void _POSIX_Semaphore_Delete( { if ( !the_semaphore->linked && !the_semaphore->open_count ) { _Objects_Close( &_POSIX_Semaphore_Information, &the_semaphore->Object ); - _CORE_semaphore_Flush( &the_semaphore->Semaphore, -1, NULL, 0 ); + _CORE_semaphore_Destroy( &the_semaphore->Semaphore, NULL, 0 ); _POSIX_Semaphore_Free( the_semaphore ); } } diff --git a/cpukit/posix/src/semaphoretranslatereturncode.c b/cpukit/posix/src/semaphoretranslatereturncode.c index 37e7d0724b..d7b99eaf67 100644 --- a/cpukit/posix/src/semaphoretranslatereturncode.c +++ b/cpukit/posix/src/semaphoretranslatereturncode.c @@ -25,7 +25,7 @@ const int _POSIX_Semaphore_Return_codes[CORE_SEMAPHORE_STATUS_LAST + 1] = { 0, /* CORE_SEMAPHORE_STATUS_SUCCESSFUL */ EAGAIN, /* CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT */ - EAGAIN, /* CORE_SEMAPHORE_WAS_DELETED */ + EINVAL, /* CORE_SEMAPHORE_WAS_DELETED */ ETIMEDOUT, /* CORE_SEMAPHORE_TIMEOUT */ /* The next error can not occur since we set the maximum * count to the largest value the count can hold. |