summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2006-10-30 22:21:23 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2006-10-30 22:21:23 +0000
commit0c2ec7f52c496e436f09d44dcb880bf4ea16ba86 (patch)
treea9b300a256bb640e1abfdc6dbbb6eac0a49c6a96 /cpukit/rtems/src
parent2006-10-30 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-0c2ec7f52c496e436f09d44dcb880bf4ea16ba86.tar.bz2
2006-10-30 Joel Sherrill <joel@OARcorp.com>
PR 841/rtems * itron/inline/rtems/itron/semaphore.inl, itron/src/twai_sem.c, posix/include/rtems/posix/semaphore.h, posix/inline/rtems/posix/semaphore.inl, posix/src/semaphorewaitsupp.c, posix/src/semtimedwait.c, posix/src/semwait.c, rtems/src/semobtain.c, rtems/src/semtranslatereturncode.c, score/include/rtems/score/coresem.h, score/src/coresemseize.c: Make sem_timedwait more conformant to Open Group specification.
Diffstat (limited to 'cpukit/rtems/src')
-rw-r--r--cpukit/rtems/src/semobtain.c17
-rw-r--r--cpukit/rtems/src/semtranslatereturncode.c26
2 files changed, 17 insertions, 26 deletions
diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c
index 72ac454de5..bfa8831f6a 100644
--- a/cpukit/rtems/src/semobtain.c
+++ b/cpukit/rtems/src/semobtain.c
@@ -71,10 +71,9 @@ rtems_status_code rtems_semaphore_obtain(
rtems_interval timeout
)
{
- register Semaphore_Control *the_semaphore;
- Objects_Locations location;
- boolean wait;
- ISR_Level level;
+ register Semaphore_Control *the_semaphore;
+ Objects_Locations location;
+ ISR_Level level;
the_semaphore = _Semaphore_Get_interrupt_disable( id, &location, &level );
switch ( location ) {
@@ -92,16 +91,11 @@ rtems_status_code rtems_semaphore_obtain(
return RTEMS_INVALID_ID;
case OBJECTS_LOCAL:
- if ( _Options_Is_no_wait( option_set ) )
- wait = FALSE;
- else
- wait = TRUE;
-
if ( !_Attributes_Is_counting_semaphore(the_semaphore->attribute_set) ) {
_CORE_mutex_Seize(
&the_semaphore->Core_control.mutex,
id,
- wait,
+ ((_Options_Is_no_wait( option_set )) ? FALSE : TRUE),
timeout,
level
);
@@ -113,7 +107,8 @@ rtems_status_code rtems_semaphore_obtain(
_CORE_semaphore_Seize_isr_disable(
&the_semaphore->Core_control.semaphore,
id,
- wait,
+ ((_Options_Is_no_wait( option_set )) ?
+ CORE_SEMAPHORE_NO_WAIT : CORE_SEMAPHORE_BLOCK_FOREVER),
timeout,
&level
);
diff --git a/cpukit/rtems/src/semtranslatereturncode.c b/cpukit/rtems/src/semtranslatereturncode.c
index cc7bfffbd6..d7d2d306ac 100644
--- a/cpukit/rtems/src/semtranslatereturncode.c
+++ b/cpukit/rtems/src/semtranslatereturncode.c
@@ -54,7 +54,7 @@
* _Semaphore_Translate_core_mutex_return_code
*
* Input parameters:
- * the_mutex_status - mutex status code to translate
+ * status - mutex status code to translate
*
* Output parameters:
* rtems status code - translated RTEMS status code
@@ -73,18 +73,16 @@ rtems_status_code _Semaphore_Translate_core_mutex_return_code_[] = {
rtems_status_code _Semaphore_Translate_core_mutex_return_code (
- uint32_t the_mutex_status
+ uint32_t status
)
{
#if defined(RTEMS_MULTIPROCESSING)
- if ( the_mutex_status == THREAD_STATUS_PROXY_BLOCKING )
+ if ( status == THREAD_STATUS_PROXY_BLOCKING )
return RTEMS_PROXY_BLOCKING;
- else
#endif
- if ( the_mutex_status > CORE_MUTEX_STATUS_CEILING_VIOLATED )
+ if ( status > CORE_MUTEX_STATUS_CEILING_VIOLATED )
return RTEMS_INTERNAL_ERROR;
- else
- return _Semaphore_Translate_core_mutex_return_code_[the_mutex_status];
+ return _Semaphore_Translate_core_mutex_return_code_[status];
}
/*PAGE
@@ -92,7 +90,7 @@ rtems_status_code _Semaphore_Translate_core_mutex_return_code (
* _Semaphore_Translate_core_semaphore_return_code
*
* Input parameters:
- * the_semaphore_status - semaphore status code to translate
+ * status - semaphore status code to translate
*
* Output parameters:
* rtems status code - translated RTEMS status code
@@ -105,20 +103,18 @@ rtems_status_code _Semaphore_Translate_core_semaphore_return_code_[] = {
RTEMS_OBJECT_WAS_DELETED, /* CORE_SEMAPHORE_WAS_DELETED */
RTEMS_TIMEOUT, /* CORE_SEMAPHORE_TIMEOUT */
RTEMS_INTERNAL_ERROR, /* CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED */
-
+ RTEMS_INTERNAL_ERROR /* CORE_SEMAPHORE_BAD_TIMEOUT_VALUE */
};
rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
- uint32_t the_semaphore_status
+ uint32_t status
)
{
#if defined(RTEMS_MULTIPROCESSING)
- if ( the_semaphore_status == THREAD_STATUS_PROXY_BLOCKING )
+ if ( status == THREAD_STATUS_PROXY_BLOCKING )
return RTEMS_PROXY_BLOCKING;
- else
#endif
- if ( the_semaphore_status > CORE_MUTEX_STATUS_CEILING_VIOLATED )
+ if ( status > CORE_MUTEX_STATUS_CEILING_VIOLATED )
return RTEMS_INTERNAL_ERROR;
- else
- return _Semaphore_Translate_core_semaphore_return_code_[the_semaphore_status];
+ return _Semaphore_Translate_core_semaphore_return_code_[status];
}