diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/libstddjb/djbunix.html | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/doc/libstddjb/djbunix.html b/doc/libstddjb/djbunix.html index 54aaf50..95f3777 100644 --- a/doc/libstddjb/djbunix.html +++ b/doc/libstddjb/djbunix.html @@ -346,127 +346,6 @@ Opens <em>file</em> in write-only, non-blocking mode, close-on-exec. Returns a valid fd number if it succeeds, or -1 (and sets errno) if it fails. </p> -<h3> Executable search and execution, and environment </h3> - -<p> -<code> void execvep_loose (char const *file, char const *const *argv, char const *const *envp, char const *path) </code> <br /> -Executes into the executable file at <em>file</em>, with the command line -set to <em>argv</em> and the environment set to <em>envp</em>. -If <em>file</em> is not an absolute path, it is searched in the -<em>path</em> string, which must contain a colon-separated list of -search directories such as the contents of the PATH environment variable. -The function returns if it fails, and sets errno to the most relevant -error that happened. -</p> - -<p> -<code> void execvep (char const *file, char const *const *argv, char const *const *envp, char const *path) </code> <br /> -Like <tt>execvep_loose()</tt>, but if <em>file</em> contains a slash, -it is treated as an absolute path. -</p> - -<p> -<code> void pathexec_run (char const *file, char const *const *argv, char const *const *envp) </code> <br /> -Performs <tt>execvep(file, argv, envp, path)</tt>, <em>path</em> being the -contents of the PATH environment variable. If PATH is not set, <em>path</em> -is set to the value given to the <tt>--with-default-path</tt> option of the -skalibs' <tt>./configure</tt> script, or to <tt>/usr/bin:/bin</tt> by default. -The function returns if it fails, and sets errno appropriately. -</p> - -<p> - <tt>pathexec_run()</tt> is the standard skalibs API to perform an -<tt>exec</tt> call with a path search. It is recommended that you use -it instead of the Single Unix -<a href="https://www.opengroup.org/onlinepubs/9699919799/functions/execvp.html">execvp()</a> or -<a href="https://www.opengroup.org/onlinepubs/9699919799/functions/execlp.html">execlp()</a> -functions, because <tt>execvp</tt> and <tt>execlp</tt> default to execution of -the <tt>/bin/sh</tt> interpreter with <em>file</em> as an argument if they -cannot find a suitable executable <em>file</em>, and this is: -</p> - -<ol> - <li> a security risk, </li> - <li> probably not what you want. </li> -</ol> - -<p> - <tt>execvep()</tt> and <tt>pathexec_run()</tt> just fail with ENOENT -when they cannot find a <em>file</em> to exec into, which is the -sensible behaviour. -</p> - -<p> -<code> void pathexec0_run (char const *const *argv, char const *const *envp) </code> <br /> -Performs <tt>pathexec_run(argv[0], argv, envp)</tt>. If <em>argv</em> is empty, i.e. -<em>argv</em>[0] is null, the process exits 0 instead. Rationale: executing -the empty command line should amount to executing <tt>true</tt>, i.e. -simply exiting 0. -</p> - -<p> -<code> void pathexec_r_name (char const *file, char const *const *argv, char const *const *envp, size_t envlen, char const *modifs, size_t modiflen) </code> <br /> -Alters <em>envp</em> (which does not have to be NULL-terminated, but the -number <em>envlen</em> of elements must be provided) with the modifier -string <em>modifs</em> of length <em>modiflen</em>, then performs -<tt>pathexec_run(file, argv, altered-envp)</tt>. -</p> - -<p> -<code> void pathexec_r (char const *const *argv, char const *const *envp, size_t envlen, char const *modifs, size_t modiflen) </code> <br /> -Same as <tt>pathexec_r_name</tt>, except that the <em>file</em> argument is read from <em>argv</em>[0]. -</p> - -<p> -<code> int pathexec_env (char const *var, char const *value) </code> <br /> -Adds the "add variable <em>var</em> with value <em>value</em>" instruction -(if <em>value</em> is not null) or the "unset <em>var</em>" instruction -(if <em>value</em> is null) to a static hidden modifier string, used by the -following three functions. -Returns 1 if it succeeds and 0 (and sets errno) if it fails. -</p> - -<p> -<code> void pathexec_fromenv (char const *const *argv, char const *const *envp, size_t envlen) </code> <br /> -Performs <tt>pathexec_r()</tt> with the given arguments and the hidden modifier -string. -</p> - -<p> -<code> void pathexec (char const *const *argv) </code> <br /> -Executes into the <em>argv</em> command line, with the current environment -modified by the hidden modifier string. -</p> - -<p> -<code> void pathexec0 (char const *const *argv) </code> <br /> -Executes into the <em>argv</em> command line, with the current environment -modified by the hidden modifier string. If this command line is empty, -exit 0 instead. -</p> - -<p> <code> -void xexecvep (char const *, char const *const *, char const *const *, char const *) <br /> -void xpathexec_r (char const *const *, char const *const *, size_t, char const *, size_t) <br /> -void xpathexec_r_name (char const *, char const *const *, char const *const *, size_t, char const *, size_t) <br /> -void xpathexec_fromenv (char const *const *, char const *const *, size_t) <br /> -void xpathexec_run (char const *, char const *const *, char const *const *) <br /> -void xpathexec0_run (char const *const *, char const *const *) <br /> -void xpathexec (char const *const *) <br /> -void xpathexec0 (char const *const *) -</code> </p> - -<p> - Those functions provide the same functionality as the non-x-prefixed versions, -but if the execution fails (i.e. the process cannot exec into a new program), then -the process dies with a 111 exit code and an error message on stderr. -</p> - -<p> - The <a href="env.html">env</a> library interface provides additional functions -to manipulate modifier strings and environments. -</p> - <h3> Forking children </h3> <p> |