[PATCH 08/14] posix: Provide message queues by default

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Oct 29 09:03:17 UTC 2018


Update #2514.
---
 cpukit/Makefile.am                            | 26 +++++++-------
 cpukit/include/rtems/confdefs.h               | 52 +++++++++++++--------------
 cpukit/include/rtems/score/coremsg.h          | 26 ++++++--------
 cpukit/rtems/src/rtemsobjectgetapiclassname.c |  2 +-
 4 files changed, 50 insertions(+), 56 deletions(-)

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 6c2574b264..a8f78ead9c 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -510,7 +510,20 @@ librtemscpu_a_SOURCES += posix/src/mlockall.c
 librtemscpu_a_SOURCES += posix/src/mlock.c
 librtemscpu_a_SOURCES += posix/src/mmap.c
 librtemscpu_a_SOURCES += posix/src/mprotect.c
+librtemscpu_a_SOURCES += posix/src/mqueue.c
+librtemscpu_a_SOURCES += posix/src/mqueueclose.c
 librtemscpu_a_SOURCES += posix/src/mqueueconfig.c
+librtemscpu_a_SOURCES += posix/src/mqueuedeletesupp.c
+librtemscpu_a_SOURCES += posix/src/mqueuegetattr.c
+librtemscpu_a_SOURCES += posix/src/mqueueopen.c
+librtemscpu_a_SOURCES += posix/src/mqueuereceive.c
+librtemscpu_a_SOURCES += posix/src/mqueuerecvsupp.c
+librtemscpu_a_SOURCES += posix/src/mqueuesend.c
+librtemscpu_a_SOURCES += posix/src/mqueuesendsupp.c
+librtemscpu_a_SOURCES += posix/src/mqueuesetattr.c
+librtemscpu_a_SOURCES += posix/src/mqueuetimedreceive.c
+librtemscpu_a_SOURCES += posix/src/mqueuetimedsend.c
+librtemscpu_a_SOURCES += posix/src/mqueueunlink.c
 librtemscpu_a_SOURCES += posix/src/msync.c
 librtemscpu_a_SOURCES += posix/src/munlockall.c
 librtemscpu_a_SOURCES += posix/src/munlock.c
@@ -1047,20 +1060,7 @@ librtemscpu_a_SOURCES += posix/src/getitimer.c
 librtemscpu_a_SOURCES += posix/src/kill.c
 librtemscpu_a_SOURCES += posix/src/killinfo.c
 librtemscpu_a_SOURCES += posix/src/kill_r.c
-librtemscpu_a_SOURCES += posix/src/mqueue.c
-librtemscpu_a_SOURCES += posix/src/mqueueclose.c
-librtemscpu_a_SOURCES += posix/src/mqueuedeletesupp.c
-librtemscpu_a_SOURCES += posix/src/mqueuegetattr.c
 librtemscpu_a_SOURCES += posix/src/mqueuenotify.c
-librtemscpu_a_SOURCES += posix/src/mqueueopen.c
-librtemscpu_a_SOURCES += posix/src/mqueuereceive.c
-librtemscpu_a_SOURCES += posix/src/mqueuerecvsupp.c
-librtemscpu_a_SOURCES += posix/src/mqueuesend.c
-librtemscpu_a_SOURCES += posix/src/mqueuesendsupp.c
-librtemscpu_a_SOURCES += posix/src/mqueuesetattr.c
-librtemscpu_a_SOURCES += posix/src/mqueuetimedreceive.c
-librtemscpu_a_SOURCES += posix/src/mqueuetimedsend.c
-librtemscpu_a_SOURCES += posix/src/mqueueunlink.c
 librtemscpu_a_SOURCES += posix/src/pause.c
 librtemscpu_a_SOURCES += posix/src/psignal.c
 librtemscpu_a_SOURCES += posix/src/psignalclearprocesssignals.c
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 78a73c8c4a..c2c6fe6507 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -33,6 +33,7 @@
 #include <rtems/score/userextimpl.h>
 #include <rtems/score/wkspace.h>
 #include <rtems/posix/key.h>
+#include <rtems/posix/mqueue.h>
 #include <rtems/posix/semaphore.h>
 #include <rtems/posix/shm.h>
 
@@ -1937,6 +1938,10 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
     #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
       rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
   #endif
+  #if !defined(CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES)
+    #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES \
+      rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
+  #endif
   #if !defined(CONFIGURE_MAXIMUM_POSIX_SEMAPHORES)
     #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES \
       rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
@@ -1961,10 +1966,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
         rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
     #endif
 */
-    #if !defined(CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES)
-      #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES \
-        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
-    #endif
   #endif /* RTEMS_POSIX_API */
 #endif /* CONFIGURE_UNLIMITED_OBJECTS */
 
@@ -2308,6 +2309,22 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
     + _Configure_Max_Objects(_number) \
       * _Configure_From_workspace(_POSIX_PATH_MAX + 1))
 
