• 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()
87 err = uv_signal_init(loop, &loop->child_watcher); in uv__process_init()
90 uv__handle_unref(&loop->child_watcher); in uv__process_init()
91 loop->child_watcher.flags |= UV_HANDLE_INTERNAL; in uv__process_init()
98 memset(&loop->child_watcher, 0, sizeof(loop->child_watcher)); in uv__process_init()
117 h = &loop->process_handles; in uv__wait_children()
124 if ((process->flags & UV_HANDLE_REAP) == 0) in uv__wait_children()
125 continue; in uv__wait_children()
127 process->flags &= ~UV_HANDLE_REAP; in uv__wait_children()
128 loop->nfds--; in uv__wait_children()
134 pid = waitpid(process->pid, &status, options); in uv__wait_children()
135 while (pid == -1 && errno == EINTR); in uv__wait_children()
139 continue; in uv__wait_children()
142 if (pid == -1) { in uv__wait_children()
147 continue; in uv__wait_children()
150 assert(pid == process->pid); in uv__wait_children()
151 process->status = status; in uv__wait_children()
152 uv__queue_remove(&process->queue); in uv__wait_children()
153 uv__queue_insert_tail(&pending, &process->queue); in uv__wait_children()
162 uv__queue_remove(&process->queue); in uv__wait_children()
163 uv__queue_init(&process->queue); in uv__wait_children()
166 if (process->exit_cb == NULL) in uv__wait_children()
167 continue; in uv__wait_children()
170 if (WIFEXITED(process->status)) in uv__wait_children()
171 exit_status = WEXITSTATUS(process->status); in uv__wait_children()
174 if (WIFSIGNALED(process->status)) in uv__wait_children()
175 term_signal = WTERMSIG(process->status); in uv__wait_children()
177 process->exit_cb(process, exit_status, term_signal); in uv__wait_children()
184 * zero on success. See also the cleanup section in uv_spawn().
188 * avoided. Since this isn't called on those targets, the function
197 switch (container->flags & mask) { in uv__process_init_stdio()
202 assert(container->data.stream != NULL); in uv__process_init_stdio()
203 if (container->data.stream->type != UV_NAMED_PIPE) in uv__process_init_stdio()
210 if (container->flags & UV_INHERIT_FD) in uv__process_init_stdio()
211 fd = container->data.fd; in uv__process_init_stdio()
213 fd = uv__stream_fd(container->data.stream); in uv__process_init_stdio()
215 if (fd == -1) in uv__process_init_stdio()
233 if (!(container->flags & UV_CREATE_PIPE) || pipefds[0] < 0) in uv__process_open_stream()
240 pipefds[1] = -1; in uv__process_open_stream()
244 if (container->flags & UV_WRITABLE_PIPE) in uv__process_open_stream()
246 if (container->flags & UV_READABLE_PIPE) in uv__process_open_stream()
249 return uv__stream_open(container->data.stream, pipefds[0], flags); in uv__process_open_stream()
254 if (!(container->flags & UV_CREATE_PIPE)) return; in uv__process_close_stream()
255 uv__stream_close(container->data.stream); in uv__process_close_stream()
264 while (n == -1 && errno == EINTR); in uv__write_int()
287 /* Reset signal disposition first. Use a hard-coded limit because NSIG is not in uv__process_child_init()
288 * fixed on Linux: it's either 32, 34 or 64, depending on whether RT signals in uv__process_child_init()
294 continue; /* Can't be changed. */ in uv__process_child_init()
298 continue; /* Can't be changed. */ in uv__process_child_init()
302 continue; in uv__process_child_init()
307 if (options->flags & UV_PROCESS_DETACHED) in uv__process_child_init()
317 continue; in uv__process_child_init()
323 if (pipes[fd][1] == -1) in uv__process_child_init()
333 close_fd = -1; in uv__process_child_init()
338 continue; in uv__process_child_init()
352 if (close_fd == -1) { in uv__process_child_init()
362 if (fd == -1) in uv__process_child_init()
365 if (fd <= 2 && close_fd == -1) in uv__process_child_init()
372 if (options->cwd != NULL && chdir(options->cwd)) in uv__process_child_init()
375 if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) { in uv__process_child_init()
379 * that enable us to do super-user things. This will fail if we in uv__process_child_init()
386 if ((options->flags & UV_PROCESS_SETGID) && setgid(options->gid)) in uv__process_child_init()
389 if ((options->flags & UV_PROCESS_SETUID) && setuid(options->uid)) in uv__process_child_init()
392 if (options->env != NULL) in uv__process_child_init()
393 environ = options->env; in uv__process_child_init()
401 execvpe(options->file, options->args, environ); in uv__process_child_init()
403 execvp(options->file, options->args); in uv__process_child_init()
424 /* Try to locate all non-portable functions at runtime */ in uv__spawn_init_posix_spawn_fncs()
451 /* Init handles to all potentially non-defined functions */ in uv__spawn_init_posix_spawn()
469 /* If initialization fails, no need to de-init, just return */ in uv__spawn_set_posix_spawn_attrs()
473 if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) { in uv__spawn_set_posix_spawn_attrs()
479 goto error; in uv__spawn_set_posix_spawn_attrs()
485 * only fds that will be passed on to the child are those manipulated by in uv__spawn_set_posix_spawn_attrs()
487 * 2) POSIX_SPAWN_SETSIGDEF: Signals mentioned in spawn-sigdefault in the in uv__spawn_set_posix_spawn_attrs()
490 * spawn-sigmask in attributes in uv__spawn_set_posix_spawn_attrs()
496 if (options->flags & UV_PROCESS_DETACHED) { in uv__spawn_set_posix_spawn_attrs()
497 /* If running on a version of macOS where this flag is not supported, in uv__spawn_set_posix_spawn_attrs()
502 goto error; in uv__spawn_set_posix_spawn_attrs()
509 goto error; in uv__spawn_set_posix_spawn_attrs()
515 goto error; in uv__spawn_set_posix_spawn_attrs()
521 goto error; in uv__spawn_set_posix_spawn_attrs()
525 error: in uv__spawn_set_posix_spawn_attrs()
544 /* If initialization fails, no need to de-init, just return */ in uv__spawn_set_posix_spawn_file_actions()
549 if (options->cwd != NULL) { in uv__spawn_set_posix_spawn_file_actions()
550 if (posix_spawn_fncs->file_actions.addchdir_np == NULL) { in uv__spawn_set_posix_spawn_file_actions()
552 goto error; in uv__spawn_set_posix_spawn_file_actions()
555 err = posix_spawn_fncs->file_actions.addchdir_np(actions, options->cwd); in uv__spawn_set_posix_spawn_file_actions()
557 goto error; in uv__spawn_set_posix_spawn_file_actions()
569 continue; in uv__spawn_set_posix_spawn_file_actions()
586 goto error; in uv__spawn_set_posix_spawn_file_actions()
595 continue; in uv__spawn_set_posix_spawn_file_actions()
606 goto error; in uv__spawn_set_posix_spawn_file_actions()
607 continue; in uv__spawn_set_posix_spawn_file_actions()
617 goto error; in uv__spawn_set_posix_spawn_file_actions()
619 /* Make sure the fd is marked as non-blocking (state shared between child in uv__spawn_set_posix_spawn_file_actions()
628 continue; in uv__spawn_set_posix_spawn_file_actions()
636 continue; in uv__spawn_set_posix_spawn_file_actions()
641 goto error; in uv__spawn_set_posix_spawn_file_actions()
646 error: in uv__spawn_set_posix_spawn_file_actions()
658 if (strncmp(*env_iterator, path_var, sizeof(path_var) - 1) == 0) { in uv__spawn_find_path_in_env()
660 return *env_iterator + sizeof(path_var) - 1; in uv__spawn_find_path_in_env()
681 err = -1; in uv__spawn_resolve_and_spawn()
685 if (options->file == NULL) in uv__spawn_resolve_and_spawn()
689 * by options->env */ in uv__spawn_resolve_and_spawn()
691 if (options->env != NULL) in uv__spawn_resolve_and_spawn()
692 env = options->env; in uv__spawn_resolve_and_spawn()
694 /* If options->file contains a slash, posix_spawn/posix_spawnp should behave in uv__spawn_resolve_and_spawn()
698 if (strchr(options->file, '/') != NULL) { in uv__spawn_resolve_and_spawn()
700 err = posix_spawn(pid, options->file, actions, attrs, options->args, env); in uv__spawn_resolve_and_spawn()
709 * https://git.musl-libc.org/cgit/musl/tree/src/process/execvp.c in uv__spawn_resolve_and_spawn()
717 k = strnlen(options->file, NAME_MAX + 1); in uv__spawn_resolve_and_spawn()
721 l = strnlen(path, PATH_MAX - 1) + 1; in uv__spawn_resolve_and_spawn()
730 if ((size_t)(z - p) >= l) { in uv__spawn_resolve_and_spawn()
734 continue; in uv__spawn_resolve_and_spawn()
736 memcpy(b, p, z - p); in uv__spawn_resolve_and_spawn()
737 b[z - p] = '/'; in uv__spawn_resolve_and_spawn()
738 memcpy(b + (z - p) + (z > p), options->file, k + 1); in uv__spawn_resolve_and_spawn()
741 * new process file is not in this PATH entry, continue with the next in uv__spawn_resolve_and_spawn()
744 err = posix_spawn(pid, b, actions, attrs, options->args, env); in uv__spawn_resolve_and_spawn()
750 break; /* continue search */ in uv__spawn_resolve_and_spawn()
753 break; /* continue search */ in uv__spawn_resolve_and_spawn()
780 goto error; in uv__spawn_and_init_child_posix_spawn()
790 goto error; in uv__spawn_and_init_child_posix_spawn()
793 /* Try to spawn options->file resolving in the provided environment in uv__spawn_and_init_child_posix_spawn()
802 error: in uv__spawn_and_init_child_posix_spawn()
803 /* In an error situation, the attributes and file actions are in uv__spawn_and_init_child_posix_spawn()
842 if (*pid == -1) in uv__spawn_and_init_child_fork()
856 int signal_pipe[2] = { -1, -1 }; in uv__spawn_and_init_child()
867 * Big Sur introduced a significant performance degradation on a call to in uv__spawn_and_init_child()
869 * a javascript interpreter. Electron-based applications, for example, in uv__spawn_and_init_child()
870 * are impacted; though the magnitude of the impact depends on how much the in uv__spawn_and_init_child()
871 * app relies on subprocesses. in uv__spawn_and_init_child()
873 * On macOS, though, posix_spawn is implemented in a way that does not in uv__spawn_and_init_child()
885 * non-standard functions is both _needed_ and _undefined_. In those cases, in uv__spawn_and_init_child()
909 * marked close-on-exec. Then, after the call to `fork()`, in uv__spawn_and_init_child()
917 uv_rwlock_wrlock(&loop->cloexec_lock); in uv__spawn_and_init_child()
922 uv_rwlock_wrunlock(&loop->cloexec_lock); in uv__spawn_and_init_child()
929 while (r == -1 && errno == EINTR); in uv__spawn_and_init_child()
936 while (err == -1 && errno == EINTR); in uv__spawn_and_init_child()
939 } else if (r == -1 && errno == EPIPE) { in uv__spawn_and_init_child()
943 while (err == -1 && errno == EINTR); in uv__spawn_and_init_child()
971 assert(options->file != NULL); in uv_spawn()
972 assert(!(options->flags & ~(UV_PROCESS_DETACHED | in uv_spawn()
982 uv__queue_init(&process->queue); in uv_spawn()
983 process->status = 0; in uv_spawn()
985 stdio_count = options->stdio_count; in uv_spawn()
995 goto error; in uv_spawn()
998 pipes[i][0] = -1; in uv_spawn()
999 pipes[i][1] = -1; in uv_spawn()
1002 for (i = 0; i < options->stdio_count; i++) { in uv_spawn()
1003 err = uv__process_init_stdio(options->stdio + i, pipes[i]); in uv_spawn()
1005 goto error; in uv_spawn()
1009 uv_signal_start(&loop->child_watcher, uv__chld, SIGCHLD); in uv_spawn()
1018 * See https://github.com/libuv/libuv/pull/3107#issuecomment-782482608 */ in uv_spawn()
1020 goto error; in uv_spawn()
1030 if (kevent(loop->backend_fd, &event, 1, NULL, 0, NULL)) { in uv_spawn()
1033 /* Process already exited. Call waitpid on the next loop iteration. */ in uv_spawn()
1034 process->flags |= UV_HANDLE_REAP; in uv_spawn()
1035 loop->flags |= UV_LOOP_REAP_CHILDREN; in uv_spawn()
1040 loop->nfds++; in uv_spawn()
1043 process->pid = pid; in uv_spawn()
1044 process->exit_cb = options->exit_cb; in uv_spawn()
1045 uv__queue_insert_tail(&loop->process_handles, &process->queue); in uv_spawn()
1049 for (i = 0; i < options->stdio_count; i++) { in uv_spawn()
1050 err = uv__process_open_stream(options->stdio + i, pipes[i]); in uv_spawn()
1052 continue; in uv_spawn()
1054 while (i--) in uv_spawn()
1055 uv__process_close_stream(options->stdio + i); in uv_spawn()
1057 goto error; in uv_spawn()
1065 error: in uv_spawn()
1068 if (i < options->stdio_count) in uv_spawn()
1069 if (options->stdio[i].flags & (UV_INHERIT_FD | UV_INHERIT_STREAM)) in uv_spawn()
1070 continue; in uv_spawn()
1071 if (pipes[i][0] != -1) in uv_spawn()
1073 if (pipes[i][1] != -1) in uv_spawn()
1087 return uv_kill(process->pid, signum); in uv_process_kill()
1107 uv__queue_remove(&handle->queue); in uv__process_close()
1110 if (uv__queue_empty(&handle->loop->process_handles)) in uv__process_close()
1111 uv_signal_stop(&handle->loop->child_watcher); in uv__process_close()