diff --git a/hphp/runtime/base/file/php_stream_wrapper.cpp b/hphp/runtime/base/file/php_stream_wrapper.cpp index dd568d0b3..cd8a046fd 100644 --- a/hphp/runtime/base/file/php_stream_wrapper.cpp +++ b/hphp/runtime/base/file/php_stream_wrapper.cpp @@ -25,7 +25,7 @@ namespace HPHP { /////////////////////////////////////////////////////////////////////////////// File *PhpStreamWrapper::openFD(const char *sFD) { - if (!RuntimeOption::clientExecutionMode()) { + if (!RuntimeOption::ClientExecutionMode()) { raise_warning("Direct access to file descriptors " "is only available from command-line"); return nullptr; diff --git a/hphp/runtime/base/program_functions.cpp b/hphp/runtime/base/program_functions.cpp index 3b2c33036..0caae61d2 100644 --- a/hphp/runtime/base/program_functions.cpp +++ b/hphp/runtime/base/program_functions.cpp @@ -1322,7 +1322,7 @@ bool hphp_invoke(ExecutionContext *context, const std::string &cmd, bool &error, string &errorMsg, bool once /* = true */, bool warmupOnly /* = false */, bool richErrorMsg /* = false */) { - bool isServer = RuntimeOption::serverExecutionMode(); + bool isServer = RuntimeOption::ServerExecutionMode(); error = false; String oldCwd; diff --git a/hphp/runtime/base/runtime_option.cpp b/hphp/runtime/base/runtime_option.cpp index cc932b095..9f2438681 100644 --- a/hphp/runtime/base/runtime_option.cpp +++ b/hphp/runtime/base/runtime_option.cpp @@ -13,7 +13,10 @@ | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ */ -// Get SIZE_MAX definition. Do this before including any other files, to make + +#include "hphp/runtime/base/runtime_option.h" + +// Get SIZE_MAX definition. Do this before including any more files, to make // sure that this is the first place that stdint.h is included. #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS @@ -21,7 +24,6 @@ #define __STDC_LIMIT_MACROS #include -#include "hphp/runtime/base/runtime_option.h" #include "hphp/runtime/base/type_conversions.h" #include "hphp/runtime/base/builtin_functions.h" #include "hphp/runtime/base/shared/shared_store_base.h" @@ -382,7 +384,7 @@ int RuntimeOption::GetScannerType() { static inline bool evalJitDefault() { // --mode server or --mode daemon // run long enough to justify JIT - if (RuntimeOption::serverExecutionMode()) { + if (RuntimeOption::ServerExecutionMode()) { return true; } diff --git a/hphp/runtime/base/runtime_option.h b/hphp/runtime/base/runtime_option.h index 8f55f41d7..b1b45e163 100644 --- a/hphp/runtime/base/runtime_option.h +++ b/hphp/runtime/base/runtime_option.h @@ -36,11 +36,11 @@ public: static bool Loaded; - static bool serverExecutionMode() { + static bool ServerExecutionMode() { return strcmp(ExecutionMode, "srv") == 0; } - static bool clientExecutionMode() { + static bool ClientExecutionMode() { return strcmp(ExecutionMode, "cli") == 0; } diff --git a/hphp/runtime/base/server/http_protocol.cpp b/hphp/runtime/base/server/http_protocol.cpp index ef6f31043..0ee7b9ffe 100644 --- a/hphp/runtime/base/server/http_protocol.cpp +++ b/hphp/runtime/base/server/http_protocol.cpp @@ -140,7 +140,7 @@ void HttpProtocol::PrepareSystemVariables(Transport *transport, g->GV(_ENV).set(s_HHVM_JIT, 1); } - bool isServer = RuntimeOption::serverExecutionMode(); + bool isServer = RuntimeOption::ServerExecutionMode(); if (isServer) { g->GV(_ENV).set(s_HPHP_SERVER, 1); #ifdef HOTPROFILER diff --git a/hphp/runtime/base/server/rpc_request_handler.cpp b/hphp/runtime/base/server/rpc_request_handler.cpp index 97ffad4d8..ae936e42d 100644 --- a/hphp/runtime/base/server/rpc_request_handler.cpp +++ b/hphp/runtime/base/server/rpc_request_handler.cpp @@ -14,8 +14,9 @@ +----------------------------------------------------------------------+ */ -#include "hphp/runtime/base/server/http_request_handler.h" #include "hphp/runtime/base/server/rpc_request_handler.h" + +#include "hphp/runtime/base/server/http_request_handler.h" #include "hphp/runtime/base/program_functions.h" #include "hphp/runtime/base/runtime_option.h" #include "hphp/runtime/base/server/server_stats.h" @@ -35,7 +36,7 @@ RPCRequestHandler::RPCRequestHandler(bool info /* = true */) : m_count(0), m_reset(false), m_returnEncodeType(Json) { hphp_session_init(); - bool isServer = RuntimeOption::serverExecutionMode(); + bool isServer = RuntimeOption::ServerExecutionMode(); if (isServer) { m_context = hphp_context_init(); } else { diff --git a/hphp/runtime/base/type_string.cpp b/hphp/runtime/base/type_string.cpp index 591b0df6a..a71cca84f 100644 --- a/hphp/runtime/base/type_string.cpp +++ b/hphp/runtime/base/type_string.cpp @@ -60,7 +60,7 @@ static int precompute_integers() { (StringData const **)calloc(NUM_CONVERTED_INTEGERS, sizeof(StringData*)); String::converted_integers = String::converted_integers_raw - String::MinPrecomputedInteger; - if (RuntimeOption::serverExecutionMode()) { + if (RuntimeOption::ServerExecutionMode()) { // Proactively populate, in order to increase cache locality for sequential // access patterns. for (int n = String::MinPrecomputedInteger; diff --git a/hphp/runtime/ext/ext_error.cpp b/hphp/runtime/ext/ext_error.cpp index 019b8c42f..98c75c7a0 100644 --- a/hphp/runtime/ext/ext_error.cpp +++ b/hphp/runtime/ext/ext_error.cpp @@ -108,7 +108,7 @@ bool f_error_log(CStrRef message, int message_type /* = 0 */, std::string line(message.data(), // Truncate to 512k message.size() > (1<<19) ? (1<<19) : message.size()); - if (RuntimeOption::serverExecutionMode() || + if (RuntimeOption::ServerExecutionMode() || RuntimeOption::AlwaysEscapeLog) { Logger::Error(line); } else { diff --git a/hphp/runtime/ext/ext_options.cpp b/hphp/runtime/ext/ext_options.cpp index ec660911e..58b0e49bc 100644 --- a/hphp/runtime/ext/ext_options.cpp +++ b/hphp/runtime/ext/ext_options.cpp @@ -780,7 +780,7 @@ void f_set_time_limit(int seconds) { TimeoutThread::DeferTimeout(seconds); // Just for ini_get g_context->setRequestTimeLimit(seconds); - if (RuntimeOption::clientExecutionMode() && + if (RuntimeOption::ClientExecutionMode() && seconds != 0) { raise_warning("set_time_limit is not supported in client mode"); } diff --git a/hphp/runtime/ext/ext_process.cpp b/hphp/runtime/ext/ext_process.cpp index d3942ec78..b1ae5fe80 100644 --- a/hphp/runtime/ext/ext_process.cpp +++ b/hphp/runtime/ext/ext_process.cpp @@ -148,7 +148,7 @@ void f_pcntl_exec(CStrRef path, CArrRef args /* = null_array */, } int64_t f_pcntl_fork() { - if (RuntimeOption::serverExecutionMode()) { + if (RuntimeOption::ServerExecutionMode()) { raise_error("forking is disallowed in server mode"); return -1; } diff --git a/hphp/runtime/vm/repo.cpp b/hphp/runtime/vm/repo.cpp index 56dcb268a..6794a295e 100644 --- a/hphp/runtime/vm/repo.cpp +++ b/hphp/runtime/vm/repo.cpp @@ -493,7 +493,7 @@ void Repo::initLocal() { if (!RuntimeOption::RepoLocalPath.empty()) { attachLocal(RuntimeOption::RepoLocalPath.c_str(), isWritable); } else { - if (RuntimeOption::clientExecutionMode()) { + if (RuntimeOption::ClientExecutionMode()) { std::string cliRepo = s_cliFile; if (!cliRepo.empty()) { cliRepo += ".hhbc"; diff --git a/hphp/runtime/vm/type_profile.cpp b/hphp/runtime/vm/type_profile.cpp index 017f63f94..3da901b53 100644 --- a/hphp/runtime/vm/type_profile.cpp +++ b/hphp/runtime/vm/type_profile.cpp @@ -159,13 +159,13 @@ static int64_t numRequests; static inline bool warmedUp() { return (numRequests >= RuntimeOption::EvalJitWarmupRequests) || - (RuntimeOption::clientExecutionMode() && + (RuntimeOption::ClientExecutionMode() && !RuntimeOption::EvalJitProfileRecord); } static inline bool profileThisRequest() { if (warmedUp()) return false; - if (RuntimeOption::serverExecutionMode()) return true; + if (RuntimeOption::ServerExecutionMode()) return true; return RuntimeOption::EvalJitProfileRecord; }