about summary refs log tree commit diff
path: root/nptl/tst-tls3.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/tst-tls3.c')
-rw-r--r--nptl/tst-tls3.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/nptl/tst-tls3.c b/nptl/tst-tls3.c
index 982c1fdd4c..649cb8f0d5 100644
--- a/nptl/tst-tls3.c
+++ b/nptl/tst-tls3.c
@@ -29,6 +29,11 @@
 
 #define THE_SIG SIGUSR1
 
+/* The stack size can be overriden.  With a sufficiently large stack
+   size, thread stacks for terminated threads are freed, but this does
+   not happen with the default size of 1 MiB.  */
+enum { default_stack_size_in_mb = 1 };
+static long stack_size_in_mb;
 
 #define N 10
 static pthread_t th[N];
@@ -72,6 +77,9 @@ int nsigs;
 int
 do_test (void)
 {
+  if (stack_size_in_mb == 0)
+    stack_size_in_mb = default_stack_size_in_mb;
+
   if ((uintptr_t) pthread_self () & (TCB_ALIGNMENT - 1))
     {
       puts ("initial thread's struct pthread not aligned enough");
@@ -127,7 +135,7 @@ do_test (void)
       exit (1);
     }
 
-  if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0)
+  if (pthread_attr_setstacksize (&a, stack_size_in_mb * 1024 * 1024) != 0)
     {
       puts ("attr_setstacksize failed");
       return 1;