* lib/execute.c (execute): Use _spawnvpe, not spawnvpe.
* lib/spawn-pipe.c (create_pipe): Likewise.
* tests/test-nonblocking-pipe-main.c (main): Likewise.
* tests/test-nonblocking-socket-main.c (main): Likewise.
* lib/wait-process.c: Update comment.
* doc/posix-functions/fork.texi: Update.
+2020-08-11 Bruno Haible <bruno@clisp.org>
+
+ execute, spawn-pipe: Use _spawnvpe, not spawnvpe.
+ * lib/execute.c (execute): Use _spawnvpe, not spawnvpe.
+ * lib/spawn-pipe.c (create_pipe): Likewise.
+ * tests/test-nonblocking-pipe-main.c (main): Likewise.
+ * tests/test-nonblocking-socket-main.c (main): Likewise.
+ * lib/wait-process.c: Update comment.
+ * doc/posix-functions/fork.texi: Update.
+
2020-08-11 Bruno Haible <bruno@clisp.org>
asyncsafe-spin: Use GCC built-ins also on clang.
optimize the @code{fork}/@code{exec} pattern.
@item
On Windows platforms (excluding Cygwin), this function is not implemented; use
-@code{spawnvp} instead.
+@code{_spawnvp} instead.
@end itemize
&& ((null_stdout && nulloutfd == STDOUT_FILENO)
|| (null_stderr && nulloutfd == STDERR_FILENO)
|| close (nulloutfd) >= 0))))
- /* Use spawnvpe and pass the environment explicitly. This is needed if
+ /* Use _spawnvpe and pass the environment explicitly. This is needed if
the program has modified the environment using putenv() or [un]setenv().
On Windows, programs have two environments, one in the "environment
block" of the process and managed through SetEnvironmentVariable(), and
one inside the process, in the location retrieved by the 'environ'
- macro. When using spawnvp() without 'e', the child process inherits a
+ macro. When using _spawnvp() without 'e', the child process inherits a
copy of the environment block - ignoring the effects of putenv() and
[un]setenv(). */
{
- exitcode = spawnvpe (P_WAIT, prog_path, (const char **) prog_argv,
- (const char **) environ);
+ exitcode = _spawnvpe (P_WAIT, prog_path, (const char **) prog_argv,
+ (const char **) environ);
if (exitcode < 0 && errno == ENOEXEC)
{
/* prog is not a native executable. Try to execute it as a
shell script. Note that prepare_spawn() has already prepended
a hidden element "sh.exe" to prog_argv. */
--prog_argv;
- exitcode = spawnvpe (P_WAIT, prog_argv[0], (const char **) prog_argv,
- (const char **) environ);
+ exitcode = _spawnvpe (P_WAIT, prog_argv[0], (const char **) prog_argv,
+ (const char **) environ);
}
}
if (nulloutfd >= 0)
#if (defined _WIN32 && ! defined __CYGWIN__) || defined __KLIBC__
/* Native Windows API.
- This uses _pipe(), dup2(), and spawnv(). It could also be implemented
+ This uses _pipe(), dup2(), and _spawnv(). It could also be implemented
using the low-level functions CreatePipe(), DuplicateHandle(),
CreateProcess() and _open_osfhandle(); see the GNU make and GNU clisp
and cvs source code. */
/* The child process doesn't inherit ifd[0], ifd[1], ofd[0], ofd[1],
but it inherits all open()ed or dup2()ed file handles (which is what
we want in the case of STD*_FILENO). */
- /* Use spawnvpe and pass the environment explicitly. This is needed if
+ /* Use _spawnvpe and pass the environment explicitly. This is needed if
the program has modified the environment using putenv() or [un]setenv().
On Windows, programs have two environments, one in the "environment
block" of the process and managed through SetEnvironmentVariable(), and
one inside the process, in the location retrieved by the 'environ'
- macro. When using spawnvp() without 'e', the child process inherits a
+ macro. When using _spawnvp() without 'e', the child process inherits a
copy of the environment block - ignoring the effects of putenv() and
[un]setenv(). */
{
- child = spawnvpe (P_NOWAIT, prog_path, (const char **) prog_argv,
- (const char **) environ);
+ child = _spawnvpe (P_NOWAIT, prog_path, (const char **) prog_argv,
+ (const char **) environ);
if (child < 0 && errno == ENOEXEC)
{
/* prog is not a native executable. Try to execute it as a
shell script. Note that prepare_spawn() has already prepended
a hidden element "sh.exe" to prog_argv. */
--prog_argv;
- child = spawnvpe (P_NOWAIT, prog_argv[0], (const char **) prog_argv,
- (const char **) environ);
+ child = _spawnvpe (P_NOWAIT, prog_argv[0], (const char **) prog_argv,
+ (const char **) environ);
}
}
if (child == -1)
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
-/* The return value of spawnvp() is really a process handle as returned
+/* The return value of _spawnvp() is really a process handle as returned
by CreateProcess(). Therefore we can kill it using TerminateProcess. */
# define kill(pid,sig) TerminateProcess ((HANDLE) (pid), sig)
child_argv[2] = NULL;
#if defined _WIN32 && ! defined __CYGWIN__
- child = spawnvpe (P_NOWAIT, child_path, child_argv,
- (const char **) environ);
+ child = _spawnvpe (P_NOWAIT, child_path, child_argv,
+ (const char **) environ);
ASSERT (child >= 0);
#else
{
child_argv[3] = NULL;
#if defined _WIN32 && ! defined __CYGWIN__
- child = spawnvpe (P_NOWAIT, child_path, child_argv,
- (const char **) environ);
+ child = _spawnvpe (P_NOWAIT, child_path, child_argv,
+ (const char **) environ);
ASSERT (child >= 0);
#else
{