[PATCH 2/5] score: Add Thread_queue_Queue::name

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Jan 12 14:51:22 UTC 2017


Update #2858.
---
 cpukit/score/include/rtems/score/threadq.h     |  5 ++++
 cpukit/score/include/rtems/score/threadqimpl.h | 38 ++++++++++++++++++--------
 cpukit/score/src/condition.c                   |  2 +-
 cpukit/score/src/futex.c                       |  2 +-
 cpukit/score/src/mutex.c                       |  8 +++---
 cpukit/score/src/semaphore.c                   |  4 +--
 cpukit/score/src/threadq.c                     |  8 +++++-
 7 files changed, 46 insertions(+), 21 deletions(-)

diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h
index dec8e13..f6257ec 100644
--- a/cpukit/score/include/rtems/score/threadq.h
+++ b/cpukit/score/include/rtems/score/threadq.h
@@ -420,6 +420,11 @@ struct Thread_queue_Queue {
    * @brief The thread queue owner.
    */
   Thread_Control *owner;
+
+  /**
+   * @brief The thread queue name.
+   */
+  const char *name;
 };
 
 /**
diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h
index 1558489..25a3f2d 100644
--- a/cpukit/score/include/rtems/score/threadqimpl.h
+++ b/cpukit/score/include/rtems/score/threadqimpl.h
@@ -1014,44 +1014,58 @@ size_t _Thread_queue_Flush_critical(
 void _Thread_queue_Initialize( Thread_queue_Control *the_thread_queue );
 
 #if defined(RTEMS_SMP) && defined(RTEMS_DEBUG) && defined(RTEMS_PROFILING)
-  #define THREAD_QUEUE_INITIALIZER( name ) \
+  #define THREAD_QUEUE_INITIALIZER( _name ) \
     { \
-      .Lock_stats = SMP_LOCK_STATS_INITIALIZER( name ), \
+      .Lock_stats = SMP_LOCK_STATS_INITIALIZER( _name ), \
       .owner = SMP_LOCK_NO_OWNER, \
       .Queue = { \
-        .heads = NULL, \
         .Lock = SMP_TICKET_LOCK_INITIALIZER, \
+        .heads = NULL, \
+        .owner = NULL, \
+        .name = _name \
       } \
     }
 #elif defined(RTEMS_SMP) && defined(RTEMS_DEBUG)
-  #define THREAD_QUEUE_INITIALIZER( name ) \
+  #define THREAD_QUEUE_INITIALIZER( _name ) \
     { \
       .owner = SMP_LOCK_NO_OWNER, \
       .Queue = { \
-        .heads = NULL, \
         .Lock = SMP_TICKET_LOCK_INITIALIZER, \
+        .heads = NULL, \
+        .owner = NULL, \
+        .name = _name \
       } \
     }
 #elif defined(RTEMS_SMP) && defined(RTEMS_PROFILING)
-  #define THREAD_QUEUE_INITIALIZER( name ) \
+  #define THREAD_QUEUE_INITIALIZER( _name ) \
     { \
-      .Lock_stats = SMP_LOCK_STATS_INITIALIZER( name ), \
+      .Lock_stats = SMP_LOCK_STATS_INITIALIZER( _name ), \
       .Queue = { \
-        .heads = NULL, \
         .Lock = SMP_TICKET_LOCK_INITIALIZER, \
+        .heads = NULL, \
+        .owner = NULL, \
+        .name = _name \
       } \
     }
 #elif defined(RTEMS_SMP)
-  #define THREAD_QUEUE_INITIALIZER( name ) \
+  #define THREAD_QUEUE_INITIALIZER( _name ) \
     { \
       .Queue = { \
-        .heads = NULL, \
         .Lock = SMP_TICKET_LOCK_INITIALIZER, \
+        .heads = NULL, \
+        .owner = NULL, \
+        .name = _name \
       } \
     }
 #else
-  #define THREAD_QUEUE_INITIALIZER( name ) \
-    { .Queue = { .heads = NULL } }
+  #define THREAD_QUEUE_INITIALIZER( _name ) \
+    { \
+      .Queue = { \
+        .heads = NULL, \
+        .owner = NULL, \
+        .name = _name \
+      } \
+    }
 #endif
 
 RTEMS_INLINE_ROUTINE void _Thread_queue_Destroy(
diff --git a/cpukit/score/src/condition.c b/cpukit/score/src/condition.c
index 3c3a011..7c370ac 100644
--- a/cpukit/score/src/condition.c
+++ b/cpukit/score/src/condition.c
@@ -41,7 +41,7 @@ RTEMS_STATIC_ASSERT(
 );
 
 RTEMS_STATIC_ASSERT(
-  sizeof( Condition_Control ) <= sizeof( struct _Condition_Control ),
+  sizeof( Condition_Control ) == sizeof( struct _Condition_Control ),
   CONDITION_CONTROL_SIZE
 );
 
diff --git a/cpukit/score/src/futex.c b/cpukit/score/src/futex.c
index d09b00b..1a19f32 100644
--- a/cpukit/score/src/futex.c
+++ b/cpukit/score/src/futex.c
@@ -39,7 +39,7 @@ RTEMS_STATIC_ASSERT(
 );
 
 RTEMS_STATIC_ASSERT(
-  sizeof( Futex_Control ) <= sizeof( struct _Futex_Control ),
+  sizeof( Futex_Control ) == sizeof( struct _Futex_Control ),
   FUTEX_CONTROL_SIZE
 );
 
diff --git a/cpukit/score/src/mutex.c b/cpukit/score/src/mutex.c
index ebdedf7..96834bf 100644
--- a/cpukit/score/src/mutex.c
+++ b/cpukit/score/src/mutex.c
@@ -39,7 +39,7 @@ RTEMS_STATIC_ASSERT(
 );
 
 RTEMS_STATIC_ASSERT(
-  sizeof( Mutex_Control ) <= sizeof( struct _Mutex_Control ),
+  sizeof( Mutex_Control ) == sizeof( struct _Mutex_Control ),
   MUTEX_CONTROL_SIZE
 );
 
@@ -50,19 +50,19 @@ typedef struct {
 
 RTEMS_STATIC_ASSERT(
   offsetof( Mutex_recursive_Control, Mutex )
-    <= offsetof( struct _Mutex_recursive_Control, _Mutex ),
+    == offsetof( struct _Mutex_recursive_Control, _Mutex ),
   MUTEX_RECURSIVE_CONTROL_MUTEX
 );
 
 RTEMS_STATIC_ASSERT(
   offsetof( Mutex_recursive_Control, nest_level )
-    <= offsetof( struct _Mutex_recursive_Control, _nest_level ),
+    == offsetof( struct _Mutex_recursive_Control, _nest_level ),
   MUTEX_RECURSIVE_CONTROL_NEST_LEVEL
 );
 
 RTEMS_STATIC_ASSERT(
   sizeof( Mutex_recursive_Control )
-    <= sizeof( struct _Mutex_recursive_Control ),
+    == sizeof( struct _Mutex_recursive_Control ),
   MUTEX_RECURSIVE_CONTROL_SIZE
 );
 
diff --git a/cpukit/score/src/semaphore.c b/cpukit/score/src/semaphore.c
index 5e64583..78fec37 100644
--- a/cpukit/score/src/semaphore.c
+++ b/cpukit/score/src/semaphore.c
@@ -39,12 +39,12 @@ RTEMS_STATIC_ASSERT(
 
 RTEMS_STATIC_ASSERT(
   offsetof( Semaphore_Control, count )
-    <= offsetof( struct _Semaphore_Control, _count ),
+    == offsetof( struct _Semaphore_Control, _count ),
   SEMAPHORE_CONTROL_COUNT
 );
 
 RTEMS_STATIC_ASSERT(
-  sizeof( Semaphore_Control ) <= sizeof( struct _Semaphore_Control ),
+  sizeof( Semaphore_Control ) == sizeof( struct _Semaphore_Control ),
   SEMAPHORE_CONTROL_SIZE
 );
 
diff --git a/cpukit/score/src/threadq.c b/cpukit/score/src/threadq.c
index b12e3de..4885326 100644
--- a/cpukit/score/src/threadq.c
+++ b/cpukit/score/src/threadq.c
@@ -57,8 +57,14 @@ RTEMS_STATIC_ASSERT(
 );
 
 RTEMS_STATIC_ASSERT(
+  offsetof( Thread_queue_Syslock_queue, Queue.name )
+    == offsetof( struct _Thread_queue_Queue, _name ),
+  THREAD_QUEUE_SYSLOCK_QUEUE_NAME
+);
+
+RTEMS_STATIC_ASSERT(
   sizeof( Thread_queue_Syslock_queue )
-    <= sizeof( struct _Thread_queue_Queue ),
+    == sizeof( struct _Thread_queue_Queue ),
   THREAD_QUEUE_SYSLOCK_QUEUE_SIZE
 );
 
-- 
1.8.4.5




More information about the devel mailing list