[rtems commit] posix: Update to the pthread_once changes.

Chris Johns chrisj at rtems.org
Fri Aug 23 04:50:32 UTC 2013


Module:    rtems
Branch:    master
Commit:    6e4c01e3a2c07d3d42c510fbff70c14ccbafd2df
Changeset: http://git.rtems.org/rtems/commit/?id=6e4c01e3a2c07d3d42c510fbff70c14ccbafd2df

Author:    Chris Johns <chrisj at rtems.org>
Date:      Fri Aug 23 14:56:36 2013 +1000

posix: Update to the pthread_once changes.

Implement the reeview changes.
Add a POSIX Fatal error domain.
Fix confdefs.h to correctly handle the internal POSIX mutexes.

---

 cpukit/posix/include/rtems/posix/posixapi.h |   20 +++++-
 cpukit/posix/src/once.c                     |   25 +++---
 cpukit/posix/src/pthreadinitthreads.c       |   19 +++--
 cpukit/posix/src/pthreadonce.c              |    6 +-
 cpukit/sapi/include/confdefs.h              |  118 ++++++++++++---------------
 cpukit/sapi/src/posixapi.c                  |    7 ++
 testsuites/psxtests/psx01/init.c            |   17 ++++
 testsuites/psxtests/psxconfig01/init.c      |   27 ++++---
 8 files changed, 137 insertions(+), 102 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/posixapi.h b/cpukit/posix/include/rtems/posix/posixapi.h
index bf1c1b7..a7782a5 100644
--- a/cpukit/posix/include/rtems/posix/posixapi.h
+++ b/cpukit/posix/include/rtems/posix/posixapi.h
@@ -1,6 +1,6 @@
 /**
  * @file
- * 
+ *
  * @brief POSIX API Implementation
  *
  * This include file defines the top level interface to the POSIX API
@@ -31,6 +31,24 @@
 /**@{**/
 
 /**
+ * @brief POSIX API Fatal domains.
+ */
+typedef enum {
+  POSIX_FD_PTHREAD,      /**< A pthread thread error. */
+  POSIX_FD_PTHREAD_ONCE  /**< A pthread once error. */
+} POSIX_Fatal_domain;
+
+/**
+ * @brief POSIX API Fatal error.
+ *
+ * A common method of rasing a POSIX API fatal error.
+ *
+ * @param[in] domain The POSIX error domain.
+ * @param[in] eno The error number as defined in errno.h.
+ */
+void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno );
+
+/**
  * @brief Initialize POSIX API.
  *
  * This method is responsible for initializing each of the POSIX
diff --git a/cpukit/posix/src/once.c b/cpukit/posix/src/once.c
index d77c3c1..e91daf2 100644
--- a/cpukit/posix/src/once.c
+++ b/cpukit/posix/src/once.c
@@ -22,28 +22,25 @@
 #include <errno.h>
 
 #include <rtems.h>
+#include <rtems/posix/posixapi.h>
 #include <rtems/posix/onceimpl.h>
 
-pthread_mutex_t _POSIX_Once_Lock;
-
 void _POSIX_Once_Manager_initialization(void)
 {
   pthread_mutexattr_t mattr;
-  int r;
+  int eno;
 
   _POSIX_Once_Lock = PTHREAD_MUTEX_INITIALIZER;
 
-  r = pthread_mutexattr_init( &mattr );
-  if ( r != 0 )
-    rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, 0x80aa0000 | r );
-
-  r = pthread_mutexattr_settype( &mattr, PTHREAD_MUTEX_RECURSIVE );
-   if ( r != 0 )
-    rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, 0x80aa1000 | r );
+  eno = pthread_mutexattr_init( &mattr );
+  _Assert( eno == 0 );
+  eno = pthread_mutexattr_settype( &mattr, PTHREAD_MUTEX_RECURSIVE );
+  _Assert( eno == 0 );
 
-  r = pthread_mutex_init( &_POSIX_Once_Lock, &mattr );
-  if ( r != 0 )
-    rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, 0x80aa2000 | r );
+  eno = pthread_mutex_init( &_POSIX_Once_Lock, &mattr );
+  if ( eno != 0 )
+    _POSIX_Fatal_error( POSIX_FD_PTHREAD_ONCE, eno );
 
-  pthread_mutexattr_destroy( &mattr );
+  eno = pthread_mutexattr_destroy( &mattr );
+  _Assert( eno == 0 );
 }
diff --git a/cpukit/posix/src/pthreadinitthreads.c b/cpukit/posix/src/pthreadinitthreads.c
index 961105c..1ec28ba 100644
--- a/cpukit/posix/src/pthreadinitthreads.c
+++ b/cpukit/posix/src/pthreadinitthreads.c
@@ -29,6 +29,7 @@
 #include <rtems/score/thread.h>
 #include <rtems/score/wkspace.h>
 #include <rtems/posix/cancel.h>
+#include <rtems/posix/posixapi.h>
 #include <rtems/posix/pthreadimpl.h>
 #include <rtems/posix/priorityimpl.h>
 #include <rtems/posix/config.h>
@@ -36,7 +37,7 @@
 
 void _POSIX_Threads_Initialize_user_threads_body(void)
 {
-  int                                 status;
+  int                                 eno;
   uint32_t                            index;
   uint32_t                            maximum;
   posix_initialization_threads_table *user_threads;
@@ -60,18 +61,20 @@ void _POSIX_Threads_Initialize_user_threads_body(void)
     /*
      * There is no way for these calls to fail in this situation.
      */
