From 238d90401c07c89dfaeff3a1da67b325b9a56339 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 31 Jan 2014 08:44:00 +0100 Subject: [PATCH] Implement an option to disable use of vfork(). Fixes #5583 --- doc/4.2-global-variables.md | 1 + lib/base/process-unix.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/4.2-global-variables.md b/doc/4.2-global-variables.md index becc1de5e..d550b8743 100644 --- a/doc/4.2-global-variables.md +++ b/doc/4.2-global-variables.md @@ -17,3 +17,4 @@ IcingaEnableEventHandlers |**Read-write.** Whether event handlers are globally e IcingaEnableFlapping |**Read-write.** Whether flap detection is globally enabled. Defaults to true. IcingaEnableChecks |**Read-write.** Whether active checks are globally enabled. Defaults to true. IcingaEnablePerfdata |**Read-write.** Whether performance data processing is globally enabled. Defaults to true. +IcingaUseVfork |**Read-write.** Whether to use vfork(). Only available on *NIX. Defaults to true. diff --git a/lib/base/process-unix.cpp b/lib/base/process-unix.cpp index e4886ae12..15e7f6837 100644 --- a/lib/base/process-unix.cpp +++ b/lib/base/process-unix.cpp @@ -23,6 +23,7 @@ #include "base/objectlock.h" #include "base/logger_fwd.h" #include "base/utility.h" +#include "base/scriptvariable.h" #include #include #include @@ -107,7 +108,12 @@ ProcessResult Process::Run(void) m_ExtraEnvironment.reset(); #ifdef HAVE_VFORK - m_Pid = vfork(); + Value use_vfork = ScriptVariable::Get("IcingaUseVfork"); + + if (use_vfork.IsEmpty() || static_cast(use_vfork)) + m_Pid = vfork(); + else + m_Pid = fork(); #else /* HAVE_VFORK */ m_Pid = fork(); #endif /* HAVE_VFORK */