OSDN Git Service

use arch specific thread stack size for nptl
authorWaldemar Brodkorb <wbx@uclibc-ng.org>
Tue, 22 Dec 2015 09:51:13 +0000 (10:51 +0100)
committerWaldemar Brodkorb <wbx@uclibc-ng.org>
Sat, 26 Dec 2015 19:24:09 +0000 (20:24 +0100)
Use the arch specific thread stack size for nptl if the size
returned by getrlimits exceeds it - fixes threads on systems
with only 16 MB RAM.

Patch from OpenWRT

Reported-by: Leonid Lisovskiy <lly.dev@gmail.com>
libpthread/nptl/init.c

index bcd49ed..776bec7 100644 (file)
@@ -382,6 +382,10 @@ __pthread_initialize_minimal_internal (void)
        Use the minimal size acceptable.  */
     limit.rlim_cur = PTHREAD_STACK_MIN;
 
+  /* Do not exceed architecture specific default */
+  if (limit.rlim_cur > ARCH_STACK_DEFAULT_SIZE)
+    limit.rlim_cur = ARCH_STACK_DEFAULT_SIZE;
+
   /* Make sure it meets the minimum size that allocate_stack
      (allocatestack.c) will demand, which depends on the page size.  */
   const uintptr_t pagesz = sysconf (_SC_PAGESIZE);