summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/forkfd
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/forkfd')
-rw-r--r--src/3rdparty/forkfd/forkfd.c16
-rw-r--r--src/3rdparty/forkfd/forkfd_linux.c2
-rw-r--r--src/3rdparty/forkfd/qt_attribution.json4
3 files changed, 11 insertions, 11 deletions
diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c
index 9960e45d4e..edef3c5bcc 100644
--- a/src/3rdparty/forkfd/forkfd.c
+++ b/src/3rdparty/forkfd/forkfd.c
@@ -72,6 +72,10 @@
# undef HAVE_WAITID
#endif
+#if (defined(__FreeBSD__) && defined(__FreeBSD_version) && __FreeBSD_version >= 1300000)
+# include <sys/eventfd.h>
+# define HAVE_EVENTFD 1
+#endif
#if (defined(__FreeBSD__) && defined(__FreeBSD_version) && __FreeBSD_version >= 1000032) || \
(defined(__OpenBSD__) && OpenBSD >= 201505) || \
(defined(__NetBSD__) && __NetBSD_Version__ >= 600000000)
@@ -605,9 +609,7 @@ static int forkfd_fork_fallback(int flags, pid_t *ppid)
int death_pipe[2];
int sync_pipe[2];
int ret;
-#ifdef __linux__
- int efd;
-#endif
+ int efd = -1;
(void) pthread_once(&forkfd_initialization, forkfd_initialize);
@@ -624,9 +626,8 @@ static int forkfd_fork_fallback(int flags, pid_t *ppid)
#ifdef HAVE_EVENTFD
/* try using an eventfd, which consumes less resources */
efd = eventfd(0, EFD_CLOEXEC);
- if (efd == -1)
#endif
- {
+ if (efd == -1) {
/* try a pipe */
if (create_pipe(sync_pipe, FFD_CLOEXEC) == -1) {
/* failed both at eventfd and pipe; fail and pass errno */
@@ -653,14 +654,13 @@ static int forkfd_fork_fallback(int flags, pid_t *ppid)
if (pid == 0) {
/* this is the child process */
/* first, wait for the all clear */
-#ifdef HAVE_EVENTFD
if (efd != -1) {
+#ifdef HAVE_EVENTFD
eventfd_t val64;
EINTR_LOOP(ret, eventfd_read(efd, &val64));
EINTR_LOOP(ret, close(efd));
- } else
#endif
- {
+ } else {
char c;
EINTR_LOOP(ret, close(sync_pipe[1]));
EINTR_LOOP(ret, read(sync_pipe[0], &c, sizeof c));
diff --git a/src/3rdparty/forkfd/forkfd_linux.c b/src/3rdparty/forkfd/forkfd_linux.c
index cc7af6cb53..4dacc1919d 100644
--- a/src/3rdparty/forkfd/forkfd_linux.c
+++ b/src/3rdparty/forkfd/forkfd_linux.c
@@ -157,7 +157,7 @@ static int system_forkfd_pidfd_set_flags(int pidfd, int flags)
int system_vforkfd(int flags, pid_t *ppid, int (*childFn)(void *), void *token, int *system)
{
- __attribute__((aligned(64))) char childStack[4096];
+ __attribute__((aligned(64))) char childStack[SIGSTKSZ];
pid_t pid;
int pidfd;
unsigned long cloneflags = CLONE_PIDFD | CLONE_VFORK | CLONE_VM | SIGCHLD;
diff --git a/src/3rdparty/forkfd/qt_attribution.json b/src/3rdparty/forkfd/qt_attribution.json
index ebbb19c718..1b84779133 100644
--- a/src/3rdparty/forkfd/qt_attribution.json
+++ b/src/3rdparty/forkfd/qt_attribution.json
@@ -3,8 +3,8 @@
"Name": "forkfd",
"QDocModule": "qtcore",
"QtUsage": "Used on most Unix platforms in Qt Core.",
- "Files": "No upstream; treat as final",
- "Files": "forkfd.c forkfd.h forkfd_gcc.h",
+ "Comment": "No upstream; treat as final",
+ "Files": [ "forkfd.c", "forkfd.h", "forkfd_gcc.h" ],
"License": "MIT License",
"LicenseId": "MIT",