1 /**
2  * \file
3  */
4 
5 #include <config.h>
6 
7 #if defined(__OpenBSD__)
8 
9 #include <pthread.h>
10 #include <pthread_np.h>
11 
12 void
mono_threads_platform_get_stack_bounds(guint8 ** staddr,size_t * stsize)13 mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
14 {
15 	/* TODO :   Determine if this code is actually still needed. It may already be covered by the case above. */
16 	pthread_attr_t attr;
17 	guint8 *current = (guint8*)&attr;
18 
19 	*staddr = NULL;
20 	*stsize = (size_t)-1;
21 
22 	pthread_attr_init (&attr);
23 
24 	stack_t ss;
25 	int rslt;
26 
27 	rslt = pthread_stackseg_np (pthread_self (), &ss);
28 	g_assert (rslt == 0);
29 
30 	*staddr = (guint8*)((size_t)ss.ss_sp - ss.ss_size);
31 	*stsize = ss.ss_size;
32 
33 	pthread_attr_destroy (&attr);
34 }
35 
36 #endif
37