<div dir="ltr">This seems reasonable. <div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 7, 2018 at 1:00 AM, Sebastian Huber <span dir="ltr"><<a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Make CONFIGURE_MINIMUM_POSIX_<wbr>THREAD_STACK_SIZE configurable by the user.<br>
<br>
Update #3434.<br>
---<br>
cpukit/include/rtems/confdefs.<wbr>h | 5 +++++<br>
cpukit/include/rtems/posix/<wbr>pthread.h | 2 ++<br>
cpukit/include/rtems/posix/<wbr>pthreadimpl.h | 2 +-<br>
testsuites/psxtests/<wbr>psxconfig01/init.c | 17 +++++++++++++++++<br>
4 files changed, 25 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/cpukit/include/rtems/<wbr>confdefs.h b/cpukit/include/rtems/<wbr>confdefs.h<br>
index 6e7bcdf570..8119436e7c 100644<br>
--- a/cpukit/include/rtems/<wbr>confdefs.h<br>
+++ b/cpukit/include/rtems/<wbr>confdefs.h<br>
@@ -1165,8 +1165,10 @@ extern rtems_initialization_tasks_<wbr>table Initialization_tasks[];<br>
* This specifies the default POSIX thread stack size. By default, it is<br>
* twice that recommended for the port.<br>
*/<br>
+#ifndef CONFIGURE_MINIMUM_POSIX_<wbr>THREAD_STACK_SIZE<br>
#define CONFIGURE_MINIMUM_POSIX_<wbr>THREAD_STACK_SIZE \<br>
(2 * CONFIGURE_MINIMUM_TASK_STACK_<wbr>SIZE)<br>
+#endif<br>
<br>
/**<br>
* @brief Idle task stack size configuration.<br>
@@ -3050,6 +3052,9 @@ extern rtems_initialization_tasks_<wbr>table Initialization_tasks[];<br>
CONFIGURE_POSIX_INIT_THREAD_<wbr>TABLE_SIZE,<br>
CONFIGURE_POSIX_INIT_THREAD_<wbr>TABLE_NAME<br>
};<br>
+<br>
+ size_t _Configuration_POSIX_Minimum_<wbr>stack_size =<br>
+ CONFIGURE_MINIMUM_POSIX_<wbr>THREAD_STACK_SIZE;<br>
#endif<br>
<br>
/**<br>
diff --git a/cpukit/include/rtems/posix/<wbr>pthread.h b/cpukit/include/rtems/posix/<wbr>pthread.h<br>
index 05783ff4ad..818d0f89d0 100644<br>
--- a/cpukit/include/rtems/posix/<wbr>pthread.h<br>
+++ b/cpukit/include/rtems/posix/<wbr>pthread.h<br>
@@ -37,6 +37,8 @@ extern "C" {<br>
*/<br>
/**@{**/<br>
<br>
+extern size_t _Configuration_POSIX_Minimum_<wbr>stack_size;<br>
+<br>
/**<br>
* @brief POSIX threads initialize user threads body.<br>
*<br>
diff --git a/cpukit/include/rtems/posix/<wbr>pthreadimpl.h b/cpukit/include/rtems/posix/<wbr>pthreadimpl.h<br>
index e6ed1b8990..d900207fbd 100644<br>
--- a/cpukit/include/rtems/posix/<wbr>pthreadimpl.h<br>
+++ b/cpukit/include/rtems/posix/<wbr>pthreadimpl.h<br>
@@ -40,7 +40,7 @@ extern "C" {<br>
/**<br>
* The following sets the minimum stack size for POSIX threads.<br>
*/<br>
-#define PTHREAD_MINIMUM_STACK_SIZE (_Stack_Minimum() * 2)<br>
+#define PTHREAD_MINIMUM_STACK_SIZE _Configuration_POSIX_Minimum_<wbr>stack_size<br>
<br>
/**<br>
* The following defines the information control block used to manage<br>
diff --git a/testsuites/psxtests/<wbr>psxconfig01/init.c b/testsuites/psxtests/<wbr>psxconfig01/init.c<br>
index 910932a997..70e489823b 100644<br>
--- a/testsuites/psxtests/<wbr>psxconfig01/init.c<br>
+++ b/testsuites/psxtests/<wbr>psxconfig01/init.c<br>
@@ -25,6 +25,8 @@<br>
#include "config.h"<br>
#endif<br>
<br>
+#define _GNU_SOURCE<br>
+<br>
#include <rtems/test.h><br>
#include <tmacros.h><br>
<br>
@@ -65,6 +67,8 @@ const char rtems_test_name[] = "PSXCONFIG 1";<br>
#define CONFIGURE_MAXIMUM_POSIX_<wbr>SEMAPHORES 41<br>
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION<br>
<br>
+#define CONFIGURE_MINIMUM_POSIX_<wbr>THREAD_STACK_SIZE CPU_STACK_MINIMUM_SIZE<br>
+<br>
#define CONFIGURE_MAXIMUM_POSIX_<wbr>THREADS 3<br>
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 47<br>
<br>
@@ -462,8 +466,21 @@ static rtems_task Init(rtems_task_argument argument)<br>
#ifdef CONFIGURE_MAXIMUM_POSIX_<wbr>THREADS<br>
for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_<wbr>THREADS; ++i) {<br>
pthread_t thread;<br>
+ pthread_attr_t attr;<br>
+ size_t stack_size;<br>
+<br>
eno = pthread_create(&thread, NULL, posix_thread, NULL);<br>
rtems_test_assert(eno == 0);<br>
+<br>
+ eno = pthread_getattr_np(thread, &attr);<br>
+ rtems_test_assert(eno == 0);<br>
+<br>
+ eno = pthread_attr_getstacksize(&<wbr>attr, &stack_size);<br>
+ rtems_test_assert(eno == 0);<br>
+ rtems_test_assert(stack_size == CPU_STACK_MINIMUM_SIZE);<br>
+<br>
+ eno = pthread_attr_destroy(&attr);<br>
+ rtems_test_assert(eno == 0);<br>
}<br>
rtems_resource_snapshot_take(&<wbr>snapshot);<br>
rtems_test_assert(<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.13.7<br>
<br>
______________________________<wbr>_________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/<wbr>mailman/listinfo/devel</a><br>
</font></span></blockquote></div><br></div>