about summary refs log tree commit diff
path: root/support/support_set_small_thread_stack_size.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-12-29 11:52:41 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-01-05 11:33:16 -0300
commitecdb06cdf22c7d37699f5420265245ff31c53b3c (patch)
treedeeeefe82be1af64318f0b722a037f0c336e9fee /support/support_set_small_thread_stack_size.c
parentc6e0b0b5b0b7922cdf0dce2af671e0c7e500df95 (diff)
downloadglibc-ecdb06cdf22c7d37699f5420265245ff31c53b3c.tar.gz
glibc-ecdb06cdf22c7d37699f5420265245ff31c53b3c.tar.xz
glibc-ecdb06cdf22c7d37699f5420265245ff31c53b3c.zip
support: Add support_small_thread_stack_size
It returns the minimum stack size large enough to cover most internal
glibc stack usage.
Diffstat (limited to 'support/support_set_small_thread_stack_size.c')
-rw-r--r--support/support_set_small_thread_stack_size.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/support/support_set_small_thread_stack_size.c b/support/support_set_small_thread_stack_size.c
index 3b0426e28e..faa2e2f857 100644
--- a/support/support_set_small_thread_stack_size.c
+++ b/support/support_set_small_thread_stack_size.c
@@ -20,8 +20,8 @@
 #include <pthread.h>
 #include <support/xthread.h>
 
-void
-support_set_small_thread_stack_size (pthread_attr_t *attr)
+size_t
+support_small_thread_stack_size (void)
 {
   /* Some architectures have too small values for PTHREAD_STACK_MIN
      which cannot be used for creating threads.  Ensure that the stack
@@ -31,5 +31,11 @@ support_set_small_thread_stack_size (pthread_attr_t *attr)
   if (stack_size < PTHREAD_STACK_MIN)
     stack_size = PTHREAD_STACK_MIN;
 #endif
-  xpthread_attr_setstacksize (attr, stack_size);
+  return stack_size;
+}
+
+void
+support_set_small_thread_stack_size (pthread_attr_t *attr)
+{
+  xpthread_attr_setstacksize (attr, support_small_thread_stack_size ());
 }