[PATCH v2 1/2] score: Fix internal error status number

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Apr 6 14:07:23 UTC 2021


The value of STATUS_CLASSIC_INTERNAL_ERROR must be equal to
RTEMS_INTERNAL_ERROR.  Add static assertions to ensure that the status
codes match.
---
 cpukit/include/rtems/score/status.h |  4 ++--
 cpukit/rtems/src/taskconstruct.c    | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/cpukit/include/rtems/score/status.h b/cpukit/include/rtems/score/status.h
index 352f76e34d..a1c3c84b4d 100644
--- a/cpukit/include/rtems/score/status.h
+++ b/cpukit/include/rtems/score/status.h
@@ -50,7 +50,7 @@ extern "C" {
  */
 typedef enum {
   STATUS_CLASSIC_INCORRECT_STATE = 14,
-  STATUS_CLASSIC_INTERNAL_ERROR = 13,
+  STATUS_CLASSIC_INTERNAL_ERROR = 25,
   STATUS_CLASSIC_INVALID_NUMBER = 10,
   STATUS_CLASSIC_INVALID_PRIORITY = 19,
   STATUS_CLASSIC_INVALID_SIZE = 8,
@@ -107,7 +107,7 @@ typedef enum {
   STATUS_INVALID_PRIORITY =
     STATUS_BUILD( STATUS_CLASSIC_INVALID_PRIORITY, EINVAL ),
   STATUS_MAXIMUM_COUNT_EXCEEDED =
-    STATUS_BUILD( STATUS_CLASSIC_INTERNAL_ERROR, EOVERFLOW ),
+    STATUS_BUILD( STATUS_CLASSIC_UNSATISFIED, EOVERFLOW ),
   STATUS_MESSAGE_INVALID_SIZE =
     STATUS_BUILD( STATUS_CLASSIC_INVALID_SIZE, EMSGSIZE ),
   STATUS_MESSAGE_QUEUE_INVALID_NUMBER =
diff --git a/cpukit/rtems/src/taskconstruct.c b/cpukit/rtems/src/taskconstruct.c
index 397f6c2c89..2cddb448f6 100644
--- a/cpukit/rtems/src/taskconstruct.c
+++ b/cpukit/rtems/src/taskconstruct.c
@@ -35,6 +35,28 @@
 
 #include <string.h>
 
+#define STATUS_ASSERT( status ) \
+  RTEMS_STATIC_ASSERT( \
+    (int) STATUS_CLASSIC_##status == (int) RTEMS_##status, \
+    status \
+  )
+
+STATUS_ASSERT( INCORRECT_STATE );
+STATUS_ASSERT( INTERNAL_ERROR );
+STATUS_ASSERT( INVALID_NUMBER );
+STATUS_ASSERT( INVALID_PRIORITY );
+STATUS_ASSERT( INVALID_SIZE );
+STATUS_ASSERT( NO_MEMORY );
+STATUS_ASSERT( NOT_DEFINED );
+STATUS_ASSERT( NOT_OWNER_OF_RESOURCE );
+STATUS_ASSERT( OBJECT_WAS_DELETED );
+STATUS_ASSERT( PROXY_BLOCKING );
+STATUS_ASSERT( RESOURCE_IN_USE );
+STATUS_ASSERT( SUCCESSFUL );
+STATUS_ASSERT( TIMEOUT );
+STATUS_ASSERT( TOO_MANY );
+STATUS_ASSERT( UNSATISFIED );
+
 static rtems_status_code _RTEMS_tasks_Prepare_user_stack(
   Thread_Configuration    *thread_config,
   const rtems_task_config *config
-- 
2.26.2



More information about the devel mailing list