diff options
author | davidxu <davidxu@FreeBSD.org> | 2003-11-29 14:10:02 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2003-11-29 14:10:02 +0000 |
commit | e9f088c4690b0c842d1bca9a0dabf69d914a8c36 (patch) | |
tree | 434c3da8dfd940668f5c1602d0213214e15c8257 /lib/libpthread | |
parent | 09f2522c7f5b84b1e020559c180e2fdcc988fdf1 (diff) | |
download | FreeBSD-src-e9f088c4690b0c842d1bca9a0dabf69d914a8c36.zip FreeBSD-src-e9f088c4690b0c842d1bca9a0dabf69d914a8c36.tar.gz |
Remove surplus mmap() call for stack guard page in init_private, it is done
in init_main_thread. Also don't initialize lock and lockuser again for initial
thread, it is already done by _thr_alloc().
Reviewed by: deischen
Approved by: re (scottl)
Diffstat (limited to 'lib/libpthread')
-rw-r--r-- | lib/libpthread/thread/thr_init.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/lib/libpthread/thread/thr_init.c b/lib/libpthread/thread/thr_init.c index 76eeee4..d7c6296 100644 --- a/lib/libpthread/thread/thr_init.c +++ b/lib/libpthread/thread/thr_init.c @@ -319,8 +319,6 @@ _libpthread_init(struct pthread *curthread) static void init_main_thread(struct pthread *thread) { - int i; - /* Setup the thread attributes. */ thread->attr = _pthread_attr_default; thread->attr.flags |= PTHREAD_SCOPE_SYSTEM; @@ -383,15 +381,6 @@ init_main_thread(struct pthread *thread) /* Initialize the mutex queue: */ TAILQ_INIT(&thread->mutexq); - /* Initialize thread locking. */ - if (_lock_init(&thread->lock, LCK_ADAPTIVE, - _thr_lock_wait, _thr_lock_wakeup) != 0) - PANIC("Cannot initialize initial thread lock"); - for (i = 0; i < MAX_THR_LOCKLEVEL; i++) { - _lockuser_init(&thread->lockusers[i], (void *)thread); - _LCK_SET_PRIVATE2(&thread->lockusers[i], (void *)thread); - } - /* Initialize hooks in the thread structure: */ thread->specific = NULL; thread->cleanup = NULL; @@ -420,20 +409,6 @@ init_private(void) len = sizeof (_usrstack); if (sysctl(mib, 2, &_usrstack, &len, NULL, 0) == -1) PANIC("Cannot get kern.usrstack from sysctl"); - - /* - * Create a red zone below the main stack. All other - * stacks are constrained to a maximum size by the - * parameters passed to mmap(), but this stack is only - * limited by 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 - - _thr_guard_default, _thr_guard_default, - 0, MAP_ANON, -1, 0) == MAP_FAILED) - PANIC("Cannot allocate red zone for initial thread"); - /* Get the kernel clockrate: */ mib[0] = CTL_KERN; mib[1] = KERN_CLOCKRATE; |