Implement an option to disable use of vfork().

Fixes #5583
This commit is contained in:
Gunnar Beutner 2014-01-31 08:44:00 +01:00
parent d31ca31e90
commit 238d90401c
2 changed files with 8 additions and 1 deletions

View File

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

View File

@ -23,6 +23,7 @@
#include "base/objectlock.h"
#include "base/logger_fwd.h"
#include "base/utility.h"
#include "base/scriptvariable.h"
#include <boost/bind.hpp>
#include <boost/make_shared.hpp>
#include <boost/foreach.hpp>
@ -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<bool>(use_vfork))
m_Pid = vfork();
else
m_Pid = fork();
#else /* HAVE_VFORK */
m_Pid = fork();
#endif /* HAVE_VFORK */