diff options
| author | Alfred Perlstein <alfred@FreeBSD.org> | 2002-05-13 07:58:15 +0000 |
|---|---|---|
| committer | Alfred Perlstein <alfred@FreeBSD.org> | 2002-05-13 07:58:15 +0000 |
| commit | efe5270b1ec6d15a0b954ef5fe2de004637e0c21 (patch) | |
| tree | 560dda98ad29714a8b86e7627eb2c047ba236df3 /lib/libpthread/thread/thr_init.c | |
| parent | 289fc68db6c341335038e668fcd64019bf028a1a (diff) | |
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_init.c')
| -rw-r--r-- | lib/libpthread/thread/thr_init.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/libpthread/thread/thr_init.c b/lib/libpthread/thread/thr_init.c index a3d62ae0f9da..96fa3f7e7e75 100644 --- a/lib/libpthread/thread/thr_init.c +++ b/lib/libpthread/thread/thr_init.c @@ -146,6 +146,8 @@ static void *libgcc_references[] = { &_pthread_mutex_unlock }; +int pthread_guard_default; +int pthread_page_size; /* * Threaded process initialization @@ -158,9 +160,18 @@ _thread_init(void) int i; size_t len; int mib[2]; + int sched_stack_size; /* Size of scheduler stack. */ + struct clockinfo clockinfo; struct sigaction act; + pthread_page_size = getpagesize(); + pthread_guard_default = getpagesize(); + sched_stack_size = getpagesize(); + + pthread_attr_default.guardsize_attr = pthread_guard_default; + + /* Check if this function has already been called: */ if (_thread_initial) /* Only initialise the threaded application once. */ @@ -247,7 +258,7 @@ _thread_init(void) PANIC("Cannot allocate memory for initial thread"); } /* Allocate memory for the scheduler stack: */ - else if ((_thread_kern_sched_stack = malloc(SCHED_STACK_SIZE)) == NULL) + else if ((_thread_kern_sched_stack = malloc(sched_stack_size)) == NULL) PANIC("Failed to allocate stack for scheduler"); else { /* Zero the global kernel thread structure: */ @@ -280,7 +291,7 @@ _thread_init(void) * thread stack that is just beyond. */ if (mmap(_usrstack - PTHREAD_STACK_INITIAL - - PTHREAD_GUARD_DEFAULT, PTHREAD_GUARD_DEFAULT, 0, MAP_ANON, + pthread_guard_default, pthread_guard_default, 0, MAP_ANON, -1, 0) == MAP_FAILED) PANIC("Cannot allocate red zone for initial thread"); @@ -294,7 +305,7 @@ _thread_init(void) /* Setup the context for the scheduler: */ _setjmp(_thread_kern_sched_jb); SET_STACK_JB(_thread_kern_sched_jb, _thread_kern_sched_stack + - SCHED_STACK_SIZE - sizeof(double)); + sched_stack_size - sizeof(double)); SET_RETURN_ADDR_JB(_thread_kern_sched_jb, _thread_kern_scheduler); /* |
