diff options
Diffstat (limited to 'src/3rdparty')
-rw-r--r-- | src/3rdparty/forkfd/forkfd.c | 14 | ||||
-rw-r--r-- | src/3rdparty/forkfd/forkfd.h | 5 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c index 2ae85d6f37..31189fa2cd 100644 --- a/src/3rdparty/forkfd/forkfd.c +++ b/src/3rdparty/forkfd/forkfd.c @@ -586,6 +586,12 @@ static int create_pipe(int filedes[], int flags) * descriptor. You probably want to set this flag, since forkfd() does not work * if the original parent process dies. * + * @li @C FFD_USE_FORK Tell forkfd() to actually call fork() instead of a + * different system implementation that may be available. On systems where a + * different implementation is available, its behavior may differ from that of + * fork(), such as not calling the functions registered with pthread_atfork(). + * If that's necessary, pass this flag. + * * The file descriptor returned by forkfd() supports the following operations: * * @li read(2) When the child process exits, then the buffer supplied to @@ -613,9 +619,11 @@ int forkfd(int flags, pid_t *ppid) int efd; #endif - fd = system_forkfd(flags, ppid, &ret); - if (ret) - return fd; + if ((flags & FFD_USE_FORK) == 0) { + fd = system_forkfd(flags, ppid, &ret); + if (ret) + return fd; + } (void) pthread_once(&forkfd_initialization, forkfd_initialize); diff --git a/src/3rdparty/forkfd/forkfd.h b/src/3rdparty/forkfd/forkfd.h index eb121de593..fe70371719 100644 --- a/src/3rdparty/forkfd/forkfd.h +++ b/src/3rdparty/forkfd/forkfd.h @@ -38,8 +38,9 @@ extern "C" { #endif -#define FFD_CLOEXEC 1 -#define FFD_NONBLOCK 2 +#define FFD_CLOEXEC 1 +#define FFD_NONBLOCK 2 +#define FFD_USE_FORK 4 #define FFD_CHILD_PROCESS (-2) |