[mini] Inline only use of mono_runtime_syscall_fork
authorLudovic Henry <ludovic@xamarin.com>
Thu, 15 Dec 2016 19:11:39 +0000 (14:11 -0500)
committerLudovic Henry <ludovic@xamarin.com>
Sat, 17 Dec 2016 14:42:51 +0000 (09:42 -0500)
mono/mini/mini-exceptions.c
mono/mini/mini-posix.c
mono/mini/mini.h

index c69678b593d2c848366d33b2b398a1d5a0475bb9..8b2d65a9355b0e6f572a1b098212ce515cd54bf0 100644 (file)
@@ -2488,12 +2488,21 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T
                int status;
                pid_t crashed_pid = getpid ();
 
-               //pid = fork ();
                /*
                 * glibc fork acquires some locks, so if the crash happened inside malloc/free,
                 * it will deadlock. Call the syscall directly instead.
                 */
-               pid = mono_runtime_syscall_fork ();
+#if defined(PLATFORM_ANDROID)
+               /* SYS_fork is defined to be __NR_fork which is not defined in some ndk versions */
+               g_assert_not_reached ();
+#elif defined(SYS_fork)
+               pid = (pid_t) syscall (SYS_fork);
+#elif defined(PLATFORM_MACOSX) && HAVE_FORK
+               pid = (pid_t) fork ();
+#else
+               g_assert_not_reached ();
+#endif
+
 #if defined (HAVE_PRCTL) && defined(PR_SET_PTRACER)
                if (pid > 0) {
                        // Allow gdb to attach to the process even if ptrace_scope sysctl variable is set to
index dbb0614bb2dfd06941ef081ab15fb504e7c9643c..f07b84d47f68a2c7cca51efa71532834c7ad5069 100644 (file)
@@ -832,12 +832,6 @@ mono_runtime_setup_stat_profiler (void)
 
 #if defined(__native_client__)
 
-pid_t
-mono_runtime_syscall_fork ()
-{
-       g_assert_not_reached ();
-}
-
 void
 mono_gdb_render_native_backtraces (pid_t crashed_pid)
 {
index 35dad72d538374972b44c84b292a2ea7f4df1ba8..9eadac601397177d709da58ae7cf61d7b8310096 100644 (file)
@@ -3176,7 +3176,6 @@ void mono_runtime_cleanup_handlers (void);
 void mono_runtime_setup_stat_profiler (void);
 void mono_runtime_shutdown_stat_profiler (void);
 void mono_runtime_posix_install_handlers (void);
-pid_t mono_runtime_syscall_fork (void);
 void mono_gdb_render_native_backtraces (pid_t crashed_pid);
 
 void mono_cross_helpers_run (void);