summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorGlenn Humphrey <glenn.humphrey@oarcorp.com>2007-11-30 20:34:13 +0000
committerGlenn Humphrey <glenn.humphrey@oarcorp.com>2007-11-30 20:34:13 +0000
commit860c34e3a6e0f5c2a0d352e82cd438eebdaf0652 (patch)
treefc6301fd6e1f452046d78d0ed8714079c43b2c27 /cpukit
parent2007-11-30 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-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')
-rw-r--r--cpukit/ChangeLog43
-rw-r--r--cpukit/posix/include/rtems/posix/mutex.h8
-rw-r--r--cpukit/posix/include/rtems/posix/semaphore.h15
-rw-r--r--cpukit/posix/src/cancel.c18
-rw-r--r--cpukit/posix/src/conddestroy.c15
-rw-r--r--cpukit/posix/src/condsignalsupp.c14
-rw-r--r--cpukit/posix/src/condwaitsupp.c15
-rw-r--r--cpukit/posix/src/keydelete.c15
-rw-r--r--cpukit/posix/src/keygetspecific.c16
-rw-r--r--cpukit/posix/src/keysetspecific.c15
-rw-r--r--cpukit/posix/src/mqueueclose.c14
-rw-r--r--cpukit/posix/src/mqueuegetattr.c15
-rw-r--r--cpukit/posix/src/mqueuenotify.c15
-rw-r--r--cpukit/posix/src/mqueuerecvsupp.c15
-rw-r--r--cpukit/posix/src/mqueuesendsupp.c14
-rw-r--r--cpukit/posix/src/mqueuesetattr.c15
-rw-r--r--cpukit/posix/src/mqueuetranslatereturncode.c87
-rw-r--r--cpukit/posix/src/mutexdestroy.c15
-rw-r--r--cpukit/posix/src/mutexfromcorestatus.c52
-rw-r--r--cpukit/posix/src/mutexgetprioceiling.c15
-rw-r--r--cpukit/posix/src/mutexinit.c8
-rw-r--r--cpukit/posix/src/mutexlocksupp.c17
-rw-r--r--cpukit/posix/src/mutexsetprioceiling.c15
-rw-r--r--cpukit/posix/src/mutextranslatereturncode.c58
-rw-r--r--cpukit/posix/src/mutexunlock.c16
-rw-r--r--cpukit/posix/src/pbarrierdestroy.c14
-rw-r--r--cpukit/posix/src/pbarriertranslatereturncode.c15
-rw-r--r--cpukit/posix/src/pbarrierwait.c13
-rw-r--r--cpukit/posix/src/prwlockdestroy.c14
-rw-r--r--cpukit/posix/src/prwlockrdlock.c14
-rw-r--r--cpukit/posix/src/prwlocktimedrdlock.c14
-rw-r--r--cpukit/posix/src/prwlocktimedwrlock.c14
-rw-r--r--cpukit/posix/src/prwlocktranslatereturncode.c16
-rw-r--r--cpukit/posix/src/prwlocktryrdlock.c14
-rw-r--r--cpukit/posix/src/prwlocktrywrlock.c14
-rw-r--r--cpukit/posix/src/prwlockunlock.c14
-rw-r--r--cpukit/posix/src/prwlockwrlock.c14
-rw-r--r--cpukit/posix/src/pspindestroy.c14
-rw-r--r--cpukit/posix/src/pspinlock.c14
-rw-r--r--cpukit/posix/src/pspinlocktranslatereturncode.c18
-rw-r--r--cpukit/posix/src/pspintrylock.c14
-rw-r--r--cpukit/posix/src/pspinunlock.c14
-rw-r--r--cpukit/posix/src/pthreaddetach.c14
-rw-r--r--cpukit/posix/src/pthreadequal.c26
-rw-r--r--cpukit/posix/src/pthreadgetschedparam.c14
-rw-r--r--cpukit/posix/src/pthreadjoin.c14
-rw-r--r--cpukit/posix/src/pthreadkill.c14
-rw-r--r--cpukit/posix/src/pthreadsetschedparam.c15
-rw-r--r--cpukit/posix/src/ptimer1.c71
-rw-r--r--cpukit/posix/src/semaphoretranslatereturncode.c60
-rw-r--r--cpukit/posix/src/semaphorewaitsupp.c44
-rw-r--r--cpukit/posix/src/semclose.c15
-rw-r--r--cpukit/posix/src/semdestroy.c15
-rw-r--r--cpukit/posix/src/semgetvalue.c15
-rw-r--r--cpukit/posix/src/sempost.c15
-rw-r--r--cpukit/posix/src/types.c6
-rw-r--r--cpukit/rtems/src/msgqtranslatereturncode.c29
-rw-r--r--cpukit/rtems/src/semobtain.c29
-rw-r--r--cpukit/rtems/src/timerfireafter.c15
-rw-r--r--cpukit/score/include/rtems/score/corebarrier.h9
-rw-r--r--cpukit/score/include/rtems/score/coremsg.h9
-rw-r--r--cpukit/score/include/rtems/score/coremutex.h9
-rw-r--r--cpukit/score/include/rtems/score/coresem.h9
-rw-r--r--cpukit/score/include/rtems/system.h6
64 files changed, 714 insertions, 528 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 8d9ada60f9..d2c9605ff1 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,46 @@
+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.
+
2007-11-30 Joel Sherrill <joel.sherrill@oarcorp.com>
* posix/inline/rtems/posix/priority.inl: Fix typo.
diff --git a/cpukit/posix/include/rtems/posix/mutex.h b/cpukit/posix/include/rtems/posix/mutex.h
index a81406f45b..0d61041a83 100644
--- a/cpukit/posix/include/rtems/posix/mutex.h
+++ b/cpukit/posix/include/rtems/posix/mutex.h
@@ -6,7 +6,7 @@
* This include file contains all the private support information for
* POSIX mutex's.
*
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -134,7 +134,7 @@ int _POSIX_Mutex_Lock_support(
);
/*
- * _POSIX_Mutex_From_core_mutex_status
+ * _POSIX_Mutex_Translate_core_mutex_return_code
*
* DESCRIPTION:
*
@@ -142,8 +142,8 @@ int _POSIX_Mutex_Lock_support(
* appropriate POSIX status values.
*/
-int _POSIX_Mutex_From_core_mutex_status(
- CORE_mutex_Status status
+int _POSIX_Mutex_Translate_core_mutex_return_code(
+ CORE_mutex_Status the_mutex_status
);
diff --git a/cpukit/posix/include/rtems/posix/semaphore.h b/cpukit/posix/include/rtems/posix/semaphore.h
index 26e0a6b804..6a1645eee0 100644
--- a/cpukit/posix/include/rtems/posix/semaphore.h
+++ b/cpukit/posix/include/rtems/posix/semaphore.h
@@ -7,7 +7,7 @@
* This include file contains all the private support information for
* POSIX Semaphores.
*
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -171,6 +171,19 @@ int _POSIX_Semaphore_Name_to_id(
sem_t *id
);
+/*
+ * _POSIX_Semaphore_Translate_core_semaphore_return_code
+ *
+ * DESCRIPTION:
+ *
+ * A support routine which converts core semaphore status codes into the
+ * appropriate POSIX status values.
+ */
+
+int _POSIX_Semaphore_Translate_core_semaphore_return_code(
+ CORE_semaphore_Status the_semaphore_status
+);
+
#include <rtems/posix/semaphore.inl>
#if defined(RTEMS_MULTIPROCESSING)
#include <rtems/posix/semaphoremp.h>
diff --git a/cpukit/posix/src/cancel.c b/cpukit/posix/src/cancel.c
index 8f619a5750..d5f5624b9c 100644
--- a/cpukit/posix/src/cancel.c
+++ b/cpukit/posix/src/cancel.c
@@ -40,24 +40,26 @@ int pthread_cancel(
the_thread = _POSIX_Threads_Get( thread, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
+
case OBJECTS_LOCAL:
thread_support = the_thread->API_Extensions[ THREAD_API_POSIX ];
thread_support->cancelation_requested = 1;
- if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
- thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS ) {
+ if (thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
+ thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS) {
_POSIX_Threads_cancel_run( the_thread );
}
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return EINVAL;
}
diff --git a/cpukit/posix/src/conddestroy.c b/cpukit/posix/src/conddestroy.c
index 1dadc0576f..ae9cbcde92 100644
--- a/cpukit/posix/src/conddestroy.c
+++ b/cpukit/posix/src/conddestroy.c
@@ -32,12 +32,6 @@ int pthread_cond_destroy(
the_cond = _POSIX_Condition_variables_Get( cond, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
-
case OBJECTS_LOCAL:
@@ -71,6 +65,13 @@ int pthread_cond_destroy(
#endif
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/condsignalsupp.c b/cpukit/posix/src/condsignalsupp.c
index e6c6cd17f2..3f4d2c6cc2 100644
--- a/cpukit/posix/src/condsignalsupp.c
+++ b/cpukit/posix/src/condsignalsupp.c
@@ -36,11 +36,6 @@ int _POSIX_Condition_variables_Signal_support(
the_cond = _POSIX_Condition_variables_Get( cond, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
case OBJECTS_LOCAL:
do {
@@ -52,6 +47,13 @@ int _POSIX_Condition_variables_Signal_support(
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/condwaitsupp.c b/cpukit/posix/src/condwaitsupp.c
index 0b0fa9e73f..d25286dd54 100644
--- a/cpukit/posix/src/condwaitsupp.c
+++ b/cpukit/posix/src/condwaitsupp.c
@@ -45,11 +45,7 @@ int _POSIX_Condition_variables_Wait_support(
the_cond = _POSIX_Condition_variables_Get( cond, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
+
case OBJECTS_LOCAL:
if ( the_cond->Mutex && ( the_cond->Mutex != *mutex ) ) {
@@ -100,6 +96,13 @@ int _POSIX_Condition_variables_Wait_support(
return EINVAL;
return status;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/keydelete.c b/cpukit/posix/src/keydelete.c
index 65b5d8e8df..76b41cc772 100644
--- a/cpukit/posix/src/keydelete.c
+++ b/cpukit/posix/src/keydelete.c
@@ -31,11 +31,7 @@ int pthread_key_delete(
the_key = _POSIX_Keys_Get( key, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE: /* should never happen */
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
+
case OBJECTS_LOCAL:
_Objects_Close( &_POSIX_Keys_Information, &the_key->Object );
@@ -55,6 +51,13 @@ int pthread_key_delete(
_POSIX_Keys_Free( the_key );
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE: /* should never happen */
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/keygetspecific.c b/cpukit/posix/src/keygetspecific.c
index 6af4f3d8b7..901202775e 100644
--- a/cpukit/posix/src/keygetspecific.c
+++ b/cpukit/posix/src/keygetspecific.c
@@ -33,18 +33,20 @@ void *pthread_getspecific(
the_key = _POSIX_Keys_Get( key, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE: /* should never happen */
-#endif
- case OBJECTS_ERROR:
- return NULL;
+
case OBJECTS_LOCAL:
api = _Objects_Get_API( _Thread_Executing->Object.id );
index = _Objects_Get_index( _Thread_Executing->Object.id );
key_data = (void *) the_key->Values[ api ][ index ];
_Thread_Enable_dispatch();
return key_data;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE: /* should never happen */
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- (void) POSIX_BOTTOM_REACHED();
- return (void *)NULL;
+
+ return NULL;
}
diff --git a/cpukit/posix/src/keysetspecific.c b/cpukit/posix/src/keysetspecific.c
index f510af4e5b..e8adc77e71 100644
--- a/cpukit/posix/src/keysetspecific.c
+++ b/cpukit/posix/src/keysetspecific.c
@@ -33,17 +33,20 @@ int pthread_setspecific(
the_key = _POSIX_Keys_Get( key, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE: /* should never happen */
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
+
case OBJECTS_LOCAL:
api = _Objects_Get_API( _Thread_Executing->Object.id );
index = _Objects_Get_index( _Thread_Executing->Object.id );
the_key->Values[ api ][ index ] = (void *) value;
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE: /* should never happen */
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/mqueueclose.c b/cpukit/posix/src/mqueueclose.c
index 0adbfb6b0f..72f7b9ec92 100644
--- a/cpukit/posix/src/mqueueclose.c
+++ b/cpukit/posix/src/mqueueclose.c
@@ -47,11 +47,6 @@ int mq_close(
the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EBADF );
case OBJECTS_LOCAL:
/*
@@ -74,6 +69,13 @@ int mq_close(
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ rtems_set_errno_and_return_minus_one( EBADF );
}
diff --git a/cpukit/posix/src/mqueuegetattr.c b/cpukit/posix/src/mqueuegetattr.c
index 11483f537c..67cbdaf1ea 100644
--- a/cpukit/posix/src/mqueuegetattr.c
+++ b/cpukit/posix/src/mqueuegetattr.c
@@ -52,11 +52,7 @@ int mq_getattr(
the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EBADF );
+
case OBJECTS_LOCAL:
the_mq = the_mq_fd->Queue;
@@ -73,6 +69,13 @@ int mq_getattr(
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ rtems_set_errno_and_return_minus_one( EBADF );
}
diff --git a/cpukit/posix/src/mqueuenotify.c b/cpukit/posix/src/mqueuenotify.c
index 15ae9efb1f..54387a9d5a 100644
--- a/cpukit/posix/src/mqueuenotify.c
+++ b/cpukit/posix/src/mqueuenotify.c
@@ -70,11 +70,7 @@ int mq_notify(
the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EBADF );
+
case OBJECTS_LOCAL:
the_mq = the_mq_fd->Queue;
@@ -101,6 +97,13 @@ int mq_notify(
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ rtems_set_errno_and_return_minus_one( EBADF );
}
diff --git a/cpukit/posix/src/mqueuerecvsupp.c b/cpukit/posix/src/mqueuerecvsupp.c
index 914db9f937..b374f2176b 100644
--- a/cpukit/posix/src/mqueuerecvsupp.c
+++ b/cpukit/posix/src/mqueuerecvsupp.c
@@ -55,11 +55,7 @@ ssize_t _POSIX_Message_queue_Receive_support(
the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EBADF );
+
case OBJECTS_LOCAL:
if ( (the_mq_fd->oflag & O_ACCMODE) == O_WRONLY ) {
_Thread_Enable_dispatch();
@@ -101,6 +97,13 @@ ssize_t _POSIX_Message_queue_Receive_support(
_Thread_Executing->Wait.return_code
)
);
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ rtems_set_errno_and_return_minus_one( EBADF );
}
diff --git a/cpukit/posix/src/mqueuesendsupp.c b/cpukit/posix/src/mqueuesendsupp.c
index 50d25d1bc4..d97a348baa 100644
--- a/cpukit/posix/src/mqueuesendsupp.c
+++ b/cpukit/posix/src/mqueuesendsupp.c
@@ -61,11 +61,6 @@ int _POSIX_Message_queue_Send_support(
the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EBADF );
case OBJECTS_LOCAL:
if ( (the_mq_fd->oflag & O_ACCMODE) == O_RDONLY ) {
@@ -106,6 +101,13 @@ int _POSIX_Message_queue_Send_support(
msg_status
)
);
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ rtems_set_errno_and_return_minus_one( EBADF );
}
diff --git a/cpukit/posix/src/mqueuesetattr.c b/cpukit/posix/src/mqueuesetattr.c
index dc60b587b4..0dea6fc82d 100644
--- a/cpukit/posix/src/mqueuesetattr.c
+++ b/cpukit/posix/src/mqueuesetattr.c
@@ -52,11 +52,7 @@ int mq_setattr(
the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EBADF );
+
case OBJECTS_LOCAL:
the_core_mq = &the_mq_fd->Queue->Message_queue;
@@ -75,6 +71,13 @@ int mq_setattr(
the_mq_fd->oflag = mqstat->mq_flags;
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ rtems_set_errno_and_return_minus_one( EBADF );
}
diff --git a/cpukit/posix/src/mqueuetranslatereturncode.c b/cpukit/posix/src/mqueuetranslatereturncode.c
index 74e67d0cf7..9fe57a9920 100644
--- a/cpukit/posix/src/mqueuetranslatereturncode.c
+++ b/cpukit/posix/src/mqueuetranslatereturncode.c
@@ -1,8 +1,7 @@
/*
* POSIX Message Queue Error Translation
*
- *
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -17,17 +16,10 @@
#endif
#include <pthread.h>
-#include <limits.h>
#include <errno.h>
-#include <fcntl.h>
-#include <mqueue.h>
#include <rtems/system.h>
-#include <rtems/score/watchdog.h>
-#include <rtems/seterr.h>
-#include <rtems/posix/mqueue.h>
-#include <rtems/posix/time.h>
-#include <rtems/score/interr.h>
+#include <rtems/score/coremsg.h>
/*PAGE
@@ -38,64 +30,33 @@
* the_message_queue_status - message_queue status code to translate
*
* Output parameters:
- * rtems status code - translated POSIX status code
+ * status code - translated POSIX status code
*
*/
+static
+ int _POSIX_Message_queue_Return_codes[CORE_MESSAGE_QUEUE_STATUS_LAST + 1] = {
+ 0, /* CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL */
+ EMSGSIZE, /* CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE */
+ EAGAIN, /* CORE_MESSAGE_QUEUE_STATUS_TOO_MANY */
+ ENOMEM, /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED */
+ EAGAIN, /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT */
+ EBADF, /* CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED */
+ ETIMEDOUT, /* CORE_MESSAGE_QUEUE_STATUS_TIMEOUT */
+ ENOSYS /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT */
+};
+
+
int _POSIX_Message_queue_Translate_core_message_queue_return_code(
uint32_t the_message_queue_status
)
{
- switch ( the_message_queue_status ) {
- case CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL:
- return 0;
-
- /*
- * Bad message size
- */
- case CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE:
- return EMSGSIZE;
-
- /*
- * Queue is full of pending messages.
- */
- case CORE_MESSAGE_QUEUE_STATUS_TOO_MANY:
- return EAGAIN;
-
- /*
- * Out of message buffers to queue pending message
- */
- case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED:
- return ENOMEM;
-
- /*
- * No message available on receive poll
- */
- case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT:
- return EAGAIN;
-
- /*
- * Queue was deleted while thread blocked on it.
- */
- case CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED:
- return EBADF;
-
- /*
- * POSIX Real-Time Extensions add timeouts to send and receive.
- */
- case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
- return ETIMEDOUT;
-
- /*
- * RTEMS POSIX API implementation does not support multiprocessing.
- */
- case THREAD_STATUS_PROXY_BLOCKING:
- return ENOSYS;
- }
- _Internal_error_Occurred(
- INTERNAL_ERROR_POSIX_API,
- TRUE,
- the_message_queue_status
- );
- return POSIX_BOTTOM_REACHED();
+ /*
+ * Internal consistency check for bad status from SuperCore
+ */
+ #if defined(RTEMS_DEBUG)
+ if ( the_message_queue_status > CORE_MESSAGE_QUEUE_STATUS_LAST )
+ return EINVAL;
+ #endif
+ return _POSIX_Message_queue_Return_codes[the_message_queue_status];
}
diff --git a/cpukit/posix/src/mutexdestroy.c b/cpukit/posix/src/mutexdestroy.c
index 1e31c48416..27ccbd9e3c 100644
--- a/cpukit/posix/src/mutexdestroy.c
+++ b/cpukit/posix/src/mutexdestroy.c
@@ -33,11 +33,7 @@ int pthread_mutex_destroy(
the_mutex = _POSIX_Mutex_Get( mutex, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
+
case OBJECTS_LOCAL:
/*
* XXX: There is an error for the mutex being locked
@@ -78,6 +74,13 @@ int pthread_mutex_destroy(
#endif
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/mutexfromcorestatus.c b/cpukit/posix/src/mutexfromcorestatus.c
deleted file mode 100644
index 3c6f617861..0000000000
--- a/cpukit/posix/src/mutexfromcorestatus.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * $Id$
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <assert.h>
-#include <errno.h>
-#include <pthread.h>
-
-#include <rtems/system.h>
-#include <rtems/score/coremutex.h>
-#include <rtems/score/watchdog.h>
-#if defined(RTEMS_MULTIPROCESSING)
-#include <rtems/score/mpci.h>
-#endif
-#include <rtems/posix/mutex.h>
-#include <rtems/posix/priority.h>
-#include <rtems/posix/time.h>
-
-/*PAGE
- *
- * _POSIX_Mutex_From_core_mutex_status
- */
-
-int _POSIX_Mutex_From_core_mutex_status(
- CORE_mutex_Status status
-)
-{
- switch ( status ) {
- case CORE_MUTEX_STATUS_SUCCESSFUL:
- return 0;
- case CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT:
- return EBUSY;
- case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED:
- return EDEADLK;
- case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE:
- return EPERM;
- case CORE_MUTEX_WAS_DELETED:
- return EINVAL;
- case CORE_MUTEX_TIMEOUT:
- return EAGAIN;
- case CORE_MUTEX_STATUS_CEILING_VIOLATED:
- return EINVAL;
- default:
- break;
- }
- assert( 0 );
- return 0;
-}
diff --git a/cpukit/posix/src/mutexgetprioceiling.c b/cpukit/posix/src/mutexgetprioceiling.c
index 4423b6b4b9..a485be7591 100644
--- a/cpukit/posix/src/mutexgetprioceiling.c
+++ b/cpukit/posix/src/mutexgetprioceiling.c
@@ -37,17 +37,20 @@ int pthread_mutex_getprioceiling(
the_mutex = _POSIX_Mutex_Get( mutex, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
+
case OBJECTS_LOCAL:
*prioceiling = _POSIX_Priority_From_core(
the_mutex->Mutex.Attributes.priority_ceiling
);
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/mutexinit.c b/cpukit/posix/src/mutexinit.c
index 1d25440163..a743874d42 100644
--- a/cpukit/posix/src/mutexinit.c
+++ b/cpukit/posix/src/mutexinit.c
@@ -69,8 +69,6 @@ int pthread_mutex_init(
*
* Joel Sherrill <joel@OARcorp.com> 14 May 1999
*/
-
-
#if 0
/* avoid infinite recursion on call to this routine in _POSIX_Mutex_Get */
@@ -80,14 +78,14 @@ int pthread_mutex_init(
mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
switch ( location ) {
+ case OBJECTS_LOCAL:
+ _Thread_Enable_dispatch();
+ return EBUSY;
#if defined(RTEMS_MULTIPROCESSING)
case OBJECTS_REMOTE:
#endif
case OBJECTS_ERROR:
break;
- case OBJECTS_LOCAL:
- _Thread_Enable_dispatch();
- return EBUSY;
}
}
#endif
diff --git a/cpukit/posix/src/mutexlocksupp.c b/cpukit/posix/src/mutexlocksupp.c
index 3538e9c1fb..fd6bf165a0 100644
--- a/cpukit/posix/src/mutexlocksupp.c
+++ b/cpukit/posix/src/mutexlocksupp.c
@@ -39,11 +39,7 @@ int _POSIX_Mutex_Lock_support(
the_mutex = _POSIX_Mutex_Get_interrupt_disable( mutex, &location, &level );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
+
case OBJECTS_LOCAL:
_CORE_mutex_Seize(
&the_mutex->Mutex,
@@ -52,9 +48,16 @@ int _POSIX_Mutex_Lock_support(
timeout,
level
);
- return _POSIX_Mutex_From_core_mutex_status(
+ return _POSIX_Mutex_Translate_core_mutex_return_code(
(CORE_mutex_Status) _Thread_Executing->Wait.return_code
);
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/mutexsetprioceiling.c b/cpukit/posix/src/mutexsetprioceiling.c
index b65ad8ff27..e50c053522 100644
--- a/cpukit/posix/src/mutexsetprioceiling.c
+++ b/cpukit/posix/src/mutexsetprioceiling.c
@@ -53,11 +53,7 @@ int pthread_mutex_setprioceiling(
the_mutex = _POSIX_Mutex_Get( mutex, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL; /* impossible to get here */
+
case OBJECTS_LOCAL:
*old_ceiling = _POSIX_Priority_From_core(
the_mutex->Mutex.Attributes.priority_ceiling
@@ -74,6 +70,13 @@ int pthread_mutex_setprioceiling(
);
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE: /* impossible to get here */
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/mutextranslatereturncode.c b/cpukit/posix/src/mutextranslatereturncode.c
new file mode 100644
index 0000000000..7c335e7e4b
--- /dev/null
+++ b/cpukit/posix/src/mutextranslatereturncode.c
@@ -0,0 +1,58 @@
+/*
+ * POSIX Mutex Error Translation
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <pthread.h>
+#include <errno.h>
+
+#include <rtems/system.h>
+#include <rtems/score/coremutex.h>
+
+/*
+ * _POSIX_Mutex_Translate_core_mutex_return_code
+ *
+ * Input parameters:
+ * the_mutex_status - mutex status code to translate
+ *
+ * Output parameters:
+ * status code - translated POSIX status code
+ *
+ */
+
+static int _POSIX_Mutex_Return_codes[CORE_MUTEX_STATUS_LAST + 1] = {
+ 0, /* CORE_MUTEX_STATUS_SUCCESSFUL */
+ EBUSY, /* CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT */
+ EDEADLK, /* CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED */
+ EPERM, /* CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE */
+ EINVAL, /* CORE_MUTEX_WAS_DELETED */
+ EAGAIN, /* CORE_MUTEX_TIMEOUT */
+ EINVAL /* CORE_MUTEX_STATUS_CEILING_VIOLATED */
+};
+
+
+int _POSIX_Mutex_Translate_core_mutex_return_code(
+ CORE_mutex_Status the_mutex_status
+)
+{
+ /*
+ * Internal consistency check for bad status from SuperCore
+ */
+ #if defined(RTEMS_DEBUG)
+ if ( the_mutex_status > CORE_MUTEX_STATUS_LAST )
+ return EINVAL;
+ #endif
+ return _POSIX_Mutex_Return_codes[the_mutex_status];
+}
diff --git a/cpukit/posix/src/mutexunlock.c b/cpukit/posix/src/mutexunlock.c
index f8a4b054a9..2323dee66d 100644
--- a/cpukit/posix/src/mutexunlock.c
+++ b/cpukit/posix/src/mutexunlock.c
@@ -36,11 +36,7 @@ int pthread_mutex_unlock(
the_mutex = _POSIX_Mutex_Get( mutex, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
+
case OBJECTS_LOCAL:
status = _CORE_mutex_Surrender(
&the_mutex->Mutex,
@@ -52,8 +48,14 @@ int pthread_mutex_unlock(
#endif
);
_Thread_Enable_dispatch();
- return _POSIX_Mutex_From_core_mutex_status( status );
+ return _POSIX_Mutex_Translate_core_mutex_return_code( status );
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/pbarrierdestroy.c b/cpukit/posix/src/pbarrierdestroy.c
index 633e4735a4..0caf8a1586 100644
--- a/cpukit/posix/src/pbarrierdestroy.c
+++ b/cpukit/posix/src/pbarrierdestroy.c
@@ -49,12 +49,6 @@ int pthread_barrier_destroy(
the_barrier = _POSIX_Barrier_Get( barrier, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
-
case OBJECTS_LOCAL:
if ( the_barrier->Barrier.number_of_waiting_threads != 0 ) {
_Thread_Enable_dispatch();
@@ -67,7 +61,13 @@ int pthread_barrier_destroy(
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return EINVAL;
}
diff --git a/cpukit/posix/src/pbarriertranslatereturncode.c b/cpukit/posix/src/pbarriertranslatereturncode.c
index d7dc607bc3..0351fc5a65 100644
--- a/cpukit/posix/src/pbarriertranslatereturncode.c
+++ b/cpukit/posix/src/pbarriertranslatereturncode.c
@@ -1,7 +1,7 @@
/*
* Barrier Manager -- Translate SuperCore Status
*
- * COPYRIGHT (c) 1989-2006.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -32,7 +32,7 @@
*
*/
-static int _POSIX_Barrier_Return_codes[] = {
+static int _POSIX_Barrier_Return_codes[CORE_BARRIER_STATUS_LAST + 1] = {
0, /* CORE_BARRIER_STATUS_SUCCESSFUL */
PTHREAD_BARRIER_SERIAL_THREAD,
/* CORE_BARRIER_STATUS_AUTOMATICALLY_RELEASED */
@@ -45,7 +45,12 @@ int _POSIX_Barrier_Translate_core_barrier_return_code(
CORE_barrier_Status the_barrier_status
)
{
- if ( the_barrier_status <= CORE_BARRIER_TIMEOUT )
- return _POSIX_Barrier_Return_codes[the_barrier_status];
- return POSIX_BOTTOM_REACHED();
+ /*
+ * Internal consistency check for bad status from SuperCore
+ */
+ #if defined(RTEMS_DEBUG)
+ if ( the_barrier_status > CORE_BARRIER_STATUS_LAST )
+ return EINVAL;
+ #endif
+ return _POSIX_Barrier_Return_codes[the_barrier_status];
}
diff --git a/cpukit/posix/src/pbarrierwait.c b/cpukit/posix/src/pbarrierwait.c
index 7bc7f23a32..97e3134a8e 100644
--- a/cpukit/posix/src/pbarrierwait.c
+++ b/cpukit/posix/src/pbarrierwait.c
@@ -47,11 +47,6 @@ int pthread_barrier_wait(
the_barrier = _POSIX_Barrier_Get( barrier, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
case OBJECTS_LOCAL:
_CORE_barrier_Wait(
@@ -65,6 +60,12 @@ int pthread_barrier_wait(
return _POSIX_Barrier_Translate_core_barrier_return_code(
_Thread_Executing->Wait.return_code );
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/prwlockdestroy.c b/cpukit/posix/src/prwlockdestroy.c
index dc81393d8d..8b32517c37 100644
--- a/cpukit/posix/src/prwlockdestroy.c
+++ b/cpukit/posix/src/prwlockdestroy.c
@@ -49,12 +49,6 @@ int pthread_rwlock_destroy(
the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
-
case OBJECTS_LOCAL:
/*
* If there is at least one thread waiting, then do not delete it.
@@ -74,7 +68,13 @@ int pthread_rwlock_destroy(
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return EINVAL;
}
diff --git a/cpukit/posix/src/prwlockrdlock.c b/cpukit/posix/src/prwlockrdlock.c
index ac6473c098..8d48e01973 100644
--- a/cpukit/posix/src/prwlockrdlock.c
+++ b/cpukit/posix/src/prwlockrdlock.c
@@ -47,12 +47,6 @@ int pthread_rwlock_rdlock(
the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
-
case OBJECTS_LOCAL:
_CORE_RWLock_Obtain_for_reading(
@@ -67,7 +61,13 @@ int pthread_rwlock_rdlock(
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) _Thread_Executing->Wait.return_code
);
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return EINVAL;
}
diff --git a/cpukit/posix/src/prwlocktimedrdlock.c b/cpukit/posix/src/prwlocktimedrdlock.c
index e3ec947445..15ddbf791b 100644
--- a/cpukit/posix/src/prwlocktimedrdlock.c
+++ b/cpukit/posix/src/prwlocktimedrdlock.c
@@ -55,12 +55,6 @@ int pthread_rwlock_timedrdlock(
the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
-
case OBJECTS_LOCAL:
_CORE_RWLock_Obtain_for_reading(
@@ -75,7 +69,13 @@ int pthread_rwlock_timedrdlock(
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) _Thread_Executing->Wait.return_code
);
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return EINVAL;
}
diff --git a/cpukit/posix/src/prwlocktimedwrlock.c b/cpukit/posix/src/prwlocktimedwrlock.c
index 5f50568073..adf45b77fc 100644
--- a/cpukit/posix/src/prwlocktimedwrlock.c
+++ b/cpukit/posix/src/prwlocktimedwrlock.c
@@ -55,12 +55,6 @@ int pthread_rwlock_timedwrlock(
the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
-
case OBJECTS_LOCAL:
_CORE_RWLock_Obtain_for_writing(
@@ -75,7 +69,13 @@ int pthread_rwlock_timedwrlock(
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) _Thread_Executing->Wait.return_code
);
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return EINVAL;
}
diff --git a/cpukit/posix/src/prwlocktranslatereturncode.c b/cpukit/posix/src/prwlocktranslatereturncode.c
index 5919643e4c..3378d577b2 100644
--- a/cpukit/posix/src/prwlocktranslatereturncode.c
+++ b/cpukit/posix/src/prwlocktranslatereturncode.c
@@ -1,7 +1,7 @@
/*
* RWLock Manager -- Translate SuperCore Status
*
- * COPYRIGHT (c) 1989-2006.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -32,8 +32,7 @@
*
*/
-/* XXX fix me */
-static int _POSIX_RWLock_Return_codes[] = {
+static int _POSIX_RWLock_Return_codes[CORE_RWLOCK_STATUS_LAST + 1] = {
0, /* CORE_RWLOCK_SUCCESSFUL */
EINVAL, /* CORE_RWLOCK_DELETED */
EBUSY, /* CORE_RWLOCK_UNAVAILABLE */
@@ -45,7 +44,12 @@ int _POSIX_RWLock_Translate_core_RWLock_return_code(
CORE_RWLock_Status the_rwlock_status
)
{
- if ( the_rwlock_status <= CORE_RWLOCK_STATUS_LAST )
- return _POSIX_RWLock_Return_codes[the_rwlock_status];
- return POSIX_BOTTOM_REACHED();
+ /*
+ * Internal consistency check for bad status from SuperCore
+ */
+ #if defined(RTEMS_DEBUG)
+ if ( the_rwlock_status > CORE_RWLOCK_STATUS_LAST )
+ return EINVAL;
+ #endif
+ return _POSIX_RWLock_Return_codes[the_rwlock_status];
}
diff --git a/cpukit/posix/src/prwlocktryrdlock.c b/cpukit/posix/src/prwlocktryrdlock.c
index d6faa9789c..fed54d195d 100644
--- a/cpukit/posix/src/prwlocktryrdlock.c
+++ b/cpukit/posix/src/prwlocktryrdlock.c
@@ -47,12 +47,6 @@ int pthread_rwlock_tryrdlock(
the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
-
case OBJECTS_LOCAL:
_CORE_RWLock_Obtain_for_reading(
@@ -68,7 +62,13 @@ int pthread_rwlock_tryrdlock(
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) _Thread_Executing->Wait.return_code
);
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return EINVAL;
}
diff --git a/cpukit/posix/src/prwlocktrywrlock.c b/cpukit/posix/src/prwlocktrywrlock.c
index c6f3104457..25a30cf621 100644
--- a/cpukit/posix/src/prwlocktrywrlock.c
+++ b/cpukit/posix/src/prwlocktrywrlock.c
@@ -47,12 +47,6 @@ int pthread_rwlock_trywrlock(
the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
-
case OBJECTS_LOCAL:
_CORE_RWLock_Obtain_for_writing(
@@ -67,7 +61,13 @@ int pthread_rwlock_trywrlock(
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) _Thread_Executing->Wait.return_code
);
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return EINVAL;
}
diff --git a/cpukit/posix/src/prwlockunlock.c b/cpukit/posix/src/prwlockunlock.c
index 2854b7c4ba..a316b9ef1a 100644
--- a/cpukit/posix/src/prwlockunlock.c
+++ b/cpukit/posix/src/prwlockunlock.c
@@ -48,17 +48,17 @@ int pthread_rwlock_unlock(
the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
-
case OBJECTS_LOCAL:
status = _CORE_RWLock_Release( &the_rwlock->RWLock );
_Thread_Enable_dispatch();
return _POSIX_RWLock_Translate_core_RWLock_return_code( status );
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return EINVAL;
}
diff --git a/cpukit/posix/src/prwlockwrlock.c b/cpukit/posix/src/prwlockwrlock.c
index 47b13f5647..300a255e88 100644
--- a/cpukit/posix/src/prwlockwrlock.c
+++ b/cpukit/posix/src/prwlockwrlock.c
@@ -47,12 +47,6 @@ int pthread_rwlock_wrlock(
the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
-
case OBJECTS_LOCAL:
_CORE_RWLock_Obtain_for_writing(
@@ -67,7 +61,13 @@ int pthread_rwlock_wrlock(
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) _Thread_Executing->Wait.return_code
);
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return EINVAL;
}
diff --git a/cpukit/posix/src/pspindestroy.c b/cpukit/posix/src/pspindestroy.c
index 2a0f54b511..aa3c465ec7 100644
--- a/cpukit/posix/src/pspindestroy.c
+++ b/cpukit/posix/src/pspindestroy.c
@@ -49,12 +49,6 @@ int pthread_spin_destroy(
the_spinlock = _POSIX_Spinlock_Get( spinlock, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
-
case OBJECTS_LOCAL:
if ( _CORE_spinlock_Is_busy( &the_spinlock->Spinlock ) ) {
_Thread_Enable_dispatch();
@@ -67,7 +61,13 @@ int pthread_spin_destroy(
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return EINVAL;
}
diff --git a/cpukit/posix/src/pspinlock.c b/cpukit/posix/src/pspinlock.c
index 56f2ce861d..364549f20c 100644
--- a/cpukit/posix/src/pspinlock.c
+++ b/cpukit/posix/src/pspinlock.c
@@ -47,16 +47,18 @@ int pthread_spin_lock(
the_spinlock = _POSIX_Spinlock_Get( spinlock, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
case OBJECTS_LOCAL:
status = _CORE_spinlock_Wait( &the_spinlock->Spinlock, TRUE, 0 );
_Thread_Enable_dispatch();
return _POSIX_Spinlock_Translate_core_spinlock_return_code( status );
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/pspinlocktranslatereturncode.c b/cpukit/posix/src/pspinlocktranslatereturncode.c
index 3b45d72e6b..fbce440010 100644
--- a/cpukit/posix/src/pspinlocktranslatereturncode.c
+++ b/cpukit/posix/src/pspinlocktranslatereturncode.c
@@ -1,7 +1,7 @@
/*
* Spinlock Manager -- Translate SuperCore Status
*
- * COPYRIGHT (c) 1989-2006.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -19,7 +19,7 @@
#include <errno.h>
#include <rtems/system.h>
-#include <rtems/posix/spinlock.h>
+#include <rtems/score/corespinlock.h>
/*
* _POSIX_Spinlock_Translate_core_spinlock_return_code
@@ -32,8 +32,7 @@
*
*/
-/* XXX fix me */
-static int _POSIX_Spinlock_Return_codes[] = {
+static int _POSIX_Spinlock_Return_codes[CORE_SPINLOCK_STATUS_LAST + 1] = {
0, /* CORE_SPINLOCK_SUCCESSFUL */
EDEADLK, /* CORE_SPINLOCK_HOLDER_RELOCKING */
EPERM, /* CORE_SPINLOCK_NOT_HOLDER */
@@ -48,7 +47,12 @@ int _POSIX_Spinlock_Translate_core_spinlock_return_code(
CORE_spinlock_Status the_spinlock_status
)
{
- if ( the_spinlock_status <= CORE_SPINLOCK_STATUS_LAST )
- return _POSIX_Spinlock_Return_codes[the_spinlock_status];
- return POSIX_BOTTOM_REACHED();
+ /*
+ * Internal consistency check for bad status from SuperCore
+ */
+ #if defined(RTEMS_DEBUG)
+ if ( the_spinlock_status > CORE_SPINLOCK_STATUS_LAST )
+ return EINVAL;
+ #endif
+ return _POSIX_Spinlock_Return_codes[the_spinlock_status];
}
diff --git a/cpukit/posix/src/pspintrylock.c b/cpukit/posix/src/pspintrylock.c
index 86c490f1cf..ba72179470 100644
--- a/cpukit/posix/src/pspintrylock.c
+++ b/cpukit/posix/src/pspintrylock.c
@@ -47,16 +47,18 @@ int pthread_spin_trylock(
the_spinlock = _POSIX_Spinlock_Get( spinlock, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
case OBJECTS_LOCAL:
status = _CORE_spinlock_Wait( &the_spinlock->Spinlock, FALSE, 0 );
_Thread_Enable_dispatch();
return _POSIX_Spinlock_Translate_core_spinlock_return_code( status );
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/pspinunlock.c b/cpukit/posix/src/pspinunlock.c
index 38f6310a79..8bbf4f2f61 100644
--- a/cpukit/posix/src/pspinunlock.c
+++ b/cpukit/posix/src/pspinunlock.c
@@ -47,16 +47,18 @@ int pthread_spin_unlock(
the_spinlock = _POSIX_Spinlock_Get( spinlock, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return EINVAL;
case OBJECTS_LOCAL:
status = _CORE_spinlock_Release( &the_spinlock->Spinlock );
_Thread_Enable_dispatch();
return _POSIX_Spinlock_Translate_core_spinlock_return_code( status );
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return EINVAL;
}
diff --git a/cpukit/posix/src/pthreaddetach.c b/cpukit/posix/src/pthreaddetach.c
index 153f04dba0..06a95bfd05 100644
--- a/cpukit/posix/src/pthreaddetach.c
+++ b/cpukit/posix/src/pthreaddetach.c
@@ -32,18 +32,20 @@ int pthread_detach(
the_thread = _POSIX_Threads_Get( thread, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return ESRCH;
+
case OBJECTS_LOCAL:
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
api->detachstate = PTHREAD_CREATE_DETACHED;
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return ESRCH;
}
diff --git a/cpukit/posix/src/pthreadequal.c b/cpukit/posix/src/pthreadequal.c
index 86db43767a..8d82d8d545 100644
--- a/cpukit/posix/src/pthreadequal.c
+++ b/cpukit/posix/src/pthreadequal.c
@@ -53,12 +53,6 @@ int pthread_equal(
(void) _POSIX_Threads_Get( t1, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- /* return status == 0 */
- break;
case OBJECTS_LOCAL:
@@ -68,20 +62,30 @@ int pthread_equal(
(void) _POSIX_Threads_Get( t2, &location );
switch ( location ) {
+
+ case OBJECTS_LOCAL:
+ status = _Objects_Are_ids_equal( t1, t2 );
+ _Thread_Unnest_dispatch();
+ _Thread_Enable_dispatch();
+ break;
+
case OBJECTS_ERROR:
case OBJECTS_REMOTE:
/* t1 must have been valid so exit the critical section */
_Thread_Enable_dispatch();
/* return status == 0 */
break;
- case OBJECTS_LOCAL:
- status = _Objects_Are_ids_equal( t1, t2 );
- _Thread_Unnest_dispatch();
- _Thread_Enable_dispatch();
- break;
}
break;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ /* return status == 0 */
+ break;
}
+
return status;
#endif
}
diff --git a/cpukit/posix/src/pthreadgetschedparam.c b/cpukit/posix/src/pthreadgetschedparam.c
index ff92fe29d5..6b981c3d1e 100644
--- a/cpukit/posix/src/pthreadgetschedparam.c
+++ b/cpukit/posix/src/pthreadgetschedparam.c
@@ -38,11 +38,7 @@ int pthread_getschedparam(
the_thread = _POSIX_Threads_Get( thread, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return ESRCH;
+
case OBJECTS_LOCAL:
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
if ( policy )
@@ -54,8 +50,14 @@ int pthread_getschedparam(
}
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return ESRCH;
}
diff --git a/cpukit/posix/src/pthreadjoin.c b/cpukit/posix/src/pthreadjoin.c
index 7c2623f81d..d9fbfd0b0f 100644
--- a/cpukit/posix/src/pthreadjoin.c
+++ b/cpukit/posix/src/pthreadjoin.c
@@ -34,11 +34,7 @@ int pthread_join(
the_thread = _POSIX_Threads_Get( thread, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return ESRCH;
+
case OBJECTS_LOCAL:
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
@@ -67,7 +63,13 @@ int pthread_join(
if ( value_ptr )
*value_ptr = return_pointer;
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ return ESRCH;
}
diff --git a/cpukit/posix/src/pthreadkill.c b/cpukit/posix/src/pthreadkill.c
index be3678db14..0c9c3caa00 100644
--- a/cpukit/posix/src/pthreadkill.c
+++ b/cpukit/posix/src/pthreadkill.c
@@ -47,11 +47,7 @@ int pthread_kill(
the_thread = _POSIX_Threads_Get( thread, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( ESRCH );
+
case OBJECTS_LOCAL:
/*
* If sig == 0 then just validate arguments
@@ -79,7 +75,13 @@ int pthread_kill(
}
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+ rtems_set_errno_and_return_minus_one( ESRCH );
}
diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c
index 5b3e852541..4edd96cf68 100644
--- a/cpukit/posix/src/pthreadsetschedparam.c
+++ b/cpukit/posix/src/pthreadsetschedparam.c
@@ -86,11 +86,7 @@ int pthread_setschedparam(
the_thread = _POSIX_Threads_Get( thread, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- return ESRCH;
+
case OBJECTS_LOCAL:
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
@@ -127,6 +123,13 @@ int pthread_setschedparam(
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ return ESRCH;
}
diff --git a/cpukit/posix/src/ptimer1.c b/cpukit/posix/src/ptimer1.c
index 142ac846c9..1f3dabbb01 100644
--- a/cpukit/posix/src/ptimer1.c
+++ b/cpukit/posix/src/ptimer1.c
@@ -228,14 +228,6 @@ int timer_delete(
ptimer = _POSIX_Timer_Get( timerid, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
- _Thread_Dispatch();
- rtems_set_errno_and_return_minus_one( EINVAL );
-#endif
-
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EINVAL );
case OBJECTS_LOCAL:
_Objects_Close( &_POSIX_Timer_Information, &ptimer->Object );
@@ -244,8 +236,15 @@ int timer_delete(
_POSIX_Timer_Free( ptimer );
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return -1; /* unreached - only to remove warnings */
+
+ rtems_set_errno_and_return_minus_one( EINVAL );
}
/*
@@ -292,15 +291,6 @@ int timer_settime(
ptimer = _POSIX_Timer_Get( timerid, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
- _Thread_Dispatch();
- return -1;
- rtems_set_errno_and_return_minus_one( EINVAL );
-#endif
-
- case OBJECTS_ERROR:
- return -1;
case OBJECTS_LOCAL:
/* First, it verifies if the timer must be stopped */
@@ -376,9 +366,16 @@ int timer_settime(
return 0;
}
_Thread_Enable_dispatch();
- rtems_set_errno_and_return_minus_one( EINVAL );
+ break;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return -1; /* unreached - only to remove warnings */
+
+ rtems_set_errno_and_return_minus_one( EINVAL );
}
/*
@@ -416,14 +413,6 @@ int timer_gettime(
ptimer = _POSIX_Timer_Get( timerid, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
- _Thread_Dispatch();
- rtems_set_errno_and_return_minus_one( EINVAL );
-#endif
-
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EINVAL );
case OBJECTS_LOCAL:
@@ -439,8 +428,15 @@ int timer_gettime(
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return -1; /* unreached - only to remove warnings */
+
+ rtems_set_errno_and_return_minus_one( EINVAL );
}
/*
@@ -465,20 +461,19 @@ int timer_getoverrun(
ptimer = _POSIX_Timer_Get( timerid, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
- _Thread_Dispatch();
- rtems_set_errno_and_return_minus_one( EINVAL );
-#endif
-
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EINVAL );
case OBJECTS_LOCAL:
overrun = ptimer->overrun;
ptimer->overrun = 0;
_Thread_Enable_dispatch();
return overrun;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return -1; /* unreached - only to remove warnings */
+
+ rtems_set_errno_and_return_minus_one( EINVAL );
}
diff --git a/cpukit/posix/src/semaphoretranslatereturncode.c b/cpukit/posix/src/semaphoretranslatereturncode.c
new file mode 100644
index 0000000000..9961470f50
--- /dev/null
+++ b/cpukit/posix/src/semaphoretranslatereturncode.c
@@ -0,0 +1,60 @@
+/*
+ * POSIX Semaphore Error Translation
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <pthread.h>
+#include <errno.h>
+
+#include <rtems/system.h>
+#include <rtems/score/coresem.h>
+
+/*
+ * _POSIX_Semaphore_Translate_core_semaphore_return_code
+ *
+ * Input parameters:
+ * the_semaphore_status - semaphore status code to translate
+ *
+ * Output parameters:
+ * status code - translated POSIX status code
+ *
+ */
+
+static 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 */
+ ETIMEDOUT, /* CORE_SEMAPHORE_TIMEOUT */
+ /* The next error can not occur since we set the maximum
+ * count to the largest value the count can hold.
+ */
+ ENOSYS, /* CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED */
+ EINVAL /* CORE_SEMAPHORE_BAD_TIMEOUT_VALUE */
+};
+
+
+int _POSIX_Semaphore_Translate_core_semaphore_return_code(
+ CORE_semaphore_Status the_semaphore_status
+)
+{
+ /*
+ * Internal consistency check for bad status from SuperCore
+ */
+ #if defined(RTEMS_DEBUG)
+ if ( the_semaphore_status > CORE_SEMAPHORE_STATUS_LAST )
+ return EINVAL;
+ #endif
+ return _POSIX_Semaphore_Return_codes[the_semaphore_status];
+}
diff --git a/cpukit/posix/src/semaphorewaitsupp.c b/cpukit/posix/src/semaphorewaitsupp.c
index 7085cbe136..e35ae7693b 100644
--- a/cpukit/posix/src/semaphorewaitsupp.c
+++ b/cpukit/posix/src/semaphorewaitsupp.c
@@ -36,11 +36,7 @@ int _POSIX_Semaphore_Wait_support(
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EINVAL );
+
case OBJECTS_LOCAL:
_CORE_semaphore_Seize(
&the_semaphore->Semaphore,
@@ -49,26 +45,22 @@ int _POSIX_Semaphore_Wait_support(
timeout
);
_Thread_Enable_dispatch();
- switch ( _Thread_Executing->Wait.return_code ) {
- case CORE_SEMAPHORE_STATUS_SUCCESSFUL:
- break;
- case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
- rtems_set_errno_and_return_minus_one( EAGAIN );
- case CORE_SEMAPHORE_WAS_DELETED:
- rtems_set_errno_and_return_minus_one( EAGAIN );
- case CORE_SEMAPHORE_TIMEOUT:
- rtems_set_errno_and_return_minus_one( ETIMEDOUT );
- break;
- case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED:
- /*
- * This error can not occur since we set the maximum
- * count to the largest value the count can hold.
- */
- break;
- case CORE_SEMAPHORE_BAD_TIMEOUT_VALUE:
- rtems_set_errno_and_return_minus_one( EINVAL );
- break;
- }
+
+ if ( !_Thread_Executing->Wait.return_code )
+ return 0;
+
+ rtems_set_errno_and_return_minus_one(
+ _POSIX_Semaphore_Translate_core_semaphore_return_code(
+ _Thread_Executing->Wait.return_code
+ )
+ );
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return 0;
+
+ rtems_set_errno_and_return_minus_one( EINVAL );
}
diff --git a/cpukit/posix/src/semclose.c b/cpukit/posix/src/semclose.c
index 9f5dc040f2..2de949ea73 100644
--- a/cpukit/posix/src/semclose.c
+++ b/cpukit/posix/src/semclose.c
@@ -39,16 +39,19 @@ int sem_close(
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EINVAL );
+
case OBJECTS_LOCAL:
the_semaphore->open_count -= 1;
_POSIX_Semaphore_Delete( the_semaphore );
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ rtems_set_errno_and_return_minus_one( EINVAL );
}
diff --git a/cpukit/posix/src/semdestroy.c b/cpukit/posix/src/semdestroy.c
index f7c9a491b1..030e44f433 100644
--- a/cpukit/posix/src/semdestroy.c
+++ b/cpukit/posix/src/semdestroy.c
@@ -34,11 +34,7 @@ int sem_destroy(
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EINVAL );
+
case OBJECTS_LOCAL:
/*
* Undefined operation on a named semaphore.
@@ -52,6 +48,13 @@ int sem_destroy(
_POSIX_Semaphore_Delete( the_semaphore );
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ rtems_set_errno_and_return_minus_one( EINVAL );
}
diff --git a/cpukit/posix/src/semgetvalue.c b/cpukit/posix/src/semgetvalue.c
index f3883f3435..42d94aae8b 100644
--- a/cpukit/posix/src/semgetvalue.c
+++ b/cpukit/posix/src/semgetvalue.c
@@ -35,15 +35,18 @@ int sem_getvalue(
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EINVAL );
+
case OBJECTS_LOCAL:
*sval = _CORE_semaphore_Get_count( &the_semaphore->Semaphore );
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ rtems_set_errno_and_return_minus_one( EINVAL );
}
diff --git a/cpukit/posix/src/sempost.c b/cpukit/posix/src/sempost.c
index 1c9e5131d6..11bfc3ede9 100644
--- a/cpukit/posix/src/sempost.c
+++ b/cpukit/posix/src/sempost.c
@@ -34,11 +34,7 @@ int sem_post(
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- rtems_set_errno_and_return_minus_one( EINVAL );
+
case OBJECTS_LOCAL:
_CORE_semaphore_Surrender(
&the_semaphore->Semaphore,
@@ -51,6 +47,13 @@ int sem_post(
);
_Thread_Enable_dispatch();
return 0;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
}
- return POSIX_BOTTOM_REACHED();
+
+ rtems_set_errno_and_return_minus_one( EINVAL );
}
diff --git a/cpukit/posix/src/types.c b/cpukit/posix/src/types.c
index c6ef882600..89fc961947 100644
--- a/cpukit/posix/src/types.c
+++ b/cpukit/posix/src/types.c
@@ -23,12 +23,6 @@
#include <assert.h>
-int POSIX_BOTTOM_REACHED()
-{
- assert( 0 );
- return 0;
-}
-
int POSIX_NOT_IMPLEMENTED()
{
assert( 0 );
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;
}
diff --git a/cpukit/score/include/rtems/score/corebarrier.h b/cpukit/score/include/rtems/score/corebarrier.h
index 34337e195f..3b6b833ce3 100644
--- a/cpukit/score/include/rtems/score/corebarrier.h
+++ b/cpukit/score/include/rtems/score/corebarrier.h
@@ -6,7 +6,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2006.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -82,6 +82,13 @@ typedef enum {
} CORE_barrier_Status;
/**
+ * @brief Core Barrier Last Status
+ *
+ * This is the last status value.
+ */
+#define CORE_BARRIER_STATUS_LAST CORE_BARRIER_TIMEOUT
+
+/**
* The following defines the control block used to manage the
* attributes of each barrier.
*/
diff --git a/cpukit/score/include/rtems/score/coremsg.h b/cpukit/score/include/rtems/score/coremsg.h
index 6ff2489101..c35574f3fc 100644
--- a/cpukit/score/include/rtems/score/coremsg.h
+++ b/cpukit/score/include/rtems/score/coremsg.h
@@ -6,7 +6,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2006.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -150,6 +150,13 @@ typedef enum {
} CORE_message_queue_Status;
/**
+ * @brief Core Message Queue Last Status
+ *
+ * This is the last status value.
+ */
+#define CORE_MESSAGE_QUEUE_STATUS_LAST CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT
+
+/**
* @brief Message Queue Attributes Type
*
* The following defines the control block used to manage the
diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h
index 1d2d38db59..ee600dcc2e 100644
--- a/cpukit/score/include/rtems/score/coremutex.h
+++ b/cpukit/score/include/rtems/score/coremutex.h
@@ -8,7 +8,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2006.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -108,6 +108,13 @@ typedef enum {
} CORE_mutex_Status;
/**
+ * @brief Core Mutex Last Status
+ *
+ * This is the last status value.
+ */
+#define CORE_MUTEX_STATUS_LAST CORE_MUTEX_STATUS_CEILING_VIOLATED
+
+/**
* @brief Mutex Lock Nesting Behavior Enumeration
*
* This enumerated type defines the possible behaviors for
diff --git a/cpukit/score/include/rtems/score/coresem.h b/cpukit/score/include/rtems/score/coresem.h
index a146b1c1c2..9a0436b29a 100644
--- a/cpukit/score/include/rtems/score/coresem.h
+++ b/cpukit/score/include/rtems/score/coresem.h
@@ -8,7 +8,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2006.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -93,6 +93,13 @@ typedef enum {
} CORE_semaphore_Status;
/**
+ * @brief Core Semaphore Last Status
+ *
+ * This is the last status value.
+ */
+#define CORE_SEMAPHORE_STATUS_LAST CORE_SEMAPHORE_BAD_TIMEOUT_VALUE
+
+/**
* The following defines the control block used to manage the
* attributes of each semaphore.
*/
diff --git a/cpukit/score/include/rtems/system.h b/cpukit/score/include/rtems/system.h
index 7fb12a4bfb..b3a0b915e0 100644
--- a/cpukit/score/include/rtems/system.h
+++ b/cpukit/score/include/rtems/system.h
@@ -140,13 +140,7 @@ extern "C" {
#ifdef RTEMS_POSIX_API
/** The following is used by the POSIX implementation to catch bad paths. */
-int POSIX_MP_NOT_IMPLEMENTED( void );
-
-/** The following is used by the POSIX implementation to catch bad paths. */
int POSIX_NOT_IMPLEMENTED( void );
-
-/** The following is used by the POSIX implementation to catch bad paths. */
-int POSIX_BOTTOM_REACHED( void );
#endif
/*