summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2015-12-22 10:51:13 +0100
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2015-12-22 10:54:49 +0100
commit74b17c7956b8f0bd109b0fd26a8a9869441d09bf (patch)
tree94f878255b1cb6767f582170568c5f221a3caebc
parent73491f469c244ec077e8448d41c4e193b6a3599b (diff)
use arch specific thread stack size for nptl
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>
-rw-r--r--libpthread/nptl/init.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c
index bcd49edff..776bec755 100644
--- a/libpthread/nptl/init.c
+++ b/libpthread/nptl/init.c
@@ -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);