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>
This commit is contained in:
Thiago Macieira 2015-03-12 22:58:56 -07:00
parent 048918d4bd
commit 614f37c8b5
2 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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