diff options
author | peter <peter@FreeBSD.org> | 2001-10-26 21:19:22 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2001-10-26 21:19:22 +0000 |
commit | 14e9bfa8fe88e6350016240194199cefbd2c3d47 (patch) | |
tree | eecbcf12bbd3734f9d86b3bf3acdc1a2169fece3 /lib/libpthread/thread/thr_stack.c | |
parent | 6d1df6cd852ab6f870e101152652f0aaad76b1bc (diff) | |
download | FreeBSD-src-14e9bfa8fe88e6350016240194199cefbd2c3d47.zip FreeBSD-src-14e9bfa8fe88e6350016240194199cefbd2c3d47.tar.gz |
Make libc_r check the kern.usrstack sysctl instead of using internal
kernel #defines to figure out where the stack is located. This stops
libc_r from exploding when the kernel is compiled with a different
KVM size. IMHO this is all kinda bogus, it would be better to just
check %esp and work from that.
Diffstat (limited to 'lib/libpthread/thread/thr_stack.c')
-rw-r--r-- | lib/libpthread/thread/thr_stack.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libpthread/thread/thr_stack.c b/lib/libpthread/thread/thr_stack.c index 055af07..86f0a2d 100644 --- a/lib/libpthread/thread/thr_stack.c +++ b/lib/libpthread/thread/thr_stack.c @@ -112,8 +112,7 @@ static LIST_HEAD(, stack) _mstackq = LIST_HEAD_INITIALIZER(_mstackq); * high memory * */ -static void * last_stack = (void *) USRSTACK - PTHREAD_STACK_INITIAL - - PTHREAD_GUARD_DEFAULT; +static void * last_stack; void * _thread_stack_alloc(size_t stacksize, size_t guardsize) @@ -186,8 +185,11 @@ _thread_stack_alloc(size_t stacksize, size_t guardsize) /* Check if a stack was not allocated from a stack cache: */ if (stack == NULL) { - /* Allocate a new stack. */ + if (last_stack == NULL) + last_stack = _usrstack - PTHREAD_STACK_INITIAL - + PTHREAD_GUARD_DEFAULT; + /* Allocate a new stack. */ stack = last_stack - stack_size; /* |