summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/forkfd/forkfd.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2020-02-17 11:41:16 -0800
committerEdward Welbourne <eddy@chaos.org.uk>2020-03-25 20:19:38 +0100
commitdefd49f7bfa07395a2f2a69e2f9db94b8ac5d64c (patch)
treec146fc628492cf0619a82a21767831b5ba6a71c8 /src/3rdparty/forkfd/forkfd.h
parentba5e2ce49a43c7d68e2ffa57b9e7f8d5d7fafe2f (diff)
forkfd: add FFD_VFORK_SEMANTICS flag
This flag asks forkfd() to use vfork semantics wherever available. That is, suspend the calling process execution until the child either does an execve(2) or _exit(2). The advantage of that is that it puts lower pressure on the OS VMM system, as the number of pages that need to be copy-on-write duplicated is much smaller (still not zero, as at least the stack in the child will be written to). However, the only implementation that supports using this flag for now is Linux's pidfd. It would be possible to add to FreeBSD, but pdfork(2) does not have a flag for this behavior -- if it gets one, we can add support for it later. Everywhere else, we need to force the child to not exit until we store the child process's PID in the ProcessInfo structure we allocated, which means the parent process must run before we even return from forkfd(). Change-Id: I1bee3bc466a04f19bd6efffd15f447f28c201aa9 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/3rdparty/forkfd/forkfd.h')
-rw-r--r--src/3rdparty/forkfd/forkfd.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/3rdparty/forkfd/forkfd.h b/src/3rdparty/forkfd/forkfd.h
index 205928cc2b..a864b59861 100644
--- a/src/3rdparty/forkfd/forkfd.h
+++ b/src/3rdparty/forkfd/forkfd.h
@@ -38,9 +38,10 @@
extern "C" {
#endif
-#define FFD_CLOEXEC 1
-#define FFD_NONBLOCK 2
-#define FFD_USE_FORK 4
+#define FFD_CLOEXEC 1
+#define FFD_NONBLOCK 2
+#define FFD_USE_FORK 4
+#define FFD_VFORK_SEMANTICS 8
#define FFD_CHILD_PROCESS (-2)