+/**
+ * This configuration parameter specifies the maximum number of
+ * POSIX API message queues.
+ */
+#ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
+  #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 0
+#endif
+
+/*
+ * This macro is calculated to specify the memory required for
+ * POSIX API message queues.
+ */
+#define _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
+  _Configure_POSIX_Named_Object_RAM( \
+     _message_queues, sizeof(POSIX_Message_queue_Control) )
+
 /**
  * This configuration parameter specifies the maximum number of
  * POSIX API semaphores.
@@ -2345,8 +2362,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
 #ifdef RTEMS_POSIX_API
   #include <sys/types.h>
   #include <signal.h>
-  #include <mqueue.h>
-  #include <rtems/posix/mqueue.h>
   #include <rtems/posix/psignal.h>
   #include <rtems/posix/pthread.h>
   #include <rtems/posix/threadsup.h>
@@ -2391,22 +2406,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
     _Configure_From_workspace( \
       (_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) )
 
-  /**
-   * This configuration parameter specifies the maximum number of
-   * POSIX API message queues.
-   */
-  #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
-    #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES                     0
-  #endif
-
-  /*
-   * This macro is calculated to specify the memory required for
-   * POSIX API message queues.
-   */
-  #define _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \
-    _Configure_POSIX_Named_Object_RAM( \
-       _message_queues, sizeof(POSIX_Message_queue_Control) )
-
   #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
     #ifndef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
       #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
@@ -2545,8 +2544,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
   #define _CONFIGURE_MEMORY_FOR_POSIX \
     (_CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
         CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS) + \
-      _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
-        CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) + \
       _CONFIGURE_MEMORY_FOR_POSIX_TIMERS(CONFIGURE_MAXIMUM_POSIX_TIMERS))
 #else
   /*
@@ -2705,6 +2702,8 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
    _CONFIGURE_MEMORY_FOR_POSIX_KEYS( \
       _CONFIGURE_POSIX_KEYS, \
       CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ) + \
+   _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
+     CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) + \
    _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \
      CONFIGURE_MAXIMUM_POSIX_SEMAPHORES) + \
    _CONFIGURE_MEMORY_FOR_POSIX_SHMS( \
@@ -3211,8 +3210,8 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
 #ifdef RTEMS_POSIX_API
     uint32_t POSIX_TIMERS;
     uint32_t POSIX_QUEUED_SIGNALS;
-    uint32_t POSIX_MESSAGE_QUEUES;
 #endif
+    uint32_t POSIX_MESSAGE_QUEUES;
     uint32_t POSIX_SEMAPHORES;
     uint32_t POSIX_SHMS;
 
@@ -3259,9 +3258,9 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
     _CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ),
     _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
       CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
+#endif
     _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(
       CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ),
-#endif
     _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ),
     _CONFIGURE_MEMORY_FOR_POSIX_SHMS( CONFIGURE_MAXIMUM_POSIX_SHMS ),
 
@@ -3327,7 +3326,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
   #if ((CONFIGURE_MAXIMUM_POSIX_THREADS != 0) || \
        (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
        (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
-       (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES != 0) || \
       defined(CONFIGURE_POSIX_INIT_THREAD_TABLE))
   #error "CONFIGURATION ERROR: POSIX API support not configured!!"
   #endif
diff --git a/cpukit/include/rtems/score/coremsg.h b/cpukit/include/rtems/score/coremsg.h
index 8d25529fdc..e0a7e05bbf 100644
--- a/cpukit/include/rtems/score/coremsg.h
+++ b/cpukit/include/rtems/score/coremsg.h
@@ -38,14 +38,12 @@ extern "C" {
  */
 /**@{*/
 
-#if defined(RTEMS_POSIX_API)
-  /**
-   *  This macro is defined when an API is enabled that requires that the
-   *  Message Queue Handler include support for priority based enqueuing
-   *  of messages.
-   */
-  #define RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY
-#endif
+/**
+ *  This macro is defined when an API is enabled that requires that the
+ *  Message Queue Handler include support for priority based enqueuing
+ *  of messages.
+ */
+#define RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY
 
 #if defined(RTEMS_POSIX_API)
   /**
@@ -56,13 +54,11 @@ extern "C" {
   #define RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION
 #endif
 
-#if defined(RTEMS_POSIX_API)
-  /**
-   *  This macro is defined when an API is enabled that requires the
-   *  Message Queue Handler include support for blocking send operations.
-   */
-  #define RTEMS_SCORE_COREMSG_ENABLE_BLOCKING_SEND
-#endif
+/**
+ *  This macro is defined when an API is enabled that requires the
+ *  Message Queue Handler include support for blocking send operations.
+ */
+#define RTEMS_SCORE_COREMSG_ENABLE_BLOCKING_SEND
 
 typedef struct CORE_message_queue_Control CORE_message_queue_Control;
 
diff --git a/cpukit/rtems/src/rtemsobjectgetapiclassname.c b/cpukit/rtems/src/rtemsobjectgetapiclassname.c
index 61ca90fe7e..3f26f2f25b 100644
--- a/cpukit/rtems/src/rtemsobjectgetapiclassname.c
+++ b/cpukit/rtems/src/rtemsobjectgetapiclassname.c
@@ -47,8 +47,8 @@ static const rtems_assoc_t rtems_object_api_posix_assoc[] = {
   { "Thread",                  OBJECTS_POSIX_THREADS, 0},
   { "Key",                     OBJECTS_POSIX_KEYS, 0},
   { "Interrupt",               OBJECTS_POSIX_INTERRUPTS, 0},
-  { "Message Queue",           OBJECTS_POSIX_MESSAGE_QUEUES, 0},
 #endif
+  { "Message Queue",           OBJECTS_POSIX_MESSAGE_QUEUES, 0},
   { "Semaphore",               OBJECTS_POSIX_SEMAPHORES, 0},
 #ifdef RTEMS_POSIX_API
   { "Timer",                   OBJECTS_POSIX_TIMERS, 0},
-- 
2.16.4




More information about the devel mailing list