Module: xenomai-jki Branch: for-forge Commit: 141f0e5da9da0a0b2cd587b56045c5dbf1d8a3cd URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=141f0e5da9da0a0b2cd587b56045c5dbf1d8a3cd
Author: Jan Kiszka <jan.kis...@siemens.com> Date: Tue Apr 21 15:54:16 2015 +0200 lib/cobalt: Set minimum stack size to PTHREAD_STACK_MIN * 2 The additional page requested as minimum size is ignored by glibc. At the same time, we depend on a larger minimum size in case some thread trampoline triggers more complex libc function, e.g. a warning printout. Raise the minimum to two times the platform limit. Signed-off-by: Jan Kiszka <jan.kis...@siemens.com> --- demo/posix/can-rtt.c | 2 +- doc/asciidoc/MIGRATION.adoc | 2 +- lib/cobalt/internal.c | 5 +---- testsuite/switchtest/switchtest.c | 4 ++-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/demo/posix/can-rtt.c b/demo/posix/can-rtt.c index 544b710..bd44316 100644 --- a/demo/posix/can-rtt.c +++ b/demo/posix/can-rtt.c @@ -343,7 +343,7 @@ int main(int argc, char *argv[]) /* Create receiver RT-thread */ pthread_attr_init(&thattr); pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_JOINABLE); - pthread_attr_setstacksize(&thattr, PTHREAD_STACK_MIN); + pthread_attr_setstacksize(&thattr, PTHREAD_STACK_MIN * 2); ret = pthread_create(&rxthread, &thattr, &receiver, NULL); if (ret) { fprintf(stderr, "%s: pthread_create(receiver) failed\n", diff --git a/doc/asciidoc/MIGRATION.adoc b/doc/asciidoc/MIGRATION.adoc index 05a3cca..675e7ce 100644 --- a/doc/asciidoc/MIGRATION.adoc +++ b/doc/asciidoc/MIGRATION.adoc @@ -1352,7 +1352,7 @@ out the delayed Xenomai thread indefinitely. - The default POSIX thread stack size was raised to `PTHREAD_STACK_MIN * 4`. The minimum stack size enforced by the - +libcobalt+ library is `PTHREAD_STACK_MIN + getpagesize()`. + +libcobalt+ library is `PTHREAD_STACK_MIN * 2`. - pthread_set_name_np() has been renamed to pthread_setname_np() with the same arguments, to conform with the GNU extension equivalent. diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c index cf2971a..83dd219 100644 --- a/lib/cobalt/internal.c +++ b/lib/cobalt/internal.c @@ -146,10 +146,7 @@ int cobalt_serial_debug(const char *fmt, ...) size_t cobalt_get_stacksize(size_t size) { static const size_t default_size = PTHREAD_STACK_MIN * 4; - static size_t min_size; - - if (min_size == 0) - min_size = PTHREAD_STACK_MIN + getpagesize(); + static const size_t min_size = PTHREAD_STACK_MIN * 2; if (size == 0) size = default_size; diff --git a/testsuite/switchtest/switchtest.c b/testsuite/switchtest/switchtest.c index 5c5d6ae..9a0fac3 100644 --- a/testsuite/switchtest/switchtest.c +++ b/testsuite/switchtest/switchtest.c @@ -87,7 +87,7 @@ static int fp_features; static inline unsigned stack_size(unsigned size) { - return size > PTHREAD_STACK_MIN ? size : PTHREAD_STACK_MIN; + return size > PTHREAD_STACK_MIN * 2 ? size : PTHREAD_STACK_MIN * 2; } static inline void clean_exit(int retval) @@ -1371,7 +1371,7 @@ int main(int argc, const char *argv[]) pthread_attr_setschedpolicy(&rt_attr, SCHED_FIFO); sp.sched_priority = 1; pthread_attr_setschedparam(&rt_attr, &sp); - pthread_attr_setstacksize(&rt_attr, PTHREAD_STACK_MIN); + pthread_attr_setstacksize(&rt_attr, PTHREAD_STACK_MIN * 2); if (quiet < 2) printf("== Threads:"); _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git