Go to the documentation of this file.
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__)
59 assert(signum == SIGCHLD);
64 h = &
loop->process_handles;
72 while (pid == -1 && errno == EINTR);
102 if (WIFEXITED(
process->status))
103 exit_status = WEXITSTATUS(
process->status);
106 if (WIFSIGNALED(
process->status))
107 term_signal = WTERMSIG(
process->status);
116 #if defined(__FreeBSD__) || defined(__linux__)
117 if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, fds))
124 if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds))
143 #if defined(__FreeBSD__) || defined(__linux__)
144 if (pipe2(fds,
flags | O_CLOEXEC))
192 if (
container->data.stream->type != UV_NAMED_PIPE)
211 assert(0 &&
"Unexpected flags");
252 n =
write(fd, &val,
sizeof(val));
253 while (
n == -1 && errno == EINTR);
255 if (
n == -1 && errno == EPIPE)
258 assert(
n ==
sizeof(val));
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)
289 pipes[fd][1] = fcntl(use_fd, F_DUPFD, stdio_count);
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];
307 use_fd =
open(
"/dev/null", fd == 0 ? O_RDONLY : O_RDWR);
320 fd = dup2(use_fd, fd);
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)
583 if (kill(pid, signum))
static int uv__process_open_stream(uv_stdio_container_t *container, int pipefds[2])
void uv__stream_close(uv_stream_t *handle)
int uv_kill(int pid, int signum)
static void uv__process_child_init(const uv_process_options_t *options, int stdio_count, int(*pipes)[2], int error_fd)
#define ARRAY_SIZE(array)
void * uv__malloc(size_t size)
int uv__close_nocheckstdio(int fd)
static void uv__chld(uv_signal_t *handle, int signum)
int uv_process_kill(uv_process_t *process, int signum)
int uv__cloexec_fcntl(int fd, int set)
#define QUEUE_DATA(ptr, type, field)
static void uv__process_close_stream(uv_stdio_container_t *container)
void uv__process_close(uv_process_t *handle)
static uv_process_t process
static void signal(notification *n)
Poll< absl::StatusOr< std::tuple< T... > > > fail()
static void uv__write_int(int fd, int val)
UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t *rwlock)
UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t *rwlock)
int uv_spawn(uv_loop_t *loop, uv_process_t *process, const uv_process_options_t *options)
UV_EXTERN int uv_signal_stop(uv_signal_t *handle)
#define uv__handle_init(loop_, h, type_)
int uv__nonblock_fcntl(int fd, int set)
@ UV_PROCESS_WINDOWS_HIDE
int read(izstream &zs, T *x, Items items)
@ UV_PROCESS_WINDOWS_HIDE_GUI
#define uv__stream_fd(handle)
#define SAVE_ERRNO(block)
static int uv__make_socketpair(int fds[2])
@ UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS
#define uv__handle_start(h)
int uv__stream_open(uv_stream_t *, int fd, int flags)
@ UV_PROCESS_WINDOWS_HIDE_CONSOLE
int uv__make_pipe(int fds[2], int flags)
UV_HANDLE_FIELDS uv_exit_cb exit_cb
#define uv__handle_stop(h)
#define QUEUE_INSERT_TAIL(h, q)
static int uv__process_init_stdio(uv_stdio_container_t *container, int fds[2])
static struct async_container * container
UV_EXTERN int uv_signal_start(uv_signal_t *handle, uv_signal_cb signal_cb, int signum)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:55