• Home
  • Raw
  • Download

Lines Matching +full:continue +full:- +full:on +full:- +full:error

63 # include "zos-base.h"
80 uv__wait_children(handle->loop); in uv__chld()
97 h = &loop->process_handles; in uv__wait_children()
104 if ((process->flags & UV_HANDLE_REAP) == 0) in uv__wait_children()
105 continue; in uv__wait_children()
107 process->flags &= ~UV_HANDLE_REAP; in uv__wait_children()
113 pid = waitpid(process->pid, &status, options); in uv__wait_children()
114 while (pid == -1 && errno == EINTR); in uv__wait_children()
118 continue; in uv__wait_children()
121 if (pid == -1) { in uv__wait_children()
126 continue; in uv__wait_children()
129 assert(pid == process->pid); in uv__wait_children()
130 process->status = status; in uv__wait_children()
131 QUEUE_REMOVE(&process->queue); in uv__wait_children()
132 QUEUE_INSERT_TAIL(&pending, &process->queue); in uv__wait_children()
141 QUEUE_REMOVE(&process->queue); in uv__wait_children()
142 QUEUE_INIT(&process->queue); in uv__wait_children()
145 if (process->exit_cb == NULL) in uv__wait_children()
146 continue; in uv__wait_children()
149 if (WIFEXITED(process->status)) in uv__wait_children()
150 exit_status = WEXITSTATUS(process->status); in uv__wait_children()
153 if (WIFSIGNALED(process->status)) in uv__wait_children()
154 term_signal = WTERMSIG(process->status); in uv__wait_children()
156 process->exit_cb(process, exit_status, term_signal); in uv__wait_children()
163 * zero on success. See also the cleanup section in uv_spawn().
171 switch (container->flags & mask) { in uv__process_init_stdio()
176 assert(container->data.stream != NULL); in uv__process_init_stdio()
177 if (container->data.stream->type != UV_NAMED_PIPE) in uv__process_init_stdio()
184 if (container->flags & UV_INHERIT_FD) in uv__process_init_stdio()
185 fd = container->data.fd; in uv__process_init_stdio()
187 fd = uv__stream_fd(container->data.stream); in uv__process_init_stdio()
189 if (fd == -1) in uv__process_init_stdio()
207 if (!(container->flags & UV_CREATE_PIPE) || pipefds[0] < 0) in uv__process_open_stream()
214 pipefds[1] = -1; in uv__process_open_stream()
218 if (container->flags & UV_WRITABLE_PIPE) in uv__process_open_stream()
220 if (container->flags & UV_READABLE_PIPE) in uv__process_open_stream()
223 return uv__stream_open(container->data.stream, pipefds[0], flags); in uv__process_open_stream()
228 if (!(container->flags & UV_CREATE_PIPE)) return; in uv__process_close_stream()
229 uv__stream_close(container->data.stream); in uv__process_close_stream()
238 while (n == -1 && errno == EINTR); in uv__write_int()
253 * avoided. Since this isn't called on those targets, the function
266 /* Reset signal disposition first. Use a hard-coded limit because NSIG is not in uv__process_child_init()
267 * fixed on Linux: it's either 32, 34 or 64, depending on whether RT signals in uv__process_child_init()
273 continue; /* Can't be changed. */ in uv__process_child_init()
277 continue; /* Can't be changed. */ in uv__process_child_init()
281 continue; in uv__process_child_init()
286 if (options->flags & UV_PROCESS_DETACHED) in uv__process_child_init()
296 continue; in uv__process_child_init()
302 if (pipes[fd][1] == -1) in uv__process_child_init()
312 close_fd = -1; in uv__process_child_init()
317 continue; in uv__process_child_init()
331 if (close_fd == -1) { in uv__process_child_init()
341 if (fd == -1) in uv__process_child_init()
344 if (fd <= 2 && close_fd == -1) in uv__process_child_init()
351 if (options->cwd != NULL && chdir(options->cwd)) in uv__process_child_init()
354 if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) { in uv__process_child_init()
358 * that enable us to do super-user things. This will fail if we in uv__process_child_init()
365 if ((options->flags & UV_PROCESS_SETGID) && setgid(options->gid)) in uv__process_child_init()
368 if ((options->flags & UV_PROCESS_SETUID) && setuid(options->uid)) in uv__process_child_init()
371 if (options->env != NULL) in uv__process_child_init()
372 environ = options->env; in uv__process_child_init()
380 execvpe(options->file, options->args, environ); in uv__process_child_init()
382 execvp(options->file, options->args); in uv__process_child_init()
404 /* Try to locate all non-portable functions at runtime */ in uv__spawn_init_posix_spawn_fncs()
431 /* Init handles to all potentially non-defined functions */ in uv__spawn_init_posix_spawn()
449 /* If initialization fails, no need to de-init, just return */ in uv__spawn_set_posix_spawn_attrs()
453 if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) { in uv__spawn_set_posix_spawn_attrs()
459 goto error; in uv__spawn_set_posix_spawn_attrs()
465 * only fds that will be passed on to the child are those manipulated by in uv__spawn_set_posix_spawn_attrs()
467 * 2) POSIX_SPAWN_SETSIGDEF: Signals mentioned in spawn-sigdefault in the in uv__spawn_set_posix_spawn_attrs()
470 * spawn-sigmask in attributes in uv__spawn_set_posix_spawn_attrs()
476 if (options->flags & UV_PROCESS_DETACHED) { in uv__spawn_set_posix_spawn_attrs()
477 /* If running on a version of macOS where this flag is not supported, in uv__spawn_set_posix_spawn_attrs()
482 goto error; in uv__spawn_set_posix_spawn_attrs()
489 goto error; in uv__spawn_set_posix_spawn_attrs()
495 goto error; in uv__spawn_set_posix_spawn_attrs()
501 goto error; in uv__spawn_set_posix_spawn_attrs()
505 error: in uv__spawn_set_posix_spawn_attrs()
524 /* If initialization fails, no need to de-init, just return */ in uv__spawn_set_posix_spawn_file_actions()
529 if (options->cwd != NULL) { in uv__spawn_set_posix_spawn_file_actions()
530 if (posix_spawn_fncs->file_actions.addchdir_np == NULL) { in uv__spawn_set_posix_spawn_file_actions()
532 goto error; in uv__spawn_set_posix_spawn_file_actions()
535 err = posix_spawn_fncs->file_actions.addchdir_np(actions, options->cwd); in uv__spawn_set_posix_spawn_file_actions()
537 goto error; in uv__spawn_set_posix_spawn_file_actions()
549 continue; in uv__spawn_set_posix_spawn_file_actions()
566 goto error; in uv__spawn_set_posix_spawn_file_actions()
575 continue; in uv__spawn_set_posix_spawn_file_actions()
586 goto error; in uv__spawn_set_posix_spawn_file_actions()
587 continue; in uv__spawn_set_posix_spawn_file_actions()
597 goto error; in uv__spawn_set_posix_spawn_file_actions()
599 /* Make sure the fd is marked as non-blocking (state shared between child in uv__spawn_set_posix_spawn_file_actions()
608 continue; in uv__spawn_set_posix_spawn_file_actions()
616 continue; in uv__spawn_set_posix_spawn_file_actions()
621 goto error; in uv__spawn_set_posix_spawn_file_actions()
626 error: in uv__spawn_set_posix_spawn_file_actions()
638 if (strncmp(*env_iterator, path_var, sizeof(path_var) - 1) == 0) { in uv__spawn_find_path_in_env()
640 return *env_iterator + sizeof(path_var) - 1; in uv__spawn_find_path_in_env()
661 err = -1; in uv__spawn_resolve_and_spawn()
665 if (options->file == NULL) in uv__spawn_resolve_and_spawn()
669 * by options->env */ in uv__spawn_resolve_and_spawn()
671 if (options->env != NULL) in uv__spawn_resolve_and_spawn()
672 env = options->env; in uv__spawn_resolve_and_spawn()
674 /* If options->file contains a slash, posix_spawn/posix_spawnp behave in uv__spawn_resolve_and_spawn()
676 * options->file does not include a slash, but no custom environment is in uv__spawn_resolve_and_spawn()
680 if (strchr(options->file, '/') != NULL || options->env == NULL) { in uv__spawn_resolve_and_spawn()
682 err = posix_spawnp(pid, options->file, actions, attrs, options->args, env); in uv__spawn_resolve_and_spawn()
688 path = uv__spawn_find_path_in_env(options->env); in uv__spawn_resolve_and_spawn()
691 * https://git.musl-libc.org/cgit/musl/tree/src/process/execvp.c in uv__spawn_resolve_and_spawn()
694 /* If no path was provided in options->env, use the default value in uv__spawn_resolve_and_spawn()
699 k = strnlen(options->file, NAME_MAX + 1); in uv__spawn_resolve_and_spawn()
703 l = strnlen(path, PATH_MAX - 1) + 1; in uv__spawn_resolve_and_spawn()
712 if ((size_t)(z - p) >= l) { in uv__spawn_resolve_and_spawn()
716 continue; in uv__spawn_resolve_and_spawn()
718 memcpy(b, p, z - p); in uv__spawn_resolve_and_spawn()
719 b[z - p] = '/'; in uv__spawn_resolve_and_spawn()
720 memcpy(b + (z - p) + (z > p), options->file, k + 1); in uv__spawn_resolve_and_spawn()
723 * new process file is not in this PATH entry, continue with the next in uv__spawn_resolve_and_spawn()
726 err = posix_spawn(pid, b, actions, attrs, options->args, env); in uv__spawn_resolve_and_spawn()
732 break; /* continue search */ in uv__spawn_resolve_and_spawn()
735 break; /* continue search */ in uv__spawn_resolve_and_spawn()
762 goto error; in uv__spawn_and_init_child_posix_spawn()
772 goto error; in uv__spawn_and_init_child_posix_spawn()
775 /* Try to spawn options->file resolving in the provided environment in uv__spawn_and_init_child_posix_spawn()
784 error: in uv__spawn_and_init_child_posix_spawn()
785 /* In an error situation, the attributes and file actions are in uv__spawn_and_init_child_posix_spawn()
815 if (*pid == -1) { in uv__spawn_and_init_child_fork()
839 int signal_pipe[2] = { -1, -1 }; in uv__spawn_and_init_child()
850 * Big Sur introduced a significant performance degradation on a call to in uv__spawn_and_init_child()
852 * a javascript interpreter. Electron-based applications, for example, in uv__spawn_and_init_child()
853 * are impacted; though the magnitude of the impact depends on how much the in uv__spawn_and_init_child()
854 * app relies on subprocesses. in uv__spawn_and_init_child()
856 * On macOS, though, posix_spawn is implemented in a way that does not in uv__spawn_and_init_child()
868 * non-standard functions is both _needed_ and _undefined_. In those cases, in uv__spawn_and_init_child()
892 * marked close-on-exec. Then, after the call to `fork()`, in uv__spawn_and_init_child()
900 uv_rwlock_wrlock(&loop->cloexec_lock); in uv__spawn_and_init_child()
905 uv_rwlock_wrunlock(&loop->cloexec_lock); in uv__spawn_and_init_child()
912 while (r == -1 && errno == EINTR); in uv__spawn_and_init_child()
919 while (err == -1 && errno == EINTR); in uv__spawn_and_init_child()
922 } else if (r == -1 && errno == EPIPE) { in uv__spawn_and_init_child()
926 while (err == -1 && errno == EINTR); in uv__spawn_and_init_child()
953 assert(options->file != NULL); in uv_spawn()
954 assert(!(options->flags & ~(UV_PROCESS_DETACHED | in uv_spawn()
963 QUEUE_INIT(&process->queue); in uv_spawn()
964 process->status = 0; in uv_spawn()
966 stdio_count = options->stdio_count; in uv_spawn()
976 goto error; in uv_spawn()
979 pipes[i][0] = -1; in uv_spawn()
980 pipes[i][1] = -1; in uv_spawn()
983 for (i = 0; i < options->stdio_count; i++) { in uv_spawn()
984 err = uv__process_init_stdio(options->stdio + i, pipes[i]); in uv_spawn()
986 goto error; in uv_spawn()
990 uv_signal_start(&loop->child_watcher, uv__chld, SIGCHLD); in uv_spawn()
999 * See https://github.com/libuv/libuv/pull/3107#issuecomment-782482608 */ in uv_spawn()
1001 goto error; in uv_spawn()
1011 if (kevent(loop->backend_fd, &event, 1, NULL, 0, NULL)) { in uv_spawn()
1014 /* Process already exited. Call waitpid on the next loop iteration. */ in uv_spawn()
1015 process->flags |= UV_HANDLE_REAP; in uv_spawn()
1016 loop->flags |= UV_LOOP_REAP_CHILDREN; in uv_spawn()
1020 process->pid = pid; in uv_spawn()
1021 process->exit_cb = options->exit_cb; in uv_spawn()
1022 QUEUE_INSERT_TAIL(&loop->process_handles, &process->queue); in uv_spawn()
1026 for (i = 0; i < options->stdio_count; i++) { in uv_spawn()
1027 err = uv__process_open_stream(options->stdio + i, pipes[i]); in uv_spawn()
1029 continue; in uv_spawn()
1031 while (i--) in uv_spawn()
1032 uv__process_close_stream(options->stdio + i); in uv_spawn()
1034 goto error; in uv_spawn()
1042 error: in uv_spawn()
1045 if (i < options->stdio_count) in uv_spawn()
1046 if (options->stdio[i].flags & (UV_INHERIT_FD | UV_INHERIT_STREAM)) in uv_spawn()
1047 continue; in uv_spawn()
1048 if (pipes[i][0] != -1) in uv_spawn()
1050 if (pipes[i][1] != -1) in uv_spawn()
1064 return uv_kill(process->pid, signum); in uv_process_kill()
1077 QUEUE_REMOVE(&handle->queue); in uv__process_close()
1079 if (QUEUE_EMPTY(&handle->loop->process_handles)) in uv__process_close()
1080 uv_signal_stop(&handle->loop->child_watcher); in uv__process_close()