Module: xenomai-forge
Branch: master
Commit: 1c32574922c29ca70e561717420386687ffc06fd
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=1c32574922c29ca70e561717420386687ffc06fd

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Fri Dec 27 20:02:37 2013 +0100

switchtest: avoid printf stack overflow

---

 testsuite/switchtest/switchtest.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/testsuite/switchtest/switchtest.c 
b/testsuite/switchtest/switchtest.c
index 1419988..f39dc9e 100644
--- a/testsuite/switchtest/switchtest.c
+++ b/testsuite/switchtest/switchtest.c
@@ -85,6 +85,11 @@ static unsigned long data_lines = 21;
 static unsigned freeze_on_error;
 static int fp_features;
 
+static inline unsigned stack_size(unsigned size)
+{
+       return size > PTHREAD_STACK_MIN ? size : PTHREAD_STACK_MIN;
+}
+
 static inline void clean_exit(int retval)
 {
        status = retval;
@@ -833,7 +838,7 @@ static int task_create(struct cpu_tasks *cpu,
                pthread_attr_t attr;
 
                pthread_attr_init(&attr);
-               pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
+               pthread_attr_setstacksize(&attr, stack_size(32768));
 
                err = __STD(pthread_create(&param->thread,
                                           &attr,
@@ -853,7 +858,7 @@ static int task_create(struct cpu_tasks *cpu,
                pthread_attr_t attr;
 
                pthread_attr_init(&attr);
-               pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN * 2);
+               pthread_attr_setstacksize(&attr, stack_size(65536));
 
                err = __STD(pthread_create(&param->thread,
                                           &attr,


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to