summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_init.c
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2005-02-13 18:38:06 +0000
committerdeischen <deischen@FreeBSD.org>2005-02-13 18:38:06 +0000
commitb08240453920c3b01dccdfdcaf4ead51c8751139 (patch)
tree20b27889e6160d6fd92154986ae191b4512a1d3f /lib/libpthread/thread/thr_init.c
parent19a07769b7834a686b200b4794c15b3711867a2b (diff)
downloadFreeBSD-src-b08240453920c3b01dccdfdcaf4ead51c8751139.zip
FreeBSD-src-b08240453920c3b01dccdfdcaf4ead51c8751139.tar.gz
Increase the default stacksizes:
32-bit 64-bit main thread 2MB 4MB other threads 1MB 2MB
Diffstat (limited to 'lib/libpthread/thread/thr_init.c')
-rw-r--r--lib/libpthread/thread/thr_init.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/libpthread/thread/thr_init.c b/lib/libpthread/thread/thr_init.c
index 6d41087..3272365 100644
--- a/lib/libpthread/thread/thr_init.c
+++ b/lib/libpthread/thread/thr_init.c
@@ -337,7 +337,7 @@ init_main_thread(struct pthread *thread)
* resource limits, so this stack needs an explicitly mapped
* red zone to protect the thread stack that is just beyond.
*/
- if (mmap((void *)_usrstack - THR_STACK_INITIAL -
+ if (mmap((void *)_usrstack - _thr_stack_initial -
_thr_guard_default, _thr_guard_default, 0, MAP_ANON,
-1, 0) == MAP_FAILED)
PANIC("Cannot allocate red zone for initial thread");
@@ -351,8 +351,8 @@ init_main_thread(struct pthread *thread)
* actually free() it; it just puts it in the free
* stack queue for later reuse.
*/
- thread->attr.stackaddr_attr = (void *)_usrstack - THR_STACK_INITIAL;
- thread->attr.stacksize_attr = THR_STACK_INITIAL;
+ thread->attr.stackaddr_attr = (void *)_usrstack - _thr_stack_initial;
+ thread->attr.stacksize_attr = _thr_stack_initial;
thread->attr.guardsize_attr = _thr_guard_default;
thread->attr.flags |= THR_STACK_USER;
@@ -427,6 +427,14 @@ init_private(void)
_thr_page_size = getpagesize();
_thr_guard_default = _thr_page_size;
+ if (sizeof(void *) == 8) {
+ _thr_stack_default = THR_STACK64_DEFAULT;
+ _thr_stack_initial = THR_STACK64_INITIAL;
+ }
+ else {
+ _thr_stack_default = THR_STACK32_DEFAULT;
+ _thr_stack_initial = THR_STACK32_INITIAL;
+ }
init_once = 1; /* Don't do this again. */
} else {
/*
OpenPOWER on IntegriCloud