libuv: disable process affinity during CMake bootstrap

Avoid depending on platform-specific pthread features during bootstrap.
This commit is contained in:
Brad King
2018-03-05 09:18:53 -05:00
parent 24de561a1a
commit c5428d8db2
+10
View File
@@ -45,6 +45,7 @@ extern char **environ;
# include <grp.h> # include <grp.h>
#endif #endif
#ifndef CMAKE_BOOTSTRAP
#if defined(__linux__) #if defined(__linux__)
# define uv__cpu_set_t cpu_set_t # define uv__cpu_set_t cpu_set_t
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
@@ -53,6 +54,7 @@ extern char **environ;
# include <pthread_np.h> # include <pthread_np.h>
# define uv__cpu_set_t cpuset_t # define uv__cpu_set_t cpuset_t
#endif #endif
#endif
static void uv__chld(uv_signal_t* handle, int signum) { static void uv__chld(uv_signal_t* handle, int signum) {
uv_process_t* process; uv_process_t* process;
@@ -294,11 +296,13 @@ static void uv__process_child_init(const uv_process_options_t* options,
int err; int err;
int fd; int fd;
int n; int n;
#ifndef CMAKE_BOOTSTRAP
#if defined(__linux__) || defined(__FreeBSD__) #if defined(__linux__) || defined(__FreeBSD__)
int r; int r;
int i; int i;
int cpumask_size; int cpumask_size;
uv__cpu_set_t cpuset; uv__cpu_set_t cpuset;
#endif
#endif #endif
if (options->flags & UV_PROCESS_DETACHED) if (options->flags & UV_PROCESS_DETACHED)
@@ -390,6 +394,7 @@ static void uv__process_child_init(const uv_process_options_t* options,
_exit(127); _exit(127);
} }
#ifndef CMAKE_BOOTSTRAP
#if defined(__linux__) || defined(__FreeBSD__) #if defined(__linux__) || defined(__FreeBSD__)
if (options->cpumask != NULL) { if (options->cpumask != NULL) {
cpumask_size = uv_cpumask_size(); cpumask_size = uv_cpumask_size();
@@ -408,6 +413,7 @@ static void uv__process_child_init(const uv_process_options_t* options,
_exit(127); _exit(127);
} }
} }
#endif
#endif #endif
if (options->env != NULL) { if (options->env != NULL) {
@@ -465,10 +471,14 @@ int uv_spawn(uv_loop_t* loop,
int status; int status;
if (options->cpumask != NULL) { if (options->cpumask != NULL) {
#ifndef CMAKE_BOOTSTRAP
#if defined(__linux__) || defined(__FreeBSD__) #if defined(__linux__) || defined(__FreeBSD__)
if (options->cpumask_size < (size_t)uv_cpumask_size()) { if (options->cpumask_size < (size_t)uv_cpumask_size()) {
return UV_EINVAL; return UV_EINVAL;
} }
#else
return UV_ENOTSUP;
#endif
#else #else
return UV_ENOTSUP; return UV_ENOTSUP;
#endif #endif