summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixPipe.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-07-25 10:35:22 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-07-25 10:35:22 (GMT)
commit8733687efc5d3b8d2dd1114b0f5af35c019e9093 (patch)
tree137a2943317f785028496a7083c8a5f767be9b9d /unix/tclUnixPipe.c
parentc1e69b2d6bffd5ec2ca5e44da5fc0754a51b0249 (diff)
downloadtcl-8733687efc5d3b8d2dd1114b0f5af35c019e9093.zip
tcl-8733687efc5d3b8d2dd1114b0f5af35c019e9093.tar.gz
tcl-8733687efc5d3b8d2dd1114b0f5af35c019e9093.tar.bz2
Add (back) check for vfork()
Diffstat (limited to 'unix/tclUnixPipe.c')
-rw-r--r--unix/tclUnixPipe.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c
index e040807..b85ffe0 100644
--- a/unix/tclUnixPipe.c
+++ b/unix/tclUnixPipe.c
@@ -14,30 +14,20 @@
#include "tclInt.h"
#ifdef HAVE_POSIX_SPAWNP
-#ifdef HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
-#ifdef HAVE_POSIX_SPAWNATTR_SETFLAGS
-#include <unistd.h>
-#include <spawn.h>
-#define USE_POSIX_SPAWN 1
-#endif
-#endif
+# if defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2) \
+ && defined(HAVE_POSIX_SPAWNATTR_SETFLAGS)
+# include <unistd.h>
+# include <spawn.h>
+# else
+# undef HAVE_POSIX_SPAWNP
+# endif
#endif
-#ifdef USE_VFORK
+#ifdef HAVE_VFORK
#define fork vfork
#endif
/*
- * For now, test exec-17.1 fails (I/O setup after closing stdout) with
- * posix_spawnp(), but the classic implementation (based on fork()+execvp())
- * works well under macOS.
- */
-
-#ifdef __APPLE__
-#undef USE_POSIX_SPAWN
-#endif
-
-/*
* The following macros convert between TclFile's and fd's. The conversion
* simple involves shifting fd's up by one to ensure that no valid fd is ever
* the same as NULL.
@@ -431,7 +421,7 @@ TclpCreateProcess(
Tcl_DString *dsArray;
char **newArgv;
int pid, i;
-#if defined(USE_POSIX_SPAWN)
+#if defined(HAVE_POSIX_SPAWNP)
int childErrno;
static int use_spawn = -1;
#endif
@@ -463,7 +453,7 @@ TclpCreateProcess(
newArgv[i] = Tcl_UtfToExternalDString(NULL, argv[i], -1, &dsArray[i]);
}
-#if defined(USE_VFORK) || defined(USE_POSIX_SPAWN)
+#if defined(HAVE_VFORK) || defined(HAVE_POSIX_SPAWNP)
/*
* After vfork(), do not call code in the child that changes global state,
* because it is using the parent's memory space at that point and writes
@@ -483,7 +473,7 @@ TclpCreateProcess(
}
#endif
-#ifdef USE_POSIX_SPAWN
+#ifdef HAVE_POSIX_SPAWNP
#ifdef _CS_GNU_LIBC_VERSION
if (use_spawn < 0) {
char conf[32], *p;
@@ -599,7 +589,7 @@ TclpCreateProcess(
TclStackFree(interp, dsArray);
if (pid == -1) {
-#ifdef USE_POSIX_SPAWN
+#ifdef HAVE_POSIX_SPAWNP
errno = childErrno;
#endif
Tcl_SetObjResult(interp, Tcl_ObjPrintf(