summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKurt Miller <kurt@cvs.openbsd.org>2013-03-31 22:43:54 +0000
committerKurt Miller <kurt@cvs.openbsd.org>2013-03-31 22:43:54 +0000
commite4634646f505e0228ddae09c9f311f6b1f060489 (patch)
treeef9ca18862b8fe80778f01b3cec58eef7dc97eed /lib
parent057ba21af51c17a2a371f134dbb215e00362bb53 (diff)
- 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@
Diffstat (limited to 'lib')
-rw-r--r--lib/librthread/rthread_np.c11
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) {