summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-08-11 20:55:52 +0200
committerBruno Haible <bruno@clisp.org>2020-08-11 20:55:52 +0200
commit94ac56c0380279ed0d1ec6bd44040b3d14f47f4e (patch)
tree18bf55b8ccdc8f7a9eeed09d069bf8df0c2a3c71
parentd4ce9ee2e0eb60490b07abec8ab7af926c783982 (diff)
downloadgnulib-94ac56c0380279ed0d1ec6bd44040b3d14f47f4e.tar.gz
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.
-rw-r--r--ChangeLog10
-rw-r--r--doc/posix-functions/fork.texi2
-rw-r--r--lib/execute.c12
-rw-r--r--lib/spawn-pipe.c14
-rw-r--r--lib/wait-process.c2
-rw-r--r--tests/test-nonblocking-pipe-main.c4
-rw-r--r--tests/test-nonblocking-socket-main.c4
7 files changed, 29 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 84549c84bd..cd1fdc96b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
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.
* lib/asyncsafe-spin.c (asyncsafe_spin_init, do_lock, do_unlock): Use
the newer GCC built-ins also on clang.
diff --git a/doc/posix-functions/fork.texi b/doc/posix-functions/fork.texi
index bfbc6e2bab..cae51d1f82 100644
--- a/doc/posix-functions/fork.texi
+++ b/doc/posix-functions/fork.texi
@@ -23,5 +23,5 @@ call. @code{vfork} is a variant of @code{fork} that has been introduced to
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
diff --git a/lib/execute.c b/lib/execute.c
index 686fb7e559..15d9ba98d2 100644
--- a/lib/execute.c
+++ b/lib/execute.c
@@ -141,25 +141,25 @@ execute (const char *progname,
&& ((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)
diff --git a/lib/spawn-pipe.c b/lib/spawn-pipe.c
index b1c0762a7d..947825ac8e 100644
--- a/lib/spawn-pipe.c
+++ b/lib/spawn-pipe.c
@@ -118,7 +118,7 @@ create_pipe (const char *progname,
#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. */
@@ -186,25 +186,25 @@ create_pipe (const char *progname,
/* 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)
diff --git a/lib/wait-process.c b/lib/wait-process.c
index 58a1e1121d..dd9ea1e1c3 100644
--- a/lib/wait-process.c
+++ b/lib/wait-process.c
@@ -44,7 +44,7 @@
# 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)
diff --git a/tests/test-nonblocking-pipe-main.c b/tests/test-nonblocking-pipe-main.c
index e72a9aa6c7..0e132f0037 100644
--- a/tests/test-nonblocking-pipe-main.c
+++ b/tests/test-nonblocking-pipe-main.c
@@ -82,8 +82,8 @@ main (int argc, char *argv[])
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
{
diff --git a/tests/test-nonblocking-socket-main.c b/tests/test-nonblocking-socket-main.c
index c0f885a31d..500479de7c 100644
--- a/tests/test-nonblocking-socket-main.c
+++ b/tests/test-nonblocking-socket-main.c
@@ -69,8 +69,8 @@ main (int argc, char *argv[])
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
{