[2020-02][debugger] Bump protocol for multi threaded single step implementation ...
[mono-project.git] / mono / utils / mono-threads-linux.c
blobe2cfded79f86c9744cde23bcf371e269993f8535
1 /**
2 * \file
3 */
5 #include <config.h>
7 #if (defined(__linux__) && !defined(HOST_ANDROID)) || defined(__FreeBSD_kernel__)
9 #include <mono/utils/mono-threads.h>
10 #include <pthread.h>
11 #include <sys/syscall.h>
13 void
14 mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
16 pthread_attr_t attr;
17 gint res;
19 *staddr = NULL;
20 *stsize = (size_t)-1;
22 res = pthread_attr_init (&attr);
23 if (G_UNLIKELY (res != 0))
24 g_error ("%s: pthread_attr_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
26 res = pthread_getattr_np (pthread_self (), &attr);
27 if (G_UNLIKELY (res != 0))
28 g_error ("%s: pthread_getattr_np failed with \"%s\" (%d)", __func__, g_strerror (res), res);
30 res = pthread_attr_getstack (&attr, (void**)staddr, stsize);
31 if (G_UNLIKELY (res != 0))
32 g_error ("%s: pthread_attr_getstack failed with \"%s\" (%d)", __func__, g_strerror (res), res);
34 res = pthread_attr_destroy (&attr);
35 if (G_UNLIKELY (res != 0))
36 g_error ("%s: pthread_attr_destroy failed with \"%s\" (%d)", __func__, g_strerror (res), res);
40 guint64
41 mono_native_thread_os_id_get (void)
43 return (guint64)syscall (SYS_gettid);
46 #else
48 #include <mono/utils/mono-compiler.h>
50 MONO_EMPTY_SOURCE_FILE (mono_threads_linux);
52 #endif