From 170480a068841398b5538ae0598fbfda0e7789b5 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 11 Sep 2023 19:47:26 +0000 Subject: Add gcspawn Signed-off-by: Laurent Bercot --- doc/libstddjb/cspawn.html | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'doc/libstddjb') diff --git a/doc/libstddjb/cspawn.html b/doc/libstddjb/cspawn.html index 53ca535..5a19d9a 100644 --- a/doc/libstddjb/cspawn.html +++ b/doc/libstddjb/cspawn.html @@ -41,7 +41,7 @@ otherwise.

Primitive

- pid_t cspawn (char const *file, char const *const *argv, char const *const *envp, uint32_t flags, cspawn_fileaction const *fa, size_t n)
+ pid_t cspawn (char const *file, char const *const *argv, char const *const *envp, uint32_t flags, cspawn_fileaction const *fa, size_t n)
Forks and execs a child as with exec_ae(file, argv, envp). Returns 0 if it fails, and the pid of the child if it succeeds. Before execing, the following operations are performed in the child: @@ -70,7 +70,7 @@ descriptor fa[i].x.openinfo.fd points to it.

Higher level interfaces

- pid_t child_spawn1_pipe (char const *file, char const *const *argv, char const *const *envp, int *fd, int w)
+ pid_t child_spawn1_pipe (char const *file, char const *const *argv, char const *const *envp, int *fd, int w)
Spawns file as with cspawn() with a flags value of CSPAWN_FLAGS_SIGBLOCKNONE; a pipe is created between the child's stdin (if w is 0) or stdout (if w is nonzero) and the parent. @@ -78,14 +78,14 @@ The parent's end of the pipe will be stored in *fd.

- pid_t child_spawn1_socket (char const *file, char const *const *argv, char const *const *envp, int *fd)
+ pid_t child_spawn1_socket (char const *file, char const *const *argv, char const *const *envp, int *fd)
Like child_spawn1, except that a socket, not a pipe is created between the parent and the child. Both the child's stdin and stdout point to the socket; the parent has its end of the socket available in *fd.

- pid_t child_spawn2 (char const *file, char const *const *argv, char const *const *envp, int *fds)
+ pid_t child_spawn2 (char const *file, char const *const *argv, char const *const *envp, int *fds)
Two pipes are created between the parent and the child. fds must point to an array of 2 ints: this array is read as well as written by child_spawn2(). On function @@ -97,7 +97,7 @@ descriptors for the pipes that read from / write to the child.

- pid_t child_spawn3 (char const *file, char const *const *argv, char const *const *envp, int *fds)
+ pid_t child_spawn3 (char const *file, char const *const *argv, char const *const *envp, int *fds)
Three pipes are created between the parent and the child. fds must point to an array of 3 ints: this array is read as well as written by child_spawn2(). On function @@ -109,9 +109,8 @@ the reading end of a pipe; the writing end is present in the child, and its numb is available as the value of the SKALIBS_CHILD_SPAWN_FDS environment variable.

-

- pid_t child_spawn (char const *file, char const *const *argv, char const *const *envp, int *fds, unsigned int nfds)
+ pid_t child_spawn (char const *file, char const *const *argv, char const *const *envp, int *fds, unsigned int nfds)
More generic spawning function. fds must point to an array of at least nfds ints; file descriptors reading from or writing to the child will be stored there. The function returns 0 on failure or the pid of the child on success. @@ -126,5 +125,12 @@ then any additional fds are available to it in the SKALIBS_CHILD_SPAWN_FDS +

+ pid_t gcspawn (char const *file, char const *const *argv, char const *const *envp, uint32_t flags, cspawn_fileaction const *fa, size_t n)
+Like cspawn, but argv will be running as a grandchild of the +current process. The function forks once, invokes cspawn from the child, +and the child exits after passing the grandchild's pid to the parent. +

+ -- cgit v1.2.3