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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Jul 16 15:43:06 2009 +0200

testsuite: do not specify stack sizes lower than PTHREAD_STACK_MIN

Since the glibc tends to increase PTHREAD_STACK_MIN over time, make
sure to always request at least PTHREAD_STACK_MIN bytes for thread
stacks, so the silly default rounding to 8Mb won't be applied.

---

 src/testsuite/switchtest/switchtest.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/testsuite/switchtest/switchtest.c 
b/src/testsuite/switchtest/switchtest.c
index 3b85ab0..66d0eab 100644
--- a/src/testsuite/switchtest/switchtest.c
+++ b/src/testsuite/switchtest/switchtest.c
@@ -43,6 +43,18 @@ typedef unsigned long cpu_set_t;
 #define smp_sched_setaffinity(pid,len,mask) 0
 #endif /* !CONFIG_SMP */
 
+#if PTHREAD_STACK_MIN < 20 * 1024
+#define SMALL_STACK_MIN  20 * 1024
+#else
+#define SMALL_STACK_MIN  PTHREAD_STACK_MIN
+#endif
+
+#if PTHREAD_STACK_MIN < 50 * 1024
+#define LARGE_STACK_MIN  50 * 1024
+#else
+#define LARGE_STACK_MIN  PTHREAD_STACK_MIN
+#endif
+
 /* Thread type. */
 typedef enum {
        SLEEPER = 0,
@@ -827,7 +839,7 @@ static int task_create(struct cpu_tasks *cpu,
                pthread_attr_t attr;
 
                pthread_attr_init(&attr);
-               pthread_attr_setstacksize(&attr, 20 * 1024);
+               pthread_attr_setstacksize(&attr, SMALL_STACK_MIN);
 
                err = __real_pthread_create(&param->thread,
                                            &attr,
@@ -847,7 +859,7 @@ static int task_create(struct cpu_tasks *cpu,
                pthread_attr_t attr;
 
                pthread_attr_init(&attr);
-               pthread_attr_setstacksize(&attr, 50 * 1024);
+               pthread_attr_setstacksize(&attr, LARGE_STACK_MIN);
 
                err = __real_pthread_create(&param->thread,
                                            &attr,
@@ -1354,7 +1366,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, 20 * 1024);
+       pthread_attr_setstacksize(&rt_attr, SMALL_STACK_MIN);
 
        printf("== Threads:");
        /* Create and register all tasks. */


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to