passenger 5.3.4 → 6.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +69 -0
- data/CONTRIBUTORS +1 -0
- data/README.md +2 -1
- data/Rakefile +0 -5
- data/build/agent.rb +6 -3
- data/build/cxx_tests.rb +28 -19
- data/build/integration_tests.rb +6 -2
- data/build/misc.rb +2 -1
- data/build/packaging.rb +2 -0
- data/build/support/cplusplus.rb +2 -2
- data/build/support/cxx_dependency_map.rb +2651 -2189
- data/dev/colorize-logs +272 -0
- data/dev/show-latest-crashlog-dir +27 -0
- data/resources/templates/standalone/http.erb +2 -0
- data/resources/templates/standalone/server.erb +1 -0
- data/src/agent/AgentMain.cpp +4 -0
- data/src/agent/Core/AdminPanelConnector.h +6 -6
- data/src/agent/Core/ApiServer.h +4 -4
- data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +2 -2
- data/src/agent/Core/ApplicationPool/Context.h +5 -1
- data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +2 -2
- data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +5 -0
- data/src/agent/Core/ApplicationPool/Group/Miscellaneous.cpp +2 -1
- data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +3 -3
- data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +13 -20
- data/src/agent/Core/ApplicationPool/Group.h +4 -2
- data/src/agent/Core/ApplicationPool/Implementation.cpp +5 -5
- data/src/agent/Core/ApplicationPool/Options.h +42 -38
- data/src/agent/Core/ApplicationPool/Pool/GroupUtils.cpp +2 -1
- data/src/agent/Core/ApplicationPool/Pool.h +4 -4
- data/src/agent/Core/ApplicationPool/Process.h +13 -15
- data/src/agent/Core/ApplicationPool/Socket.h +5 -5
- data/src/agent/Core/ApplicationPool/TestSession.h +3 -3
- data/src/agent/Core/Config.h +50 -10
- data/src/agent/Core/ConfigChange.cpp +13 -1
- data/src/agent/Core/Controller/Config.h +41 -17
- data/src/agent/Core/Controller/ForwardResponse.cpp +4 -0
- data/src/agent/Core/Controller/InitRequest.cpp +14 -8
- data/src/agent/Core/Controller/InitializationAndShutdown.cpp +5 -0
- data/src/agent/Core/Controller/SendRequest.cpp +9 -9
- data/src/agent/Core/Controller/TurboCaching.h +2 -2
- data/src/agent/Core/Controller.h +7 -5
- data/src/agent/Core/CoreMain.cpp +204 -60
- data/src/agent/Core/OptionParser.h +20 -3
- data/src/agent/Core/ResponseCache.h +3 -3
- data/src/agent/Core/SecurityUpdateChecker.h +4 -2
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/Config.h +3 -2
- data/src/agent/Core/SpawningKit/Context.h +8 -2
- data/src/agent/Core/SpawningKit/DirectSpawner.h +4 -4
- data/src/agent/Core/SpawningKit/DummySpawner.h +3 -3
- data/src/agent/Core/SpawningKit/ErrorRenderer.h +1 -1
- data/src/agent/Core/SpawningKit/Exceptions.h +21 -14
- data/src/agent/Core/SpawningKit/Factory.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/BackgroundIOCapturer.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/Perform.h +14 -2
- data/src/agent/Core/SpawningKit/Handshake/Prepare.h +3 -3
- data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +1 -1
- data/src/agent/Core/SpawningKit/Journey.h +4 -5
- data/src/agent/Core/SpawningKit/PipeWatcher.h +1 -1
- data/src/agent/Core/SpawningKit/README.md +34 -17
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/Result.h +20 -8
- data/src/agent/Core/SpawningKit/SmartSpawner.h +7 -7
- data/src/agent/Core/SpawningKit/Spawner.h +25 -8
- data/src/agent/Core/SpawningKit/UserSwitchingRules.h +17 -7
- data/src/agent/Core/TelemetryCollector.h +681 -0
- data/src/agent/ExecHelper/ExecHelperMain.cpp +1 -1
- data/src/agent/FileReadHelper/FileReadHelperMain.cpp +198 -0
- data/src/agent/README.md +1 -1
- data/src/agent/Shared/ApiAccountUtils.h +1 -1
- data/src/agent/Shared/ApiServerUtils.h +3 -3
- data/src/agent/Shared/ApplicationPoolApiKey.h +2 -2
- data/src/agent/Shared/Fundamentals/AbortHandler.cpp +324 -98
- data/src/agent/Shared/Fundamentals/AbortHandler.h +31 -4
- data/src/agent/Shared/Fundamentals/Initialization.cpp +4 -5
- data/src/agent/Shared/Fundamentals/Initialization.h +9 -1
- data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +1 -1
- data/src/agent/SystemMetrics/SystemMetricsMain.cpp +4 -3
- data/src/agent/TempDirToucher/TempDirToucherMain.cpp +3 -3
- data/src/agent/Watchdog/ApiServer.h +3 -3
- data/src/agent/Watchdog/Config.h +24 -5
- data/src/agent/Watchdog/CoreWatcher.cpp +2 -2
- data/src/agent/Watchdog/WatchdogMain.cpp +97 -28
- data/src/apache2_module/Config.cpp +14 -14
- data/src/apache2_module/Config.h +8 -16
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +510 -481
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp.cxxcodebuilder +39 -17
- data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +69 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp.cxxcodebuilder +31 -1
- data/src/apache2_module/ConfigGeneral/Common.h +45 -0
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +17 -1
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp.cxxcodebuilder +16 -1
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +19 -5
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp.cxxcodebuilder +26 -9
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +19 -1
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +10 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +14 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp.cxxcodebuilder +11 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +36 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h.cxxcodebuilder +34 -1
- data/src/apache2_module/DirectoryMapper.h +36 -37
- data/src/apache2_module/Hooks.cpp +27 -8
- data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +20 -0
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +48 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h.cxxcodebuilder +36 -1
- data/src/cxx_supportlib/{Utils → Algorithms}/Hasher.cpp +2 -2
- data/src/cxx_supportlib/{Utils → Algorithms}/Hasher.h +4 -4
- data/src/cxx_supportlib/AppLocalConfigFileUtils.h +148 -0
- data/src/cxx_supportlib/AppTypeDetector/CBindings.cpp +147 -0
- data/src/cxx_supportlib/AppTypeDetector/CBindings.h +75 -0
- data/src/cxx_supportlib/{AppTypes.h → AppTypeDetector/Detector.h} +92 -131
- data/src/cxx_supportlib/ConfigKit/README.md +90 -2
- data/src/cxx_supportlib/ConfigKit/Schema.h +60 -15
- data/src/cxx_supportlib/ConfigKit/Store.h +129 -5
- data/src/cxx_supportlib/Constants.h +1 -1
- data/src/cxx_supportlib/{Utils → DataStructures}/HashMap.h +4 -4
- data/src/cxx_supportlib/DataStructures/HashedStaticString.h +5 -5
- data/src/cxx_supportlib/DataStructures/LString.h +3 -3
- data/src/cxx_supportlib/{Utils → DataStructures}/StringMap.h +36 -36
- data/src/cxx_supportlib/FileTools/FileManip.cpp +1 -1
- data/src/cxx_supportlib/FileTools/PathManip.cpp +2 -2
- data/src/cxx_supportlib/FileTools/PathSecurityCheck.cpp +1 -1
- data/src/cxx_supportlib/Hooks.h +2 -2
- data/src/cxx_supportlib/{Utils → IOTools}/BufferedIO.h +5 -5
- data/src/cxx_supportlib/{Utils → IOTools}/IOUtils.cpp +4 -3
- data/src/cxx_supportlib/{Utils → IOTools}/IOUtils.h +3 -3
- data/src/cxx_supportlib/{Utils → IOTools}/MessageIO.h +7 -7
- data/src/cxx_supportlib/{MessageReadersWriters.h → IOTools/MessageSerialization.h} +5 -5
- data/src/cxx_supportlib/InstanceDirectory.h +4 -4
- data/src/cxx_supportlib/Integrations/LibevJsonUtils.h +3 -3
- data/src/cxx_supportlib/{Utils → JsonTools}/JsonUtils.h +5 -5
- data/src/cxx_supportlib/LoggingKit/Context.h +2 -2
- data/src/cxx_supportlib/LoggingKit/Implementation.cpp +3 -3
- data/src/cxx_supportlib/MemoryKit/mbuf.cpp +2 -2
- data/src/cxx_supportlib/ProcessManagement/Ruby.cpp +3 -3
- data/src/cxx_supportlib/ProcessManagement/Ruby.h +7 -2
- data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +19 -12
- data/src/cxx_supportlib/ProcessManagement/Spawn.h +21 -2
- data/src/cxx_supportlib/ProcessManagement/Utils.h +10 -0
- data/src/cxx_supportlib/RandomGenerator.h +2 -2
- data/src/cxx_supportlib/ResourceLocator.h +1 -1
- data/src/cxx_supportlib/{Crypto.cpp → SecurityKit/Crypto.cpp} +4 -4
- data/src/cxx_supportlib/{Crypto.h → SecurityKit/Crypto.h} +4 -4
- data/src/cxx_supportlib/{Utils → SecurityKit}/MemZeroGuard.h +0 -0
- data/src/cxx_supportlib/ServerKit/AcceptLoadBalancer.h +2 -2
- data/src/cxx_supportlib/ServerKit/Channel.h +1 -1
- data/src/cxx_supportlib/ServerKit/ClientRef.h +17 -7
- data/src/cxx_supportlib/ServerKit/Context.h +2 -2
- data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +3 -3
- data/src/cxx_supportlib/ServerKit/HttpHeaderParserState.h +2 -2
- data/src/cxx_supportlib/ServerKit/HttpRequestRef.h +17 -7
- data/src/cxx_supportlib/ServerKit/HttpServer.h +16 -10
- data/src/cxx_supportlib/ServerKit/Server.h +3 -4
- data/src/cxx_supportlib/{Utils → StrIntTools}/DateParsing.h +5 -5
- data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtils.cpp +3 -3
- data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtils.h +0 -0
- data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtilsNoStrictAliasing.cpp +12 -12
- data/src/cxx_supportlib/{Utils → StrIntTools}/StringScanning.h +5 -5
- data/src/cxx_supportlib/{Utils → StrIntTools}/Template.h +30 -5
- data/src/cxx_supportlib/SystemTools/ContainerHelpers.h +88 -0
- data/src/cxx_supportlib/{Utils → SystemTools}/ProcessMetricsCollector.h +15 -12
- data/src/cxx_supportlib/{Utils → SystemTools}/SystemMetricsCollector.h +3 -3
- data/src/cxx_supportlib/{Utils → SystemTools}/SystemTime.cpp +1 -1
- data/src/cxx_supportlib/{Utils → SystemTools}/SystemTime.h +0 -0
- data/src/cxx_supportlib/SystemTools/UserDatabase.h +1 -1
- data/src/cxx_supportlib/Utils/CachedFileStat.hpp +3 -3
- data/src/cxx_supportlib/Utils/Curl.h +2 -2
- data/src/cxx_supportlib/Utils/FileChangeChecker.h +2 -2
- data/src/cxx_supportlib/Utils/MessagePassing.h +1 -1
- data/src/cxx_supportlib/Utils/SpeedMeter.h +2 -2
- data/src/cxx_supportlib/Utils/Timer.h +2 -2
- data/src/cxx_supportlib/Utils/VariantMap.h +3 -3
- data/src/cxx_supportlib/Utils.cpp +2 -2
- data/src/cxx_supportlib/WatchdogLauncher.h +3 -3
- data/src/cxx_supportlib/WebSocketCommandReverseServer.h +1 -1
- data/src/cxx_supportlib/WrapperRegistry/CBindings.cpp +85 -0
- data/src/cxx_supportlib/{Utils/MemoryBarrier.h → WrapperRegistry/CBindings.h} +30 -27
- data/src/cxx_supportlib/WrapperRegistry/Entry.h +112 -0
- data/src/cxx_supportlib/WrapperRegistry/README.md +37 -0
- data/src/cxx_supportlib/WrapperRegistry/Registry.h +309 -0
- data/src/cxx_supportlib/vendor-modified/psg_sysqueue.h +3 -0
- data/src/helper-scripts/download_binaries/extconf.rb +6 -2
- data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +32 -0
- data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +12 -0
- data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +36 -0
- data/src/nginx_module/Configuration.c +23 -3
- data/src/nginx_module/ContentHandler.c +331 -32
- data/src/nginx_module/ContentHandler.h +8 -3
- data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +10 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +27 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +3 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +7 -0
- data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +11 -0
- data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +23 -0
- data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +8 -0
- data/src/nginx_module/config +2 -1
- data/src/nginx_module/ngx_http_passenger_module.c +9 -3
- data/src/nginx_module/ngx_http_passenger_module.h +10 -3
- data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +19 -0
- data/src/ruby_supportlib/phusion_passenger/common_library.rb +19 -16
- data/src/ruby_supportlib/phusion_passenger/config/agent_compiler.rb +4 -4
- data/src/ruby_supportlib/phusion_passenger/config/download_agent_command.rb +6 -2
- data/src/ruby_supportlib/phusion_passenger/config/download_nginx_engine_command.rb +6 -2
- data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/message_channel.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/native_support.rb +7 -3
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +29 -0
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +20 -19
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +22 -4
- data/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb +33 -13
- data/src/ruby_supportlib/phusion_passenger/standalone/app_finder.rb +1 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +22 -2
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +4 -1
- data/src/ruby_supportlib/phusion_passenger.rb +7 -5
- data/src/schema_printer/SchemaPrinterMain.cpp +2 -0
- metadata +40 -89
- data/.editorconfig +0 -134
- data/CODE_OF_CONDUCT.md +0 -52
- data/dev/boost-patches/0001-Patch-boost-thread-so-that-oxt-thread-can-use-it.patch +0 -48
- data/dev/boost-patches/0002-Make-boost-thread_interrupted-derive-from-oxt-tracab.patch +0 -33
- data/dev/boost-patches/0003-Disable-a-Clang-pragma-to-prevent-warnings-on-OS-X.patch +0 -25
- data/dev/ci/README.md +0 -134
- data/dev/ci/lib/functions.sh +0 -129
- data/dev/ci/lib/set-container-envvars.sh +0 -53
- data/dev/ci/lib/setup-container.sh +0 -46
- data/dev/ci/run-tests-natively +0 -24
- data/dev/ci/run-tests-with-docker +0 -42
- data/dev/ci/scripts/debug-console-wrapper.sh +0 -29
- data/dev/ci/scripts/docker-entrypoint-stage2.sh +0 -17
- data/dev/ci/scripts/docker-entrypoint.sh +0 -17
- data/dev/ci/scripts/inituidgid +0 -17
- data/dev/ci/scripts/run-tests-natively-stage2.sh +0 -17
- data/dev/ci/scripts/setup-host-natively.sh +0 -11
- data/dev/ci/setup-host +0 -56
- data/dev/ci/tests/apache2/run +0 -6
- data/dev/ci/tests/apache2/setup +0 -4
- data/dev/ci/tests/binaries/Jenkinsfile +0 -105
- data/dev/ci/tests/binaries/build-linux +0 -38
- data/dev/ci/tests/binaries/build-macos +0 -40
- data/dev/ci/tests/binaries/prepare-macos +0 -38
- data/dev/ci/tests/binaries/test-linux +0 -45
- data/dev/ci/tests/binaries/test-macos +0 -38
- data/dev/ci/tests/cxx/run +0 -9
- data/dev/ci/tests/cxx/setup +0 -4
- data/dev/ci/tests/debian/Jenkinsfile +0 -89
- data/dev/ci/tests/debian/run +0 -60
- data/dev/ci/tests/nginx/run +0 -5
- data/dev/ci/tests/nginx/setup +0 -4
- data/dev/ci/tests/nginx-dynamic/run +0 -20
- data/dev/ci/tests/nginx-dynamic/setup +0 -4
- data/dev/ci/tests/nodejs/run +0 -4
- data/dev/ci/tests/nodejs/setup +0 -4
- data/dev/ci/tests/rpm/Jenkinsfile +0 -68
- data/dev/ci/tests/rpm/run +0 -63
- data/dev/ci/tests/ruby/run +0 -4
- data/dev/ci/tests/ruby/setup +0 -4
- data/dev/ci/tests/source-packaging/run +0 -4
- data/dev/ci/tests/source-packaging/setup +0 -4
- data/dev/ci/tests/standalone/run +0 -4
- data/dev/ci/tests/standalone/setup +0 -4
- data/dev/configkit-schemas/index.json +0 -1748
- data/dev/configkit-schemas/update_schema_inline_comments.rb +0 -118
- data/dev/rack.test/config.ru +0 -5
- data/dev/rack.test/public/asset.txt +0 -1
- data/dev/vagrant/apache_default_site.conf +0 -35
- data/dev/vagrant/apache_passenger.conf +0 -5
- data/dev/vagrant/apache_passenger.load +0 -1
- data/dev/vagrant/apache_ports.conf +0 -24
- data/dev/vagrant/apache_rack_test.conf +0 -9
- data/dev/vagrant/bashrc +0 -23
- data/dev/vagrant/nginx.conf +0 -39
- data/dev/vagrant/nginx_rakefile +0 -33
- data/dev/vagrant/nginx_start +0 -32
- data/dev/vagrant/provision.sh +0 -117
- data/dev/vagrant/sudoers.conf +0 -5
- data/resources/templates/error_renderer/.editorconfig +0 -19
- data/src/cxx_supportlib/AppTypes.cpp +0 -109
- data/src/cxx_supportlib/vendor-modified/SmallVector.h +0 -653
@@ -1,12 +1,37 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
/*
|
2
|
+
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
* Copyright (c) 2013-2018 Phusion Holding B.V.
|
4
|
+
*
|
5
|
+
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
|
+
* trademarks of Phusion Holding B.V.
|
7
|
+
*
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
13
|
+
* furnished to do so, subject to the following conditions:
|
14
|
+
*
|
15
|
+
* The above copyright notice and this permission notice shall be included in
|
16
|
+
* all copies or substantial portions of the Software.
|
17
|
+
*
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
* THE SOFTWARE.
|
25
|
+
*/
|
26
|
+
#ifndef _PASSENGER_STR_INT_TOOLS_TEMPLATE_H_
|
27
|
+
#define _PASSENGER_STR_INT_TOOLS_TEMPLATE_H_
|
3
28
|
|
4
29
|
#include <string>
|
5
30
|
#include <cstring>
|
6
31
|
#include <cstdio>
|
7
32
|
#include <StaticString.h>
|
8
|
-
#include <
|
9
|
-
#include <
|
33
|
+
#include <StrIntTools/StrIntUtils.h>
|
34
|
+
#include <DataStructures/StringMap.h>
|
10
35
|
|
11
36
|
namespace Passenger {
|
12
37
|
|
@@ -209,4 +234,4 @@ public:
|
|
209
234
|
|
210
235
|
} // namespace Passenger
|
211
236
|
|
212
|
-
#endif /*
|
237
|
+
#endif /* _PASSENGER_STR_INT_TOOLS_TEMPLATE_H_ */
|
@@ -0,0 +1,88 @@
|
|
1
|
+
/*
|
2
|
+
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
* Copyright (c) 2018 Phusion Holding B.V.
|
4
|
+
*
|
5
|
+
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
|
+
* trademarks of Phusion Holding B.V.
|
7
|
+
*
|
8
|
+
* See LICENSE file for license information.
|
9
|
+
*/
|
10
|
+
#ifndef _PASSENGER_SYSTEM_TOOLS_CONTAINER_HELPERS_H_
|
11
|
+
#define _PASSENGER_SYSTEM_TOOLS_CONTAINER_HELPERS_H_
|
12
|
+
|
13
|
+
#include <unistd.h>
|
14
|
+
#include <boost/predef.h>
|
15
|
+
#include <FileTools/FileManip.h>
|
16
|
+
#include <StrIntTools/StrIntUtils.h>
|
17
|
+
|
18
|
+
namespace Passenger {
|
19
|
+
|
20
|
+
using namespace std;
|
21
|
+
|
22
|
+
|
23
|
+
// adapted from https://github.com/systemd/systemd/blob/042ca/src/basic/virt.c
|
24
|
+
// separate function to keep as similar to source as possible for easier updates
|
25
|
+
inline bool
|
26
|
+
_linuxAutoDetectInContainer() {
|
27
|
+
// https://github.com/moby/moby/issues/26102#issuecomment-253621560
|
28
|
+
if (fileExists("/.dockerenv")) {
|
29
|
+
return true;
|
30
|
+
}
|
31
|
+
|
32
|
+
if (fileExists("/proc/vz") && !fileExists("/proc/bc")) {
|
33
|
+
return true;
|
34
|
+
}
|
35
|
+
|
36
|
+
const char *env = getenv("container");
|
37
|
+
if (env != NULL) {
|
38
|
+
return (*env != '\0');
|
39
|
+
}
|
40
|
+
|
41
|
+
if (fileExists("/run/systemd/container")) {
|
42
|
+
string file = unsafeReadFile("/run/systemd/container");
|
43
|
+
return (file.length() > 0);
|
44
|
+
}
|
45
|
+
|
46
|
+
if (fileExists("/proc/1/environ")) {
|
47
|
+
string file = unsafeReadFile("/proc/1/environ");
|
48
|
+
if (file.size() > 0) {
|
49
|
+
vector<string> v;
|
50
|
+
split(file,'\0', v);
|
51
|
+
for(vector<string>::iterator it = v.begin(); it != v.end(); ++it) {
|
52
|
+
if (startsWith(*it, "container=")) {
|
53
|
+
return true;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
if (fileExists("/proc/1/sched")) {
|
60
|
+
string file = unsafeReadFile("/proc/1/sched");
|
61
|
+
if (file.length() >= 0) {
|
62
|
+
const char t = file[0];
|
63
|
+
if (t == '\0') {
|
64
|
+
return false;
|
65
|
+
}
|
66
|
+
|
67
|
+
if (!startsWith(file, "(1,")) {
|
68
|
+
return true;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
return false;
|
74
|
+
}
|
75
|
+
|
76
|
+
inline bool
|
77
|
+
autoDetectInContainer() {
|
78
|
+
#if BOOST_OS_LINUX
|
79
|
+
return _linuxAutoDetectInContainer();
|
80
|
+
#else
|
81
|
+
return false;
|
82
|
+
#endif
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
} // namespace Passenger
|
87
|
+
|
88
|
+
#endif /* _PASSENGER_SYSTEM_TOOLS_CONTAINER_HELPERS_H_ */
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2010-
|
3
|
+
* Copyright (c) 2010-2018 Phusion Holding B.V.
|
4
4
|
*
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
6
|
* trademarks of Phusion Holding B.V.
|
@@ -23,8 +23,8 @@
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
24
|
* THE SOFTWARE.
|
25
25
|
*/
|
26
|
-
#ifndef
|
27
|
-
#define
|
26
|
+
#ifndef _PASSENGER_SYSTEM_TOOLS_PROCESS_METRICS_COLLECTOR_H_
|
27
|
+
#define _PASSENGER_SYSTEM_TOOLS_PROCESS_METRICS_COLLECTOR_H_
|
28
28
|
|
29
29
|
#include <boost/cstdint.hpp>
|
30
30
|
#include <boost/thread.hpp>
|
@@ -63,8 +63,8 @@
|
|
63
63
|
#include <ProcessManagement/Spawn.h>
|
64
64
|
#include <FileTools/FileManip.h>
|
65
65
|
#include <Utils/ScopeGuard.h>
|
66
|
-
#include <
|
67
|
-
#include <
|
66
|
+
#include <IOTools/IOUtils.h>
|
67
|
+
#include <StrIntTools/StringScanning.h>
|
68
68
|
|
69
69
|
namespace Passenger {
|
70
70
|
|
@@ -321,18 +321,21 @@ public:
|
|
321
321
|
NULL
|
322
322
|
};
|
323
323
|
|
324
|
-
|
325
|
-
|
324
|
+
SubprocessOutput psOutput;
|
325
|
+
psOutput.data = this->psOutput;
|
326
|
+
if (psOutput.data.empty()) {
|
326
327
|
SubprocessInfo info;
|
327
|
-
runCommandAndCaptureOutput(command, info, psOutput,
|
328
|
-
|
328
|
+
runCommandAndCaptureOutput(command, info, psOutput,
|
329
|
+
1024 * 1024, true, afterFork);
|
330
|
+
if (psOutput.data.empty()) {
|
329
331
|
throw RuntimeException("The 'ps' command failed");
|
330
332
|
}
|
331
333
|
}
|
332
334
|
pidsArg.resize(0);
|
333
335
|
fmtArg.resize(0);
|
334
|
-
ProcessMetricMap result = parsePsOutput<Collection, ConstIterator>(
|
335
|
-
|
336
|
+
ProcessMetricMap result = parsePsOutput<Collection, ConstIterator>(
|
337
|
+
psOutput.data, pids);
|
338
|
+
psOutput.data.resize(0);
|
336
339
|
if (canMeasureRealMemory) {
|
337
340
|
ProcessMetricMap::iterator it;
|
338
341
|
for (it = result.begin(); it != result.end(); it++) {
|
@@ -502,4 +505,4 @@ public:
|
|
502
505
|
|
503
506
|
} // namespace Passenger
|
504
507
|
|
505
|
-
#endif /*
|
508
|
+
#endif /* _PASSENGER_SYSTEM_TOOLS_PROCESS_METRICS_COLLECTOR_H_ */
|
@@ -46,7 +46,7 @@
|
|
46
46
|
#include <sys/sysinfo.h>
|
47
47
|
#include <Exceptions.h>
|
48
48
|
#include <FileTools/FileManip.h>
|
49
|
-
#include <
|
49
|
+
#include <StrIntTools/StringScanning.h>
|
50
50
|
#endif
|
51
51
|
#ifdef __APPLE__
|
52
52
|
#include <mach/mach.h>
|
@@ -65,8 +65,8 @@
|
|
65
65
|
#include <Constants.h>
|
66
66
|
#include <StaticString.h>
|
67
67
|
#include <Utils.h>
|
68
|
-
#include <
|
69
|
-
#include <
|
68
|
+
#include <StrIntTools/StrIntUtils.h>
|
69
|
+
#include <SystemTools/SystemTime.h>
|
70
70
|
#include <Utils/AnsiColorConstants.h>
|
71
71
|
#include <Utils/SpeedMeter.h>
|
72
72
|
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2010-
|
3
|
+
* Copyright (c) 2010-2018 Phusion Holding B.V.
|
4
4
|
*
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
6
|
* trademarks of Phusion Holding B.V.
|
@@ -39,8 +39,8 @@
|
|
39
39
|
#include <oxt/system_calls.hpp>
|
40
40
|
|
41
41
|
#include <StaticString.h>
|
42
|
-
#include <
|
43
|
-
#include <
|
42
|
+
#include <SystemTools/SystemTime.h>
|
43
|
+
#include <DataStructures/StringMap.h>
|
44
44
|
|
45
45
|
namespace Passenger {
|
46
46
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2013-
|
3
|
+
* Copyright (c) 2013-2018 Phusion Holding B.V.
|
4
4
|
*
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
6
|
* trademarks of Phusion Holding B.V.
|
@@ -61,7 +61,7 @@
|
|
61
61
|
#include <Exceptions.h>
|
62
62
|
#include <FileTools/FileManip.h>
|
63
63
|
#include <Utils.h>
|
64
|
-
#include <
|
64
|
+
#include <StrIntTools/StrIntUtils.h>
|
65
65
|
|
66
66
|
namespace Passenger {
|
67
67
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2010-
|
3
|
+
* Copyright (c) 2010-2018 Phusion Holding B.V.
|
4
4
|
*
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
6
|
* trademarks of Phusion Holding B.V.
|
@@ -30,7 +30,7 @@
|
|
30
30
|
#include <cerrno>
|
31
31
|
|
32
32
|
#include <Utils/CachedFileStat.hpp>
|
33
|
-
#include <
|
33
|
+
#include <SystemTools/SystemTime.h>
|
34
34
|
|
35
35
|
namespace Passenger {
|
36
36
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2014-
|
3
|
+
* Copyright (c) 2014-2018 Phusion Holding B.V.
|
4
4
|
*
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
6
|
* trademarks of Phusion Holding B.V.
|
@@ -30,7 +30,7 @@
|
|
30
30
|
#include <cstdlib>
|
31
31
|
#include <cassert>
|
32
32
|
#include <limits>
|
33
|
-
#include <
|
33
|
+
#include <SystemTools/SystemTime.h>
|
34
34
|
|
35
35
|
namespace Passenger {
|
36
36
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2010-
|
3
|
+
* Copyright (c) 2010-2018 Phusion Holding B.V.
|
4
4
|
*
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
6
|
* trademarks of Phusion Holding B.V.
|
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
#include <boost/thread.hpp>
|
30
30
|
#include <oxt/system_calls.hpp>
|
31
|
-
#include <
|
31
|
+
#include <SystemTools/SystemTime.h>
|
32
32
|
|
33
33
|
namespace Passenger {
|
34
34
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2010-
|
3
|
+
* Copyright (c) 2010-2018 Phusion Holding B.V.
|
4
4
|
*
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
6
|
* trademarks of Phusion Holding B.V.
|
@@ -36,8 +36,8 @@
|
|
36
36
|
#include <jsoncpp/json.h>
|
37
37
|
#include <modp_b64.h>
|
38
38
|
#include <Exceptions.h>
|
39
|
-
#include <
|
40
|
-
#include <
|
39
|
+
#include <StrIntTools/StrIntUtils.h>
|
40
|
+
#include <IOTools/MessageIO.h>
|
41
41
|
|
42
42
|
namespace Passenger {
|
43
43
|
|
@@ -57,8 +57,8 @@
|
|
57
57
|
#include <ProcessManagement/Spawn.h>
|
58
58
|
#include <ProcessManagement/Utils.h>
|
59
59
|
#include <Utils.h>
|
60
|
-
#include <
|
61
|
-
#include <
|
60
|
+
#include <StrIntTools/StrIntUtils.h>
|
61
|
+
#include <IOTools/IOUtils.h>
|
62
62
|
|
63
63
|
#ifndef HOST_NAME_MAX
|
64
64
|
#if defined(_POSIX_HOST_NAME_MAX)
|
@@ -86,8 +86,8 @@ void psg_watchdog_launcher_free(PsgWatchdogLauncher *launcher);
|
|
86
86
|
#include <LoggingKit/Context.h>
|
87
87
|
#include <ProcessManagement/Utils.h>
|
88
88
|
#include <Utils.h>
|
89
|
-
#include <
|
90
|
-
#include <
|
89
|
+
#include <IOTools/IOUtils.h>
|
90
|
+
#include <IOTools/MessageIO.h>
|
91
91
|
#include <Utils/Timer.h>
|
92
92
|
#include <Utils/ScopeGuard.h>
|
93
93
|
#include <Utils/ClassUtils.h>
|
@@ -370,7 +370,7 @@ public:
|
|
370
370
|
afterFork();
|
371
371
|
}
|
372
372
|
|
373
|
-
closeAllFileDescriptors(FEEDBACK_FD
|
373
|
+
closeAllFileDescriptors(FEEDBACK_FD);
|
374
374
|
|
375
375
|
execl(agentFilename.c_str(), AGENT_EXE, "watchdog",
|
376
376
|
// Some extra space to allow the child process to change its process title.
|
@@ -0,0 +1,85 @@
|
|
1
|
+
/*
|
2
|
+
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
* Copyright (c) 2018 Phusion Holding B.V.
|
4
|
+
*
|
5
|
+
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
|
+
* trademarks of Phusion Holding B.V.
|
7
|
+
*
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
13
|
+
* furnished to do so, subject to the following conditions:
|
14
|
+
*
|
15
|
+
* The above copyright notice and this permission notice shall be included in
|
16
|
+
* all copies or substantial portions of the Software.
|
17
|
+
*
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
* THE SOFTWARE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#include <new>
|
28
|
+
#include <exception>
|
29
|
+
|
30
|
+
#include <WrapperRegistry/CBindings.h>
|
31
|
+
#include <WrapperRegistry/Entry.h>
|
32
|
+
#include <WrapperRegistry/Registry.h>
|
33
|
+
|
34
|
+
using namespace Passenger;
|
35
|
+
using namespace Passenger::WrapperRegistry;
|
36
|
+
|
37
|
+
|
38
|
+
int
|
39
|
+
psg_wrapper_registry_entry_is_null(const PsgWrapperRegistryEntry *entry) {
|
40
|
+
const Entry *cxxEntry = static_cast<const Entry *>(entry);
|
41
|
+
return (int) cxxEntry->isNull();
|
42
|
+
}
|
43
|
+
|
44
|
+
const char *
|
45
|
+
psg_wrapper_registry_entry_get_language(const PsgWrapperRegistryEntry *entry, size_t *len) {
|
46
|
+
const Entry *cxxEntry = static_cast<const Entry *>(entry);
|
47
|
+
if (len != NULL) {
|
48
|
+
*len = cxxEntry->language.size();
|
49
|
+
}
|
50
|
+
return cxxEntry->language.data();
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
PsgWrapperRegistry *
|
55
|
+
psg_wrapper_registry_new() {
|
56
|
+
try {
|
57
|
+
return static_cast<PsgWrapperRegistry *>(new Registry());
|
58
|
+
} catch (const std::bad_alloc &) {
|
59
|
+
return NULL;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
void
|
64
|
+
psg_wrapper_registry_free(PsgWrapperRegistry *registry) {
|
65
|
+
Registry *cxxRegistry = static_cast<Registry *>(registry);
|
66
|
+
delete cxxRegistry;
|
67
|
+
}
|
68
|
+
|
69
|
+
void
|
70
|
+
psg_wrapper_registry_finalize(PsgWrapperRegistry *registry) {
|
71
|
+
Registry *cxxRegistry = static_cast<Registry *>(registry);
|
72
|
+
cxxRegistry->finalize();
|
73
|
+
}
|
74
|
+
|
75
|
+
const PsgWrapperRegistryEntry *
|
76
|
+
psg_wrapper_registry_lookup(PsgWrapperRegistry *registry,
|
77
|
+
const char *name, size_t size)
|
78
|
+
{
|
79
|
+
const Registry *cxxRegistry = static_cast<const Registry *>(registry);
|
80
|
+
if (size == (size_t) -1) {
|
81
|
+
size = strlen(name);
|
82
|
+
}
|
83
|
+
return static_cast<const PsgWrapperRegistryEntry *>(
|
84
|
+
&cxxRegistry->lookup(StaticString(name, size)));
|
85
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c)
|
3
|
+
* Copyright (c) 2018 Phusion Holding B.V.
|
4
4
|
*
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
6
|
* trademarks of Phusion Holding B.V.
|
@@ -23,31 +23,34 @@
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
24
|
* THE SOFTWARE.
|
25
25
|
*/
|
26
|
-
#ifndef
|
27
|
-
#define
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
#
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
26
|
+
#ifndef _PASSENGER_WRAPPER_REGISTRY_CBINDINGS_H_
|
27
|
+
#define _PASSENGER_WRAPPER_REGISTRY_CBINDINGS_H_
|
28
|
+
|
29
|
+
#include <stddef.h>
|
30
|
+
|
31
|
+
#ifdef __cplusplus
|
32
|
+
extern "C" {
|
33
|
+
#endif
|
34
|
+
|
35
|
+
|
36
|
+
typedef void PsgWrapperRegistryEntry;
|
37
|
+
|
38
|
+
int psg_wrapper_registry_entry_is_null(const PsgWrapperRegistryEntry *entry);
|
39
|
+
const char *psg_wrapper_registry_entry_get_language(const PsgWrapperRegistryEntry *entry, size_t *len);
|
40
|
+
|
41
|
+
|
42
|
+
typedef void PsgWrapperRegistry;
|
43
|
+
|
44
|
+
PsgWrapperRegistry *psg_wrapper_registry_new();
|
45
|
+
void psg_wrapper_registry_free(PsgWrapperRegistry *registry);
|
46
|
+
|
47
|
+
void psg_wrapper_registry_finalize(PsgWrapperRegistry *registry);
|
48
|
+
const PsgWrapperRegistryEntry *psg_wrapper_registry_lookup(PsgWrapperRegistry *registry,
|
49
|
+
const char *name, size_t size);
|
50
|
+
|
51
|
+
|
52
|
+
#ifdef __cplusplus
|
53
|
+
} // extern "C"
|
51
54
|
#endif
|
52
55
|
|
53
|
-
#endif /*
|
56
|
+
#endif /* _PASSENGER_WRAPPER_REGISTRY_CBINDINGS_H_ */
|
@@ -0,0 +1,112 @@
|
|
1
|
+
/*
|
2
|
+
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
* Copyright (c) 2018 Phusion Holding B.V.
|
4
|
+
*
|
5
|
+
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
|
+
* trademarks of Phusion Holding B.V.
|
7
|
+
*
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
13
|
+
* furnished to do so, subject to the following conditions:
|
14
|
+
*
|
15
|
+
* The above copyright notice and this permission notice shall be included in
|
16
|
+
* all copies or substantial portions of the Software.
|
17
|
+
*
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
* THE SOFTWARE.
|
25
|
+
*/
|
26
|
+
#ifndef _PASSENGER_WRAPPER_REGISTRY_WRAPPER_H_
|
27
|
+
#define _PASSENGER_WRAPPER_REGISTRY_WRAPPER_H_
|
28
|
+
|
29
|
+
#include <boost/container/small_vector.hpp>
|
30
|
+
#include <StaticString.h>
|
31
|
+
|
32
|
+
namespace Passenger {
|
33
|
+
namespace WrapperRegistry {
|
34
|
+
|
35
|
+
using namespace std;
|
36
|
+
|
37
|
+
|
38
|
+
struct Entry {
|
39
|
+
/**
|
40
|
+
* A identifier-like name for this language. All-lowercase, no spaces.
|
41
|
+
* Related to passenger_app_type.
|
42
|
+
* Example: "ruby"
|
43
|
+
*/
|
44
|
+
StaticString language;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* A human-readable name for this language.
|
48
|
+
* Example: "Ruby"
|
49
|
+
*/
|
50
|
+
StaticString languageDisplayName;
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Path to the wrapper to use. If `suppliedByThirdParty` is false, then
|
54
|
+
* the path is considered relative to helperScriptsDir.
|
55
|
+
*/
|
56
|
+
StaticString path;
|
57
|
+
|
58
|
+
/**
|
59
|
+
* The title that spawned processes for this language should assume.
|
60
|
+
* Example: "Passenger RubyApp"
|
61
|
+
*/
|
62
|
+
StaticString processTitle;
|
63
|
+
|
64
|
+
/**
|
65
|
+
* A default command for the interpreter of this language.
|
66
|
+
* Will be looked up in $PATH.
|
67
|
+
* Example: "ruby"
|
68
|
+
*/
|
69
|
+
StaticString defaultInterpreter;
|
70
|
+
|
71
|
+
/**
|
72
|
+
* A list of startup file names that we should look for
|
73
|
+
* in order to autodetect whether an app belongs to this
|
74
|
+
* language. Any of these files are also considered to be
|
75
|
+
* the entrypoint to the app.
|
76
|
+
* Example: "config.ru", "index.js", "app.js"
|
77
|
+
*/
|
78
|
+
boost::container::small_vector<StaticString, 2> defaultStartupFiles;
|
79
|
+
|
80
|
+
bool suppliedByThirdParty;
|
81
|
+
|
82
|
+
Entry()
|
83
|
+
: suppliedByThirdParty(false)
|
84
|
+
{ }
|
85
|
+
|
86
|
+
// In C++98, `boost::container::small_vector` causes our default
|
87
|
+
// assignment operator to become `operator=(Entry &)`, which is
|
88
|
+
// incompatible with the Registry's usage of StringKeyTable.
|
89
|
+
// We fix this by writing out own assignment operator.
|
90
|
+
Entry &operator=(const Entry &other) {
|
91
|
+
if (this != &other) {
|
92
|
+
language = other.language;
|
93
|
+
languageDisplayName = other.languageDisplayName;
|
94
|
+
path = other.path;
|
95
|
+
processTitle = other.processTitle;
|
96
|
+
defaultInterpreter = other.defaultInterpreter;
|
97
|
+
defaultStartupFiles = other.defaultStartupFiles;
|
98
|
+
suppliedByThirdParty = other.suppliedByThirdParty;
|
99
|
+
}
|
100
|
+
return *this;
|
101
|
+
}
|
102
|
+
|
103
|
+
bool isNull() const {
|
104
|
+
return language.empty();
|
105
|
+
}
|
106
|
+
};
|
107
|
+
|
108
|
+
|
109
|
+
} // namespace WrapperRegistry
|
110
|
+
} // namespace Passenger
|
111
|
+
|
112
|
+
#endif /* _PASSENGER_WRAPPER_REGISTRY_WRAPPER_H_ */
|