summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-03-12 22:58:56 -0700
committerThiago Macieira <thiago.macieira@intel.com>2015-03-14 02:17:36 +0000
commit614f37c8b559a722538c58dd1f65229cfca7d35b (patch)
tree44d9c1444c16dabf7461cfef222a209e650387e0
parent048918d4bd73886e1a8999a06b7af2cd2ddbe5f2 (diff)
forkfd: make only one of forkfd or spawnfd be compiled
We only ever use one, never both. Change-Id: Iee8cbc07c4434ce9b560ffff13caf94c05dba338 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
-rw-r--r--src/3rdparty/forkfd/forkfd.c6
-rw-r--r--src/corelib/io/forkfd_qt.cpp7
2 files changed, 11 insertions, 2 deletions
diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c
index 1b3e162a7e..3f9e82cd45 100644
--- a/src/3rdparty/forkfd/forkfd.c
+++ b/src/3rdparty/forkfd/forkfd.c
@@ -436,6 +436,7 @@ static int create_pipe(int filedes[], int flags)
return ret;
}
+#ifndef FORKFD_NO_FORKFD
/**
* @brief forkfd returns a file descriptor representing a child process
* @return a file descriptor, or -1 in case of failure
@@ -590,8 +591,9 @@ err_free:
freeInfo(header, info);
return -1;
}
+#endif // FORKFD_NO_FORKFD
-#ifdef _POSIX_SPAWN
+#if defined(_POSIX_SPAWN) && !defined(FORKFD_NO_SPAWNFD)
int spawnfd(int flags, pid_t *ppid, const char *path, const posix_spawn_file_actions_t *file_actions,
posix_spawnattr_t *attrp, char *const argv[], char *const envp[])
{
@@ -652,4 +654,4 @@ err_free:
out:
return -1;
}
-#endif // _POSIX_SPAWN
+#endif // _POSIX_SPAWN && !FORKFD_NO_SPAWNFD
diff --git a/src/corelib/io/forkfd_qt.cpp b/src/corelib/io/forkfd_qt.cpp
index 56a39f8df0..dadc42151c 100644
--- a/src/corelib/io/forkfd_qt.cpp
+++ b/src/corelib/io/forkfd_qt.cpp
@@ -40,6 +40,13 @@
#endif
#include <QtCore/qatomic.h>
+#include "qprocess_p.h"
+
+#ifdef QPROCESS_USE_SPAWN
+# define FORKFD_NO_FORKFD
+#else
+# define FORKFD_NO_SPAWNFD
+#endif
#if defined(QT_NO_DEBUG) && !defined(NDEBUG)
# define NDEBUG