-    (void) pthread_attr_init( &attr );
-    (void) pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
-    (void) pthread_attr_setstacksize(&attr, user_threads[ index ].stack_size);
+    eno = pthread_attr_init( &attr );
+    _Assert( eno == 0 );
+    eno = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
+    _Assert( eno == 0 );
+    eno = pthread_attr_setstacksize(&attr, user_threads[ index ].stack_size);
+    _Assert( eno == 0 );
 
-    status = pthread_create(
+    eno = pthread_create(
       &thread_id,
       &attr,
       user_threads[ index ].thread_entry,
       NULL
     );
-    if ( status )
-      _Internal_error_Occurred( INTERNAL_ERROR_POSIX_API, true, status );
+    if ( eno )
+      _POSIX_Fatal_error( POSIX_FD_PTHREAD, eno );
   }
 }
-
diff --git a/cpukit/posix/src/pthreadonce.c b/cpukit/posix/src/pthreadonce.c
index 2b02f1e..aa8afe7 100644
--- a/cpukit/posix/src/pthreadonce.c
+++ b/cpukit/posix/src/pthreadonce.c
@@ -29,7 +29,7 @@
 
 #define PTHREAD_ONCE_INIT_NOT_RUN  0
 #define PTHREAD_ONCE_INIT_RUNNING  1
