Created
September 6, 2014 20:05
-
-
Save danslo/16de86a5754fa03acf02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git hphp/runtime/base/runtime-option.cpp hphp/runtime/base/runtime-option.cpp | |
index 96c143c..43748b0 100644 | |
--- hphp/runtime/base/runtime-option.cpp | |
+++ hphp/runtime/base/runtime-option.cpp | |
@@ -333,6 +333,7 @@ bool RuntimeOption::EnableObjDestructCall = true; | |
bool RuntimeOption::EnableEmitSwitch = true; | |
bool RuntimeOption::EnableEmitterStats = true; | |
bool RuntimeOption::CheckSymLink = true; | |
+bool RuntimeOption::StrictSignaling = false; | |
int RuntimeOption::MaxUserFunctionId = (2 * 65536); | |
bool RuntimeOption::EnableArgsInBacktraces = true; | |
bool RuntimeOption::EnableZendCompat = false; | |
@@ -819,6 +820,7 @@ void RuntimeOption::Load(const IniSetting::Map& ini, | |
true); | |
Config::Bind(MaxUserFunctionId, ini, eval["MaxUserFunctionId"], 2 * 65536); | |
Config::Bind(CheckSymLink, ini, eval["CheckSymLink"], true); | |
+ Config::Bind(StrictSignaling, ini, eval["StrictSignaling"], true); | |
Config::Bind(EnableAlternative, ini, eval["EnableAlternative"], 0); | |
#define F(type, name, defaultVal) \ | |
diff --git hphp/runtime/base/runtime-option.h hphp/runtime/base/runtime-option.h | |
index b3cee46..d1b4d72 100644 | |
--- hphp/runtime/base/runtime-option.h | |
+++ hphp/runtime/base/runtime-option.h | |
@@ -336,6 +336,7 @@ public: | |
static bool EnableEmitSwitch; | |
static bool EnableEmitterStats; | |
static bool CheckSymLink; | |
+ static bool StrictSignaling; | |
static int MaxUserFunctionId; | |
static bool EnableArgsInBacktraces; | |
static bool EnableZendCompat; | |
diff --git hphp/runtime/ext/ext_process.cpp hphp/runtime/ext/ext_process.cpp | |
index b3d0309..1baac11 100644 | |
--- hphp/runtime/ext/ext_process.cpp | |
+++ hphp/runtime/ext/ext_process.cpp | |
@@ -302,13 +302,23 @@ IMPLEMENT_STATIC_REQUEST_LOCAL(SignalHandlers, s_signal_handlers); | |
// it into various vectors and sets, which is not ok from a signal | |
// handler. | |
static InitFiniNode initSignalHandler( | |
- [] { s_signal_handlers.get(); }, | |
+ [] { | |
+ if (UNLIKELY(!RuntimeOption::StrictSignaling)) { | |
+ s_signal_handlers.get(); | |
+ } | |
+ }, | |
InitFiniNode::When::ThreadInit | |
); | |
static void pcntl_signal_handler(int signo) { | |
+ if (UNLIKELY(RuntimeOption::StrictSignaling) && | |
+ s_signal_handlers.isNull()) { | |
+ raise_error("Caught signal (%d) before any handler was registered. " | |
+ "Please disable strict signaling if you don't want " | |
+ "to worry about this.", signo); | |
+ } | |
if (signo > 0 && signo < _NSIG && !g_context.isNull()) { | |
- s_signal_handlers->signaled[signo] = 1; | |
+ s_signal_handlers.getNoCheck()->signaled[signo] = 1; | |
RequestInjectionData &data = ThreadInfo::s_threadInfo.getNoCheck()-> | |
m_reqInjectionData; | |
data.setSignaledFlag(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment