File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 1
- /* $OpenBSD: rthread_np.c,v 1.10 2013/11/29 16:27:40 guenther Exp $ */
1
+ /* $OpenBSD: rthread_np.c,v 1.11 2014/05/02 21:58:51 kurt Exp $ */
2
2
/*
3
3
* Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org>
4
4
* Copyright (c) 2005 Otto Moerbeek <otto@openbsd.org>
24
24
#include <sys/queue.h>
25
25
#include <sys/sysctl.h>
26
26
27
+ #include <inttypes.h>
27
28
#include <errno.h>
28
29
#include <pthread.h>
29
30
#include <pthread_np.h>
63
64
pthread_stackseg_np (pthread_t thread , stack_t * sinfo )
64
65
{
65
66
if (thread -> stack ) {
66
- sinfo -> ss_sp = thread -> stack -> sp ;
67
+ #ifdef MACHINE_STACK_GROWS_UP
68
+ sinfo -> ss_sp = thread -> stack -> base ;
69
+ #else
70
+ sinfo -> ss_sp = thread -> stack -> base + thread -> stack -> len ;
71
+ #endif
67
72
sinfo -> ss_size = thread -> stack -> len ;
68
73
if (thread -> stack -> guardsize != 1 )
69
74
sinfo -> ss_size -= thread -> stack -> guardsize ;
@@ -93,10 +98,12 @@ pthread_stackseg_np(pthread_t thread, stack_t *sinfo)
93
98
* Provides a rough estimation of stack bounds. Caller
94
99
* likely wants to know for the purpose of inspecting call
95
100
* frames, but VM_PSSTRINGS points to process arguments...
96
- *
97
- * XXXX This interface ignores MACHINE_STACK_GROWS_UP.
98
101
*/
102
+ #ifdef MACHINE_STACK_GROWS_UP
99
103
sinfo -> ss_sp = _ps .val ;
104
+ #else
105
+ sinfo -> ss_sp = (void * )ROUND_TO_PAGE ((uintptr_t )_ps .val );
106
+ #endif
100
107
sinfo -> ss_size = (size_t )rl .rlim_cur ;
101
108
sinfo -> ss_flags = 0 ;
102
109
return (0 );
You can’t perform that action at this time.
0 commit comments