Add a conditional for fork and exec* functions.
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Fri, 7 Aug 2015 08:47:00 +0000 (10:47 +0200)
committerRolf Bjarne Kvinge <rolf@xamarin.com>
Fri, 7 Aug 2015 08:56:21 +0000 (10:56 +0200)
They're not available on WatchOS.

configure.ac
eglib/configure.ac
eglib/src/gspawn.c
mono/io-layer/processes.c
mono/mini/mini-darwin.c

index 9154acf44e75b0c85a1d5349810f2cfac5016f4a..a04adcdef818979f8f1bf40c4c70168ac463ebcd 100644 (file)
@@ -2071,6 +2071,7 @@ if test x$host_win32 = xno; then
        AC_CHECK_FUNCS(readv writev preadv pwritev)
        AC_CHECK_FUNCS(setpgid)
        AC_CHECK_FUNCS(system)
+       AC_CHECK_FUNCS(fork execve)
        AC_CHECK_SIZEOF(size_t)
        AC_CHECK_TYPES([blksize_t], [AC_DEFINE(HAVE_BLKSIZE_T)], , 
                [#include <sys/types.h>
index f86ae9ff6bc24637d9adfba9ad943f26b44aca19..9d094ea7cdfaef28532cc71d1d167c34141178ce 100644 (file)
@@ -136,6 +136,7 @@ AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(long long)
 AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
 AC_CHECK_FUNCS(getrlimit)
+AC_CHECK_FUNCS(fork execv execve)
 
 #
 # Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
index a01904e3e3440cffe35c1ce0383382d9e8ceb227..4d0bf9e8eca919c44d609095fef62b01ada0f9a9 100644 (file)
@@ -248,6 +248,9 @@ g_spawn_command_line_sync (const gchar *command_line,
                                GError **error)
 {
 #ifdef G_OS_WIN32
+#elif !defined (HAVE_FORK) || !defined (HAVE_EXECV)
+       fprintf (stderr, "g_spawn_command_line_sync not supported on this platform\n");
+       return FALSE;
 #else
        pid_t pid;
        gchar **argv;
@@ -344,6 +347,9 @@ g_spawn_async_with_pipes (const gchar *working_directory,
                        GError **error)
 {
 #ifdef G_OS_WIN32
+#elif !defined (HAVE_FORK) || !defined (HAVE_EXECVE)
+       fprintf (stderr, "g_spawn_async_with_pipes is not supported on this platform\n");
+       return FALSE;
 #else
        pid_t pid;
        int info_pipe [2];
index 5f0805878cf7173c6c492460d6254159a2c3e859..d1e5a6367d04bc2dc0992e69e5576b1239882091 100644 (file)
@@ -554,6 +554,7 @@ gboolean CreateProcess (const gunichar2 *appname, const gunichar2 *cmdline,
                        WapiStartupInfo *startup,
                        WapiProcessInformation *process_info)
 {
+#if defined (HAVE_FORK) && defined (HAVE_EXECVE)
        char *cmd = NULL, *prog = NULL, *full_prog = NULL, *args = NULL, *args_after_prog = NULL;
        char *dir = NULL, **env_strings = NULL, **argv = NULL;
        guint32 i, env_count = 0;
@@ -1098,6 +1099,10 @@ free_strings:
        mono_processes_cleanup ();
        
        return ret;
+#else
+       SetLastError (ERROR_NOT_SUPPORTED);
+       return FALSE;
+#endif // defined (HAVE_FORK) && defined (HAVE_EXECVE)
 }
                
 static void
index cb7a975f9d1d36bbc8876f9f33e83b32f019e062..ab0024c41ba702293f2a6f99422328e2e5fcbe97 100644 (file)
@@ -239,12 +239,17 @@ mono_runtime_install_handlers (void)
 pid_t
 mono_runtime_syscall_fork ()
 {
+#ifdef HAVE_FORK
        return (pid_t) fork ();
+#else
+       g_assert_not_reached ();
+#endif
 }
 
 void
 mono_gdb_render_native_backtraces (pid_t crashed_pid)
 {
+#ifdef HAVE_EXECV
        const char *argv [5];
        char template [] = "/tmp/mono-gdb-commands.XXXXXX";
        FILE *commands;
@@ -288,6 +293,9 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid)
 
        execv (argv [0], (char**)argv);
        unlink (template);
+#else
+       fprintf (stderr, "mono_gdb_render_native_backtraces not supported on this platform\n");
+#endif // HAVE_EXECV
 }
 
 gboolean