diff options
author | Glenn Humphrey <glenn.humphrey@oarcorp.com> | 2007-11-30 20:34:13 +0000 |
---|---|---|
committer | Glenn Humphrey <glenn.humphrey@oarcorp.com> | 2007-11-30 20:34:13 +0000 |
commit | 860c34e3a6e0f5c2a0d352e82cd438eebdaf0652 (patch) | |
tree | fc6301fd6e1f452046d78d0ed8714079c43b2c27 /cpukit/rtems | |
parent | 2007-11-30 Till Straumann <strauman@slac.stanford.edu> (diff) | |
download | rtems-860c34e3a6e0f5c2a0d352e82cd438eebdaf0652.tar.bz2 |
2007-11-30 Glenn Humphrey <glenn.humphrey@OARcorp.com>
* posix/include/rtems/posix/mutex.h,
posix/include/rtems/posix/semaphore.h, posix/src/cancel.c,
posix/src/conddestroy.c, posix/src/condsignalsupp.c,
posix/src/condwaitsupp.c, posix/src/keydelete.c,
posix/src/keygetspecific.c, posix/src/keysetspecific.c,
posix/src/mqueueclose.c, posix/src/mqueuegetattr.c,
posix/src/mqueuenotify.c, posix/src/mqueuerecvsupp.c,
posix/src/mqueuesendsupp.c, posix/src/mqueuesetattr.c,
posix/src/mqueuetranslatereturncode.c, posix/src/mutexdestroy.c,
posix/src/mutexgetprioceiling.c, posix/src/mutexinit.c,
posix/src/mutexlocksupp.c, posix/src/mutexsetprioceiling.c,
posix/src/mutexunlock.c, posix/src/pbarrierdestroy.c,
posix/src/pbarriertranslatereturncode.c, posix/src/pbarrierwait.c,
posix/src/prwlockdestroy.c, posix/src/prwlockrdlock.c,
posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c,
posix/src/prwlocktranslatereturncode.c, posix/src/prwlocktryrdlock.c,
posix/src/prwlocktrywrlock.c, posix/src/prwlockunlock.c,
posix/src/prwlockwrlock.c, posix/src/pspindestroy.c,
posix/src/pspinlock.c, posix/src/pspinlocktranslatereturncode.c,
posix/src/pspintrylock.c, posix/src/pspinunlock.c,
posix/src/pthreaddetach.c, posix/src/pthreadequal.c,
posix/src/pthreadgetschedparam.c, posix/src/pthreadjoin.c,
posix/src/pthreadkill.c, posix/src/pthreadsetschedparam.c,
posix/src/ptimer1.c, posix/src/semaphorewaitsupp.c,
posix/src/semclose.c, posix/src/semdestroy.c,
posix/src/semgetvalue.c, posix/src/sempost.c, posix/src/types.c,
rtems/src/msgqtranslatereturncode.c, rtems/src/semobtain.c,
rtems/src/timerfireafter.c, score/include/rtems/system.h,
score/include/rtems/score/corebarrier.h,
score/include/rtems/score/coremsg.h,
score/include/rtems/score/coremutex.h,
score/include/rtems/score/coresem.h: Restructed to move the
OBJECTS_LOCAL case to the top of the switch statement and
eliminate the fall-through return of POSIX_BOTTOM_REACHED. These
changes produced simplier assembly code and allowed for complete
test coverage. Also applied some consistency to the functions
that translate the core status codes to POSIX status codes.
* posix/src/mutextranslatereturncode.c,
posix/src/semaphoretranslatereturncode.c: New files.
* posix/src/mutexfromcorestatus.c: Removed.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r-- | cpukit/rtems/src/msgqtranslatereturncode.c | 29 | ||||
-rw-r--r-- | cpukit/rtems/src/semobtain.c | 29 | ||||
-rw-r--r-- | cpukit/rtems/src/timerfireafter.c | 15 |
3 files changed, 41 insertions, 32 deletions
diff --git a/cpukit/rtems/src/msgqtranslatereturncode.c b/cpukit/rtems/src/msgqtranslatereturncode.c index c61a619559..3e071e7c56 100644 --- a/cpukit/rtems/src/msgqtranslatereturncode.c +++ b/cpukit/rtems/src/msgqtranslatereturncode.c @@ -2,7 +2,7 @@ * Message Queue Manager * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -60,13 +60,22 @@ rtems_status_code _Message_queue_Translate_core_message_queue_return_code ( uint32_t status ) { -#if defined(RTEMS_MULTIPROCESSING) - if ( status == THREAD_STATUS_PROXY_BLOCKING ) - return RTEMS_PROXY_BLOCKING; - else -#endif - if ( status > CORE_MESSAGE_QUEUE_STATUS_TIMEOUT ) - return RTEMS_INTERNAL_ERROR; - else - return _Message_queue_Translate_core_return_code_[status]; + /* + * Check for proxy blocking first since it is out of range + * from the external status codes. + */ + #if defined(RTEMS_MULTIPROCESSING) + if ( status == THREAD_STATUS_PROXY_BLOCKING ) + return RTEMS_PROXY_BLOCKING; + #endif + + /* + * Internal consistency check for bad status from SuperCore + */ + #if defined(RTEMS_DEBUG) + if ( status > CORE_MESSAGE_QUEUE_STATUS_TIMEOUT ) + return RTEMS_INTERNAL_ERROR; + #endif + + return _Message_queue_Translate_core_return_code_[status]; } diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c index 55d41acc0d..d82263b2f9 100644 --- a/cpukit/rtems/src/semobtain.c +++ b/cpukit/rtems/src/semobtain.c @@ -77,19 +77,6 @@ rtems_status_code rtems_semaphore_obtain( the_semaphore = _Semaphore_Get_interrupt_disable( id, &location, &level ); switch ( location ) { -#if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: - return _Semaphore_MP_Send_request_packet( - SEMAPHORE_MP_OBTAIN_REQUEST, - id, - option_set, - timeout - ); -#endif - - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; - case OBJECTS_LOCAL: if ( !_Attributes_Is_counting_semaphore(the_semaphore->attribute_set) ) { _CORE_mutex_Seize( @@ -114,7 +101,21 @@ rtems_status_code rtems_semaphore_obtain( ); return _Semaphore_Translate_core_semaphore_return_code( _Thread_Executing->Wait.return_code ); + +#if defined(RTEMS_MULTIPROCESSING) + case OBJECTS_REMOTE: + return _Semaphore_MP_Send_request_packet( + SEMAPHORE_MP_OBTAIN_REQUEST, + id, + option_set, + timeout + ); +#endif + + case OBJECTS_ERROR: + break; + } - return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ + return RTEMS_INVALID_ID; } diff --git a/cpukit/rtems/src/timerfireafter.c b/cpukit/rtems/src/timerfireafter.c index 2888017943..df124536fd 100644 --- a/cpukit/rtems/src/timerfireafter.c +++ b/cpukit/rtems/src/timerfireafter.c @@ -61,13 +61,6 @@ rtems_status_code rtems_timer_fire_after( the_timer = _Timer_Get( id, &location ); switch ( location ) { -#if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: /* should never return this */ - return RTEMS_INTERNAL_ERROR; -#endif - - case OBJECTS_ERROR: - return RTEMS_INVALID_ID; case OBJECTS_LOCAL: (void) _Watchdog_Remove( &the_timer->Ticker ); @@ -98,7 +91,13 @@ rtems_status_code rtems_timer_fire_after( _Watchdog_Insert_ticks( &the_timer->Ticker, ticks ); _Thread_Enable_dispatch(); return RTEMS_SUCCESSFUL; + +#if defined(RTEMS_MULTIPROCESSING) + case OBJECTS_REMOTE: /* should never return this */ +#endif + case OBJECTS_ERROR: + break; } - return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ + return RTEMS_INVALID_ID; } |