child_spawn1_socket.c (386B)
1 /* ISC license. */ 2 3 #include <skalibs/socket.h> 4 #include <skalibs/cspawn.h> 5 #include "cspawn-internal.h" 6 7 pid_t child_spawn1_socket (char const *prog, char const *const *argv, char const *const *envp, int *fd) 8 { 9 pid_t pid ; 10 int p[2] ; 11 if (ipc_pair_b(p) < 0) return 0 ; 12 pid = child_spawn1_internal(prog, argv, envp, p, 3) ; 13 if (!pid) return 0 ; 14 *fd = p[0] ; 15 return pid ; 16 }