[PATCH 01/11] confdefs.h: Fix named object size estimate

Sebastian Huber sebastian.huber at embedded-brains.de
Tue May 3 12:49:37 UTC 2016


Account for the terminating null character.  Use _POSIX_PATH_MAX instead
of NAME_MAX according to _POSIX_Semaphore_Manager_initialization() and
_POSIX_Message_queue_Manager_initialization().
---
 cpukit/sapi/include/confdefs.h         |  5 +++--
 testsuites/psxtests/psxconfig01/init.c | 10 +++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index ceed2a4..e4e5331 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -2514,8 +2514,9 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
    * This is an internal macro.
    */
   #define _Configure_POSIX_Named_Object_RAM(_number, _size) \
-    _Configure_Object_RAM( (_number), _size ) + \
-    (_Configure_Max_Objects(_number) * _Configure_From_workspace(NAME_MAX) )
+    (_Configure_Object_RAM(_number, _size) \
+      + _Configure_Max_Objects(_number) \
+        * _Configure_From_workspace(_POSIX_PATH_MAX + 1))
 
   /**
    * This configuration parameter specifies the maximum number of
diff --git a/testsuites/psxtests/psxconfig01/init.c b/testsuites/psxtests/psxconfig01/init.c
index 1edd9ba..9f3c134 100644
--- a/testsuites/psxtests/psxconfig01/init.c
+++ b/testsuites/psxtests/psxconfig01/init.c
@@ -200,7 +200,7 @@ typedef struct {
   static area region_areas [CONFIGURE_MAXIMUM_REGIONS];
 #endif
 
-static char posix_name [NAME_MAX];
+static char posix_name [_POSIX_PATH_MAX + 1];
 
 #if !defined(RTEMS_SMP)
   static void *task_var;
@@ -208,10 +208,10 @@ static char posix_name [NAME_MAX];
 
 static char *get_posix_name(char a, char b, char c, int i)
 {
-  posix_name [NAME_MAX - 5] = a;
-  posix_name [NAME_MAX - 4] = b;
-  posix_name [NAME_MAX - 3] = c;
-  posix_name [NAME_MAX - 2] = 'A' + i;
+  posix_name [_POSIX_PATH_MAX - 4] = a;
+  posix_name [_POSIX_PATH_MAX - 3] = b;
+  posix_name [_POSIX_PATH_MAX - 2] = c;
+  posix_name [_POSIX_PATH_MAX - 1] = 'A' + i;
 
   return posix_name;
 }
-- 
1.8.4.5



More information about the devel mailing list