summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_stack.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-08-16 08:38:53 +0000
committerkib <kib@FreeBSD.org>2014-08-16 08:38:53 +0000
commit9cb3300d8873288618caa26042799d0bbbdfce49 (patch)
tree8a66b6dc583fede70780e314a93a3b4ab8bfb036 /lib/libthr/thread/thr_stack.c
parent6f9f1bcfb80d50fe7cd46c63ecb4c5fbad2a59ed (diff)
downloadFreeBSD-src-9cb3300d8873288618caa26042799d0bbbdfce49.zip
FreeBSD-src-9cb3300d8873288618caa26042799d0bbbdfce49.tar.gz
MFC r269909:
Add a knob LIBPTHREAD_BIGSTACK_MAIN, which instructs libthr to leave the whole RLIMIT_STACK-sized region of the kernel-allocated stack as the stack of main thread.
Diffstat (limited to 'lib/libthr/thread/thr_stack.c')
-rw-r--r--lib/libthr/thread/thr_stack.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_stack.c b/lib/libthr/thread/thr_stack.c
index 5f8cd4e..e5d149e 100644
--- a/lib/libthr/thread/thr_stack.c
+++ b/lib/libthr/thread/thr_stack.c
@@ -246,7 +246,10 @@ _thr_stack_alloc(struct pthread_attr *attr)
THREAD_LIST_UNLOCK(curthread);
}
else {
- /* Allocate a stack from usrstack. */
+ /*
+ * Allocate a stack from or below usrstack, depending
+ * on the LIBPTHREAD_BIGSTACK_MAIN env variable.
+ */
if (last_stack == NULL)
last_stack = _usrstack - _thr_stack_initial -
_thr_guard_default;
OpenPOWER on IntegriCloud