diff options
author | 2013-03-31 22:43:53 +0000 | |
---|---|---|
committer | 2013-03-31 22:43:53 +0000 | |
commit | 45b73353c116c644443aa7becf79d7bc8cdf1e0d (patch) | |
tree | 26c69a307b960fc874259d302218d11d8781a2a0 | |
parent | More SYNOPSIS, ERRORS, and STANDARDS updates (diff) | |
download | wireguard-openbsd-45b73353c116c644443aa7becf79d7bc8cdf1e0d.tar.xz wireguard-openbsd-45b73353c116c644443aa7becf79d7bc8cdf1e0d.zip |
- Don't include guard pages in the stack size.
From Christian Schulte (cs at schulte.it)
- Use stack->sp instead of recalculating it. From guenther@
okay guenther@
-rw-r--r-- | lib/librthread/rthread_np.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/librthread/rthread_np.c b/lib/librthread/rthread_np.c index 728d0fc73b9..03c6fdb6a08 100644 --- a/lib/librthread/rthread_np.c +++ b/lib/librthread/rthread_np.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_np.c,v 1.7 2012/02/18 21:12:09 guenther Exp $ */ +/* $OpenBSD: rthread_np.c,v 1.8 2013/03/31 22:43:53 kurt Exp $ */ /* * Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org> * Copyright (c) 2005 Otto Moerbeek <otto@openbsd.org> @@ -60,17 +60,14 @@ pthread_main_np(void) int pthread_stackseg_np(pthread_t thread, stack_t *sinfo) { - char *base; int ret; struct rlimit rl; if (thread->stack) { - base = thread->stack->base; -#if !defined(MACHINE_STACK_GROWS_UP) - base += (ptrdiff_t)thread->stack->len; -#endif - sinfo->ss_sp = base; + sinfo->ss_sp = thread->stack->sp; sinfo->ss_size = thread->stack->len; + if (thread->stack->guardsize != 1) + sinfo->ss_size -= thread->stack->guardsize; sinfo->ss_flags = 0; ret = 0; } else if (thread == &_initial_thread) { |