From bda29cf8083ceb33a9abda421da267e81030ff77 Mon Sep 17 00:00:00 2001 From: Nathan Corvino Date: Mon, 19 Oct 2015 02:48:05 -0700 Subject: [PATCH] unix: skip prohibited syscalls on tvOS and watchOS fork and the exec functions are marked prohibited on tvOS and watchOS, so referencing them causes compile errors. This adds preprocessor conditionals to avoid calling them for those targets. PR-URL: https://github.com/libuv/libuv/pull/580 Reviewed-By: Ben Noordhuis --- src/unix/process.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/unix/process.c b/src/unix/process.c index 9fa061e6..571f8cd7 100644 --- a/src/unix/process.c +++ b/src/unix/process.c @@ -270,6 +270,11 @@ static void uv__write_int(int fd, int val) { } +#if !(defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH)) +/* execvp is marked __WATCHOS_PROHIBITED __TVOS_PROHIBITED, so must be + * avoided. Since this isn't called on those targets, the function + * doesn't even need to be defined for them. + */ static void uv__process_child_init(const uv_process_options_t* options, int stdio_count, int (*pipes)[2], @@ -375,11 +380,16 @@ static void uv__process_child_init(const uv_process_options_t* options, uv__write_int(error_fd, -errno); _exit(127); } +#endif int uv_spawn(uv_loop_t* loop, uv_process_t* process, const uv_process_options_t* options) { +#if defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH) + /* fork is marked __WATCHOS_PROHIBITED __TVOS_PROHIBITED. */ + return -ENOSYS; +#else int signal_pipe[2] = { -1, -1 }; int (*pipes)[2]; int stdio_count; @@ -528,6 +538,7 @@ error: } return err; +#endif }