30 #include <sys/types.h>
36 #if defined(__APPLE__) && !TARGET_OS_IPHONE
37 # include <crt_externs.h>
38 # define environ (*_NSGetEnviron())
43 #if defined(__linux__) || defined(__GLIBC__)
64 h = &
loop->process_handles;
102 if (WIFEXITED(
process->status))
106 if (WIFSIGNALED(
process->status))
107 term_signal = WTERMSIG(
process->status);
116 #if defined(__FreeBSD__) || defined(__linux__)
143 #if defined(__FreeBSD__) || defined(__linux__)
192 if (container->
data.
stream->type != UV_NAMED_PIPE)
211 assert(0 &&
"Unexpected flags");
253 while (
n == -1 && errno ==
EINTR);
255 if (
n == -1 && errno ==
EPIPE)
262 #if !(defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH))
285 for (
fd = 0;
fd < stdio_count;
fd++) {
286 use_fd = pipes[
fd][1];
287 if (use_fd < 0 || use_fd >=
fd)
290 if (pipes[
fd][1] == -1) {
296 for (
fd = 0;
fd < stdio_count;
fd++) {
297 close_fd = pipes[
fd][0];
298 use_fd = pipes[
fd][1];
330 if (close_fd >= stdio_count)
334 for (
fd = 0;
fd < stdio_count;
fd++) {
335 use_fd = pipes[
fd][1];
337 if (use_fd >= stdio_count)
376 for (
n = 1;
n < 32;
n += 1) {
380 #if defined(__HAIKU__)
385 if (SIG_ERR !=
signal(
n, SIG_DFL))
394 err = pthread_sigmask(SIG_SETMASK, &set,
NULL);
411 #if defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH)
415 int signal_pipe[2] = { -1, -1 };
416 int pipes_storage[8][2];
438 stdio_count =
options->stdio_count;
443 pipes = pipes_storage;
444 if (stdio_count > (
int)
ARRAY_SIZE(pipes_storage))
445 pipes =
uv__malloc(stdio_count *
sizeof(*pipes));
450 for (
i = 0;
i < stdio_count;
i++) {
511 r =
read(signal_pipe[0], &exec_errorno,
sizeof(exec_errorno));
512 while (
r == -1 && errno ==
EINTR);
516 else if (
r ==
sizeof(exec_errorno)) {
519 while (
err == -1 && errno ==
EINTR);
521 }
else if (
r == -1 && errno ==
EPIPE) {
524 while (
err == -1 && errno ==
EINTR);
543 if (exec_errorno == 0) {
551 if (pipes != pipes_storage)
558 for (
i = 0;
i < stdio_count;
i++) {
559 if (i < options->stdio_count)
562 if (pipes[
i][0] != -1)
564 if (pipes[
i][1] != -1)
568 if (pipes != pipes_storage)
static mcore_handle handle
static static fork const void static count static fd const char const char static newpath chdir
static static fork const void static count static fd const char const char static newpath const char static path const char static mode static getpid setgid
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags fcntl
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc kill
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc pid
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause const char static mode static sync const char const char static newpath const char static pathname unsigned long static filedes void static end_data_segment static handler static getegid char static len static pgid const char static path dup2
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause const char static mode static sync const char const char static newpath const char static pathname unsigned long static filedes void static end_data_segment static handler static getegid char static len static pgid const char static path static newfd static getpgrp static euid const sigset_t static mask const char static len setgroups
static const char struct stat static buf struct stat static buf static vhangup int options
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause const char static mode static sync const char const char static newpath const char static pathname unsigned long static filedes void static end_data_segment signal
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause const char static mode static sync const char const char static newpath const char static pathname pipe
static const char struct stat static buf struct stat static buf static vhangup int status
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause const char static mode static sync const char const char static newpath const char static pathname unsigned long static filedes void static end_data_segment signum
assert(limit<=UINT32_MAX/2)
#define QUEUE_DATA(ptr, type, field)
#define QUEUE_INSERT_TAIL(h, q)
static struct sockaddr static addrlen static backlog const void static flags void flags
union uv_stdio_container_s::@397 data
int uv__close_nocheckstdio(int fd)
int uv__nonblock_fcntl(int fd, int set)
int uv__cloexec_fcntl(int fd, int set)
int uv__stream_open(uv_stream_t *, int fd, int flags)
#define uv__stream_fd(handle)
#define SAVE_ERRNO(block)
void uv__stream_close(uv_stream_t *handle)
static enum exit_status_type exit_status
Exit status to use. This can be changed with set_exit_status().
int uv_spawn(uv_loop_t *loop, uv_process_t *process, const uv_process_options_t *options)
static int uv__process_open_stream(uv_stdio_container_t *container, int pipefds[2])
static int uv__process_init_stdio(uv_stdio_container_t *container, int fds[2])
int uv_kill(int pid, int signum)
int uv_process_kill(uv_process_t *process, int signum)
static void uv__write_int(int fd, int val)
static void uv__chld(uv_signal_t *handle, int signum)
static int uv__make_socketpair(int fds[2])
static void uv__process_child_init(const uv_process_options_t *options, int stdio_count, int(*pipes)[2], int error_fd)
int uv__make_pipe(int fds[2], int flags)
void uv__process_close(uv_process_t *handle)
static void uv__process_close_stream(uv_stdio_container_t *container)
void error(const char *msg)
void * uv__malloc(size_t size)
#define uv__handle_init(loop_, h, type_)
#define uv__handle_stop(h)
#define uv__handle_start(h)
@ UV_PROCESS_WINDOWS_HIDE_CONSOLE
@ UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS
@ UV_PROCESS_WINDOWS_HIDE
@ UV_PROCESS_WINDOWS_HIDE_GUI
UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t *rwlock)
UV_EXTERN int uv_signal_start(uv_signal_t *handle, uv_signal_cb signal_cb, int signum)
UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t *rwlock)
UV_EXTERN int uv_signal_stop(uv_signal_t *handle)
static const z80_opcode fd[]
static zip_compression_status_t process(void *ud, zip_uint8_t *data, zip_uint64_t *length)
int read(izstream &zs, T *x, Items items)