-#define PTHREAD_ONCE_INIT_RUN      2
+#define PTHREAD_ONCE_INIT_COMPLETE 2
 
 int pthread_once(
   pthread_once_t  *once_control,
@@ -44,7 +44,7 @@ int pthread_once(
   if ( once_control->is_initialized != 1 )
     return EINVAL;
 
-  if ( once_control->init_executed != PTHREAD_ONCE_INIT_RUN ) {
+  if ( once_control->init_executed != PTHREAD_ONCE_INIT_COMPLETE ) {
     r = pthread_mutex_lock( &_POSIX_Once_Lock );
     if ( r == 0 ) {
       int rr;
@@ -61,7 +61,7 @@ int pthread_once(
         case PTHREAD_ONCE_INIT_NOT_RUN:
           once_control->init_executed = PTHREAD_ONCE_INIT_RUNNING;
           (*init_routine)();
-          once_control->init_executed = PTHREAD_ONCE_INIT_RUN;
+          once_control->init_executed = PTHREAD_ONCE_INIT_COMPLETE;
           break;
         case PTHREAD_ONCE_INIT_RUNNING:
           r = EINVAL;
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index dc4fb5e..24c768f 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -954,13 +954,19 @@ const rtems_libio_helper rtems_fs_init_helper =
 #endif
 
 /**
+ * Zero of one returns 0 if the parameter is 0 else 1 is returned.
+ */
+#define _Configure_Zero_or_One(_number) ((_number) ? 1 : 0)
+
+/**
  * This is a helper macro used in calculations in this file.  It is used
  * to noted when an element is allocated from the RTEMS Workspace and adds
  * a factor to account for heap overhead plus an alignment factor that
  * may be applied.
  */
 #define _Configure_From_workspace(_size) \
-  (ssize_t)((_size) + HEAP_BLOCK_HEADER_SIZE + CPU_HEAP_ALIGNMENT - 1)
+   (ssize_t) (_Configure_Zero_or_One(_size) * \
+     ((_size) + HEAP_BLOCK_HEADER_SIZE + CPU_HEAP_ALIGNMENT - 1))
 
 /**
  * This is a helper macro used in stack space calculations in this file.  It
@@ -980,7 +986,7 @@ const rtems_libio_helper rtems_fs_init_helper =
  * for memory usage.
  */
 #define _Configure_Max_Objects(_max) \
-  rtems_resource_maximum_per_allocation(_max)
+  (_Configure_Zero_or_One(_max) * rtems_resource_maximum_per_allocation(_max))
 
 /**
  * This macro accounts for how memory for a set of configured objects is
@@ -992,8 +998,10 @@ const rtems_libio_helper rtems_fs_init_helper =
 #define _Configure_Object_RAM(_number, _size) \
   ( _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \
     _Configure_From_workspace( \
-      ((_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *)) + \
-      (sizeof(void *) + sizeof(uint32_t) + sizeof(Objects_Name *)) \
+      (_Configure_Zero_or_One(_number) * \
+       (_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *)) + \
+      (_Configure_Zero_or_One(_number) * \
+       (sizeof(void *) + sizeof(uint32_t) + sizeof(Objects_Name *))) \
     ) \
   )
 
@@ -1730,114 +1738,95 @@ const rtems_libio_helper rtems_fs_init_helper =
     (_Configure_Max_Objects(_number) * _Configure_From_workspace(NAME_MAX) )
 
   #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
-    #define CONFIGURE_MAXIMUM_POSIX_THREADS      0
+    #define CONFIGURE_MAXIMUM_POSIX_THREADS 0
   #endif
 
   #define CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API \
     _Configure_From_workspace(sizeof(POSIX_API_Control))
 
   #ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
-    #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              0
-    #define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) 0
-  #else
-    #define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) \
-      _Configure_Object_RAM(_mutexes, sizeof(POSIX_Mutex_Control) )
+    #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 0
   #endif
+  #define CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) \
+    _Configure_Object_RAM(_mutexes, sizeof(POSIX_Mutex_Control) )
 
   #ifndef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
-    #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES               0
-    #define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) 0
-  #else
-    #define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) \
-        _Configure_Object_RAM(_condvars, \
-                            sizeof(POSIX_Condition_variables_Control) )
+    #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 0
   #endif
+  #define CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(_condvars) \
+      _Configure_Object_RAM(_condvars, \
+                          sizeof(POSIX_Condition_variables_Control) )
 
   #ifndef CONFIGURE_MAXIMUM_POSIX_KEYS
-    #define CONFIGURE_MAXIMUM_POSIX_KEYS           0
-    #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS      0
-    #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) 0
+    #define CONFIGURE_MAXIMUM_POSIX_KEYS            0
+    #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 0
   #else
     #ifndef CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS
       #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
         CONFIGURE_MAXIMUM_POSIX_KEYS \
         * (CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS)
     #endif
-  #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs)       \
-      (_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \
-  + _Configure_From_workspace(_key_value_pairs * sizeof(POSIX_Keys_Key_value_pair)))
   #endif
+  #define CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) \
+     (_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \
+      + _Configure_From_workspace(_key_value_pairs * sizeof(POSIX_Keys_Key_value_pair)))
 
   #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS
-    #define CONFIGURE_MAXIMUM_POSIX_TIMERS             0
-    #define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) 0
-  #else
-    #define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
-      _Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) )
+    #define CONFIGURE_MAXIMUM_POSIX_TIMERS 0
   #endif
+  #define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
+    _Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) )
 
   #ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS
-    #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS                     0
-    #define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) 0
-  #else
-    #define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \
-      _Configure_From_workspace( \
-        (_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
+    #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 0
   #endif
+  #define CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \
+    _Configure_From_workspace( \
+      (_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
 
   #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
     #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES                     0
-    #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) 0
     #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS          0
-    #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS(_fds) 0
   #else
-    #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
-      _Configure_POSIX_Named_Object_RAM( \
-         _message_queues, sizeof(POSIX_Message_queue_Control) )
-
     /* default to same number */
     #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
        #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS \
                CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
     #endif
-
-    #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS(_mqueue_fds) \
-      _Configure_Object_RAM( \
-         _mqueue_fds, sizeof(POSIX_Message_queue_Control_fd) )
   #endif
 
+  #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
+    _Configure_POSIX_Named_Object_RAM( \
+       _message_queues, sizeof(POSIX_Message_queue_Control) )
+
+  #define CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUE_DESCRIPTORS(_mqueue_fds) \
+    _Configure_Object_RAM( \
+       _mqueue_fds, sizeof(POSIX_Message_queue_Control_fd) )
+
   #ifndef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
-    #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES                 0
-    #define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) 0
-  #else
-    #define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \
-      _Configure_POSIX_Named_Object_RAM( \
-         _semaphores, sizeof(POSIX_Semaphore_Control) )
+    #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 0
   #endif
+  #define CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \
+    _Configure_POSIX_Named_Object_RAM( \
+       _semaphores, sizeof(POSIX_Semaphore_Control) )
 
   #ifndef CONFIGURE_MAXIMUM_POSIX_BARRIERS
-    #define CONFIGURE_MAXIMUM_POSIX_BARRIERS               0
-    #define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) 0
-  #else
-    #define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) \
-      _Configure_Object_RAM(_barriers, sizeof(POSIX_Barrier_Control) )
+    #define CONFIGURE_MAXIMUM_POSIX_BARRIERS 0
   #endif
+  #define CONFIGURE_MEMORY_FOR_POSIX_BARRIERS(_barriers) \
+    _Configure_Object_RAM(_barriers, sizeof(POSIX_Barrier_Control) )
 
   #ifndef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
-    #define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS                0
-    #define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) 0
-  #else
-    #define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) \
-      _Configure_Object_RAM(_spinlocks, sizeof(POSIX_Spinlock_Control) )
+    #define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS 0
   #endif
+  #define CONFIGURE_MEMORY_FOR_POSIX_SPINLOCKS(_spinlocks) \
+    _Configure_Object_RAM(_spinlocks, sizeof(POSIX_Spinlock_Control) )
 
   #ifndef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
-    #define CONFIGURE_MAXIMUM_POSIX_RWLOCKS              0
-    #define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) 0
-  #else
-    #define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) \
-      _Configure_Object_RAM(_rwlocks, sizeof(POSIX_RWLock_Control) )
+    #define CONFIGURE_MAXIMUM_POSIX_RWLOCKS 0
   #endif
+  #define CONFIGURE_MEMORY_FOR_POSIX_RWLOCKS(_rwlocks) \
+    _Configure_Object_RAM(_rwlocks, sizeof(POSIX_RWLock_Control) )
 
   #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
 
@@ -2578,6 +2567,7 @@ const rtems_libio_helper rtems_fs_init_helper =
 #ifdef RTEMS_POSIX_API
     /* POSIX API Pieces */
     CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( CONFIGURE_MAXIMUM_POSIX_MUTEXES +
+      CONFIGURE_MAXIMUM_POSIX_INTERNAL_MUTEXES +
       CONFIGURE_MAXIMUM_GO_CHANNELS + CONFIGURE_GO_INIT_MUTEXES),
     CONFIGURE_MEMORY_FOR_POSIX_CONDITION_VARIABLES(
       CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES +
diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c
index 2d784a1..5254225 100644
--- a/cpukit/sapi/src/posixapi.c
+++ b/cpukit/sapi/src/posixapi.c
@@ -44,6 +44,13 @@
 #include <rtems/posix/spinlockimpl.h>
 #include <rtems/posix/time.h>
 
+void _POSIX_Fatal_error( POSIX_Fatal_domain domain, int eno )
+{
+  uint32_t code = ( domain << 8 ) | ( ( uint32_t ) eno & 0xffU );
+
+  _Internal_error_Occurred( INTERNAL_ERROR_POSIX_API, false, code );
+}
+
 Objects_Information *_POSIX_Objects[ OBJECTS_POSIX_CLASSES_LAST + 1 ];
 
 void _POSIX_API_Initialize(void)
diff --git a/testsuites/psxtests/psx01/init.c b/testsuites/psxtests/psx01/init.c
index 59605b4..1d1a9e8 100644
--- a/testsuites/psxtests/psx01/init.c
+++ b/testsuites/psxtests/psx01/init.c
@@ -20,6 +20,18 @@
 
 #include <rtems/score/todimpl.h>
 
+pthread_once_t nesting_once = PTHREAD_ONCE_INIT;
+
+void Test_init_routine_nesting( void );
+
+void Test_init_routine_nesting( void )
+{
+  int status;
+  puts( "Test_init_routine_nesting: invoked" );
+  status = pthread_once( &nesting_once, Test_init_routine_nesting );
+  rtems_test_assert( status == EINVAL );
+}
+
 void *POSIX_Init(
   void *argument
 )
@@ -95,6 +107,11 @@ void *POSIX_Init(
   );
   rtems_test_assert( !status );
 
+  /* once nesting */
+  puts( "Init: pthread_once - SUCCESSFUL (init_routine_nesting executes)" );
+  status = pthread_once( &nesting_once, Test_init_routine_nesting );
+  rtems_test_assert( !status );
+
   /* create a thread */
 
   puts( "Init: pthread_create - SUCCESSFUL" );
diff --git a/testsuites/psxtests/psxconfig01/init.c b/testsuites/psxtests/psxconfig01/init.c
index dcf15ff..e0d1ffc 100644
--- a/testsuites/psxtests/psxconfig01/init.c
+++ b/testsuites/psxtests/psxconfig01/init.c
@@ -162,6 +162,19 @@
 #define CONFIGURE_MESSAGE_BUFFER_MEMORY \
   (MQ_BUFFER_MEMORY + POSIX_MQ_BUFFER_MEMORY)
 
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_DRIVERS 2
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+static rtems_task Init(rtems_task_argument argument);
+
+#include <rtems/confdefs.h>
+
 typedef struct {
   uint64_t data [16];
 } area;
@@ -469,7 +482,8 @@ static rtems_task Init(rtems_task_argument argument)
   }
   rtems_resource_snapshot_take(&snapshot);
   rtems_test_assert(
-    snapshot.posix_api.active_mutexes == CONFIGURE_MAXIMUM_POSIX_MUTEXES
+    snapshot.posix_api.active_mutexes ==
+    (CONFIGURE_MAXIMUM_POSIX_MUTEXES + CONFIGURE_MAXIMUM_POSIX_INTERNAL_MUTEXES)
   );
 #endif
 
@@ -543,14 +557,3 @@ static rtems_task Init(rtems_task_argument argument)
 
   rtems_test_exit(0);
 }
-
-#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-
-#define CONFIGURE_MAXIMUM_DRIVERS 2
-
-#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-
-#define CONFIGURE_INIT
-
-#include <rtems/confdefs.h>




More information about the vc mailing list