summaryrefslogtreecommitdiff
path: root/doc/libstddjb/cspawn.html
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-09-11 19:47:26 +0000
committerLaurent Bercot <ska@appnovation.com>2023-09-11 19:47:26 +0000
commit170480a068841398b5538ae0598fbfda0e7789b5 (patch)
treea7eaecd34451c99725fed8f967cd35a083f601d3 /doc/libstddjb/cspawn.html
parent1b0fce052f0adf2e4f3da7762cd9f4885a5d9da8 (diff)
downloadskalibs-170480a068841398b5538ae0598fbfda0e7789b5.tar.xz
Add gcspawn
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'doc/libstddjb/cspawn.html')
-rw-r--r--doc/libstddjb/cspawn.html20
1 files changed, 13 insertions, 7 deletions
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.
<h3> Primitive </h3>
<p>
-<code> pid_t cspawn (char const *file, char const *const *argv, char const *const *envp, uint32_t flags, cspawn_fileaction const *fa, size_t n) </code> <br />
+<code> pid_t cspawn (char const *file, char const *const *argv, char const *const *envp, uint32_t flags, cspawn_fileaction const *fa, size_t n) </code> <br>
Forks and execs a child as with <tt>exec_ae(file, argv, envp)</tt>.
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 <tt>fa[i].x.openinfo.fd</tt> points to it. </li>
<h3> Higher level interfaces </h3>
<p>
-<code> pid_t child_spawn1_pipe (char const *file, char const *const *argv, char const *const *envp, int *fd, int w) </code> <br />
+<code> pid_t child_spawn1_pipe (char const *file, char const *const *argv, char const *const *envp, int *fd, int w) </code> <br>
Spawns <em>file</em> as with <tt>cspawn()</tt> with a <em>flags</em> value of CSPAWN_FLAGS_SIGBLOCKNONE;
a pipe is created between the child's
stdin (if <em>w</em> is 0) or stdout (if <em>w</em> is nonzero) and the parent.
@@ -78,14 +78,14 @@ The parent's end of the pipe will be stored in *<em>fd</em>.
</p>
<p>
-<code> pid_t child_spawn1_socket (char const *file, char const *const *argv, char const *const *envp, int *fd) </code> <br />
+<code> pid_t child_spawn1_socket (char const *file, char const *const *argv, char const *const *envp, int *fd) </code> <br>
Like <tt>child_spawn1</tt>, 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 *<em>fd</em>.
</p>
<p>
-<code> pid_t child_spawn2 (char const *file, char const *const *argv, char const *const *envp, int *fds) </code> <br />
+<code> pid_t child_spawn2 (char const *file, char const *const *argv, char const *const *envp, int *fds) </code> <br>
Two pipes are created between the
parent and the child. <em>fds</em> must point to an array of 2 ints: this
array is read as well as written by <tt>child_spawn2()</tt>. On function
@@ -97,7 +97,7 @@ descriptors for the pipes that read from / write to the child.
</p>
<p>
-<code> pid_t child_spawn3 (char const *file, char const *const *argv, char const *const *envp, int *fds) </code> <br />
+<code> pid_t child_spawn3 (char const *file, char const *const *argv, char const *const *envp, int *fds) </code> <br>
Three pipes are created between the
parent and the child. <em>fds</em> must point to an array of 3 ints: this
array is read as well as written by <tt>child_spawn2()</tt>. 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 <tt>SKALIBS_CHILD_SPAWN_FDS</tt> environment variable.
</p>
-
<p>
-<code> pid_t child_spawn (char const *file, char const *const *argv, char const *const *envp, int *fds, unsigned int nfds) </code> <br />
+<code> pid_t child_spawn (char const *file, char const *const *argv, char const *const *envp, int *fds, unsigned int nfds) </code> <br>
More generic spawning function. <em>fds</em> must point to an array of at least <em>nfds</em> 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 <tt>SKALIBS_CHILD_SPAWN_FDS</
variable as a comma-separated list of integers. </li>
</ul>
+<p>
+<code> pid_t gcspawn (char const *file, char const *const *argv, char const *const *envp, uint32_t flags, cspawn_fileaction const *fa, size_t n) </code> <br>
+Like <tt>cspawn</tt>, but <em>argv</em> will be running as a grandchild of the
+current process. The function forks once, invokes <tt>cspawn</tt> from the child,
+and the child exits after passing the grandchild's pid to the parent.
+</p>
+
</body>
</html>