Avoid leaking the vmmap allocated by the kernel for the thread_act_array_t
[mono.git] / mono / utils / mach-support.h
1 #ifndef __MONO_MACH_SUPPORT_H__
2 #define __MONO_MACH_SUPPORT_H__
3
4 #include "config.h"
5 #if defined(__MACH__)
6 #include <glib.h>
7 #include <pthread.h>
8 #include "mono/utils/mono-compiler.h"
9 #include <mach/task.h>
10 #include <mach/mach_port.h>
11 #include <mach/mach_init.h>
12 #include <mach/thread_act.h>
13 #include <mach/thread_status.h>
14
15 #if defined(__i386__) || defined (__x86_64__)
16 #define MONO_MACH_ARCH_SUPPORTED 1
17 #endif
18
19 // We need to define this here since we need _XOPEN_SOURCE for mono
20 // and the pthread header guards against this
21 extern pthread_t pthread_from_mach_thread_np(mach_port_t);
22
23 void *mono_mach_arch_get_ip (thread_state_t state) MONO_INTERNAL;
24 void *mono_mach_arch_get_sp (thread_state_t state) MONO_INTERNAL;
25
26 int mono_mach_arch_get_mcontext_size (void) MONO_INTERNAL;
27 void mono_mach_arch_thread_state_to_mcontext (thread_state_t state, mcontext_t context) MONO_INTERNAL;
28
29 int mono_mach_arch_get_thread_state_size (void) MONO_INTERNAL;
30 kern_return_t mono_mach_get_threads (thread_act_array_t *threads, guint32 *count) MONO_INTERNAL;
31 kern_return_t mono_mach_free_threads (thread_act_array_t threads, guint32 count) MONO_INTERNAL;
32 kern_return_t mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count) MONO_INTERNAL;
33 void *mono_mach_arch_get_tls_value_from_thread (thread_port_t thread, guint32 key) MONO_INTERNAL;
34
35 #endif
36 #endif /* __MONO_MACH_SUPPORT_H__ */