From f87d44b29a3d18f1a37999cc8ea8e5c4d131347f Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 15 Dec 2016 14:11:39 -0500 Subject: [PATCH] [mini] Inline only use of mono_runtime_syscall_fork --- mono/mini/mini-exceptions.c | 13 +++++++++++-- mono/mini/mini-posix.c | 6 ------ mono/mini/mini.h | 1 - 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c index c69678b593d..8b2d65a9355 100644 --- a/mono/mini/mini-exceptions.c +++ b/mono/mini/mini-exceptions.c @@ -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 diff --git a/mono/mini/mini-posix.c b/mono/mini/mini-posix.c index dbb0614bb2d..f07b84d47f6 100644 --- a/mono/mini/mini-posix.c +++ b/mono/mini/mini-posix.c @@ -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) { diff --git a/mono/mini/mini.h b/mono/mini/mini.h index 35dad72d538..9eadac60139 100644 --- a/mono/mini/mini.h +++ b/mono/mini/mini.h @@ -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); -- 2.25.1