passenger 6.2.0 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +33 -1
- data/CONTRIBUTING.md +7 -311
- data/CONTRIBUTORS +1 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/bin/passenger +1 -1
- data/bin/passenger-config +1 -1
- data/bin/passenger-install-apache2-module +1 -1
- data/bin/passenger-install-nginx-module +4 -9
- data/bin/passenger-memory-stats +1 -1
- data/bin/passenger-status +1 -1
- data/build/agent.rb +13 -15
- data/build/apache2.rb +13 -16
- data/build/basics.rb +10 -13
- data/build/common_library.rb +5 -9
- data/build/cxx_tests.rb +37 -12
- data/build/integration_tests.rb +5 -2
- data/build/misc.rb +1 -1
- data/build/nginx.rb +1 -1
- data/build/node_tests.rb +1 -1
- data/build/oxt_tests.rb +6 -8
- data/build/packaging.rb +1 -1
- data/build/ruby_extension.rb +1 -1
- data/build/ruby_tests.rb +1 -1
- data/build/schema_printer.rb +13 -15
- data/build/support/cplusplus.rb +61 -69
- data/build/support/cxx_dependency_map.rb +2 -1
- data/build/support/general.rb +1 -1
- data/build/support/vendor/cxx_hinted_parser/LICENSE.md +1 -1
- data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser/parser.rb +1 -1
- data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser.rb +1 -1
- data/build/support/vendor/cxxcodebuilder/LICENSE.md +1 -1
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/builder.rb +1 -1
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/initializer_builder.rb +1 -1
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder.rb +1 -1
- data/build/test_basics.rb +1 -1
- data/dev/copy_boost_headers +1 -1
- data/dev/index_cxx_dependencies.rb +5 -1
- data/dev/libev-changes.patch +108 -0
- data/dev/nginx_version_sha256 +1 -1
- data/dev/ruby_server.rb +1 -6
- data/dev/upgrading_libuv.sh +16 -0
- data/doc/BasicArchitectureOverview.md +55 -0
- data/doc/BuildCaching.md +23 -0
- data/doc/BuildSystem.md +49 -0
- data/doc/DebuggingAndStressTesting.md +2 -0
- data/doc/DesignAspects/LimitedGemDependencies.md +1 -0
- data/doc/DevEnvironmentSetup.md +46 -0
- data/doc/DevHandbook.md +28 -0
- data/doc/Packaging.md +1 -1
- data/doc/RunningTests.md +88 -0
- data/doc/{TempFileHandling.md → SecureTempFileHandling.md} +1 -1
- data/doc/{CxxTestingGuide.md → WritingCxxTests.md} +1 -20
- data/src/agent/AgentMain.cpp +1 -1
- data/src/agent/Core/ApiServer.h +1 -1
- data/src/agent/Core/ApplicationPool/AbstractSession.h +1 -1
- data/src/agent/Core/ApplicationPool/BasicGroupInfo.h +1 -1
- data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +1 -1
- data/src/agent/Core/ApplicationPool/Common.h +1 -1
- data/src/agent/Core/ApplicationPool/Context.h +1 -1
- data/src/agent/Core/ApplicationPool/Group/InitializationAndShutdown.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/Miscellaneous.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/SessionManagement.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/SpawningAndRestarting.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/Verification.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group.h +1 -1
- data/src/agent/Core/ApplicationPool/Implementation.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Options.h +1 -1
- data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/GarbageCollection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/GroupUtils.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/ProcessUtils.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/StateInspection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool.h +1 -1
- data/src/agent/Core/ApplicationPool/Process.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Process.h +1 -1
- data/src/agent/Core/ApplicationPool/Session.h +1 -1
- data/src/agent/Core/ApplicationPool/Socket.h +1 -1
- data/src/agent/Core/ApplicationPool/TestSession.h +1 -1
- data/src/agent/Core/Config.h +3 -2
- data/src/agent/Core/ConfigChange.cpp +1 -1
- data/src/agent/Core/ConfigChange.h +1 -1
- data/src/agent/Core/Controller/AppResponse.h +1 -1
- data/src/agent/Core/Controller/BufferBody.cpp +1 -1
- data/src/agent/Core/Controller/CheckoutSession.cpp +8 -5
- data/src/agent/Core/Controller/Client.h +1 -1
- data/src/agent/Core/Controller/Config.cpp +1 -1
- data/src/agent/Core/Controller/Config.h +2 -2
- data/src/agent/Core/Controller/ForwardResponse.cpp +2 -2
- data/src/agent/Core/Controller/Hooks.cpp +12 -9
- data/src/agent/Core/Controller/Implementation.cpp +1 -1
- data/src/agent/Core/Controller/InitRequest.cpp +1 -1
- data/src/agent/Core/Controller/InitializationAndShutdown.cpp +1 -1
- data/src/agent/Core/Controller/InternalUtils.cpp +1 -1
- data/src/agent/Core/Controller/Miscellaneous.cpp +1 -1
- data/src/agent/Core/Controller/Request.h +1 -1
- data/src/agent/Core/Controller/SendRequest.cpp +1 -1
- data/src/agent/Core/Controller/StateInspection.cpp +1 -1
- data/src/agent/Core/Controller/TurboCaching.h +1 -1
- data/src/agent/Core/Controller.h +1 -1
- data/src/agent/Core/CoreMain.cpp +1 -1
- data/src/agent/Core/OptionParser.h +1 -1
- data/src/agent/Core/ResponseCache.h +1 -1
- data/src/agent/Core/SecurityUpdateChecker.h +1 -1
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h.cxxcodebuilder +1 -1
- data/src/agent/Core/SpawningKit/Config.h +1 -1
- data/src/agent/Core/SpawningKit/Context.h +1 -1
- data/src/agent/Core/SpawningKit/DirectSpawner.h +1 -1
- data/src/agent/Core/SpawningKit/DummySpawner.h +1 -1
- data/src/agent/Core/SpawningKit/ErrorRenderer.h +1 -1
- data/src/agent/Core/SpawningKit/Exceptions.h +63 -2
- 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 +3 -2
- data/src/agent/Core/SpawningKit/Handshake/Prepare.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/Session.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +1 -1
- data/src/agent/Core/SpawningKit/Journey.h +1 -1
- data/src/agent/Core/SpawningKit/PipeWatcher.h +1 -1
- data/src/agent/Core/SpawningKit/README.md +3 -3
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h.cxxcodebuilder +1 -1
- data/src/agent/Core/SpawningKit/Result.h +1 -1
- data/src/agent/Core/SpawningKit/SmartSpawner.h +17 -17
- data/src/agent/Core/SpawningKit/Spawner.h +1 -1
- data/src/agent/Core/SpawningKit/UserSwitchingRules.h +1 -1
- data/src/agent/Core/TelemetryCollector.h +1 -1
- data/src/agent/ExecHelper/ExecHelperMain.cpp +1 -1
- data/src/agent/FileReadHelper/FileReadHelperMain.cpp +1 -1
- data/src/agent/MainFunctions.h +1 -1
- data/src/agent/Shared/ApiAccountUtils.h +4 -3
- data/src/agent/Shared/ApiServerUtils.h +1 -2
- data/src/agent/Shared/ApplicationPoolApiKey.h +1 -1
- data/src/agent/Shared/Fundamentals/AbortHandler.cpp +1 -1
- data/src/agent/Shared/Fundamentals/AbortHandler.h +1 -1
- data/src/agent/Shared/Fundamentals/Initialization.cpp +1 -1
- data/src/agent/Shared/Fundamentals/Initialization.h +1 -1
- data/src/agent/Shared/Fundamentals/Utils.cpp +1 -1
- data/src/agent/Shared/Fundamentals/Utils.h +1 -1
- data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +1 -1
- data/src/agent/SystemMetrics/SystemMetricsMain.cpp +1 -1
- data/src/agent/TempDirToucher/TempDirToucherMain.cpp +1 -1
- data/src/agent/Watchdog/ApiServer.h +7 -6
- data/src/agent/Watchdog/Config.h +2 -2
- data/src/apache2_module/Bucket.cpp +1 -1
- data/src/apache2_module/Bucket.h +1 -1
- data/src/apache2_module/CBindings.cpp +1 -1
- data/src/apache2_module/Config.cpp +1 -1
- data/src/apache2_module/Config.h +1 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +104 -104
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp.cxxcodebuilder +2 -2
- data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +1 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +1 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/ConfigGeneral/Common.h +1 -1
- data/src/apache2_module/ConfigGeneral/ManifestGeneration.h +1 -1
- data/src/apache2_module/ConfigGeneral/SetterFuncs.h +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
- data/src/apache2_module/DirectoryMapper.h +1 -1
- data/src/apache2_module/Hooks.cpp +8 -2
- data/src/apache2_module/Hooks.h +1 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +1 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +1 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
- data/src/apache2_module/Utils.h +1 -1
- data/src/apache2_module/mod_passenger.c +1 -1
- data/src/cxx_supportlib/Algorithms/Hasher.cpp +1 -1
- data/src/cxx_supportlib/Algorithms/Hasher.h +1 -1
- data/src/cxx_supportlib/Algorithms/MovingAverage.h +1 -1
- data/src/cxx_supportlib/AppLocalConfigFileUtils.h +1 -1
- data/src/cxx_supportlib/AppTypeDetector/CBindings.cpp +1 -1
- data/src/cxx_supportlib/AppTypeDetector/CBindings.h +1 -1
- data/src/cxx_supportlib/AppTypeDetector/Detector.h +1 -1
- data/src/cxx_supportlib/BackgroundEventLoop.cpp +1 -1
- data/src/cxx_supportlib/BackgroundEventLoop.h +1 -1
- data/src/cxx_supportlib/ConfigKit/AsyncUtils.h +1 -1
- data/src/cxx_supportlib/ConfigKit/Common.h +1 -1
- data/src/cxx_supportlib/ConfigKit/ConfigKit.h +1 -1
- data/src/cxx_supportlib/ConfigKit/DummyTranslator.h +1 -1
- data/src/cxx_supportlib/ConfigKit/IN_PRACTICE.md +1 -3
- data/src/cxx_supportlib/ConfigKit/PrefixTranslator.h +3 -3
- data/src/cxx_supportlib/ConfigKit/Schema.h +1 -1
- data/src/cxx_supportlib/ConfigKit/SchemaUtils.h +1 -1
- data/src/cxx_supportlib/ConfigKit/Store.h +1 -1
- data/src/cxx_supportlib/ConfigKit/SubComponentUtils.h +1 -1
- data/src/cxx_supportlib/ConfigKit/TableTranslator.h +1 -1
- data/src/cxx_supportlib/ConfigKit/Translator.h +1 -1
- data/src/cxx_supportlib/ConfigKit/Utils.h +1 -1
- data/src/cxx_supportlib/Constants.h +2 -2
- data/src/cxx_supportlib/Constants.h.cxxcodebuilder +1 -1
- data/src/cxx_supportlib/DataStructures/HashedStaticString.h +1 -1
- data/src/cxx_supportlib/DataStructures/LString.cpp +1 -1
- data/src/cxx_supportlib/DataStructures/LString.h +1 -1
- data/src/cxx_supportlib/DataStructures/StringKeyTable.h +1 -1
- data/src/cxx_supportlib/DataStructures/StringMap.h +1 -1
- data/src/cxx_supportlib/Exceptions.cpp +1 -1
- data/src/cxx_supportlib/Exceptions.h +1 -1
- data/src/cxx_supportlib/FileDescriptor.h +1 -1
- data/src/cxx_supportlib/FileTools/FileManip.cpp +1 -1
- data/src/cxx_supportlib/FileTools/FileManip.h +1 -1
- data/src/cxx_supportlib/FileTools/PathManip.cpp +1 -1
- data/src/cxx_supportlib/FileTools/PathManip.h +1 -1
- data/src/cxx_supportlib/FileTools/PathManipCBindings.cpp +1 -1
- data/src/cxx_supportlib/FileTools/PathManipCBindings.h +1 -1
- data/src/cxx_supportlib/FileTools/PathSecurityCheck.cpp +1 -1
- data/src/cxx_supportlib/FileTools/PathSecurityCheck.h +1 -1
- data/src/cxx_supportlib/Hooks.h +1 -1
- data/src/cxx_supportlib/IOTools/BufferedIO.h +1 -1
- data/src/cxx_supportlib/IOTools/IOUtils.cpp +10 -10
- data/src/cxx_supportlib/IOTools/IOUtils.h +1 -1
- data/src/cxx_supportlib/IOTools/MessageIO.h +1 -1
- data/src/cxx_supportlib/IOTools/MessageSerialization.h +1 -1
- data/src/cxx_supportlib/InstanceDirectory.h +1 -1
- data/src/cxx_supportlib/Integrations/LibevJsonUtils.h +1 -1
- data/src/cxx_supportlib/JsonTools/Autocast.h +1 -1
- data/src/cxx_supportlib/JsonTools/CBindings.cpp +1 -1
- data/src/cxx_supportlib/JsonTools/CBindings.h +1 -1
- data/src/cxx_supportlib/JsonTools/JsonUtils.h +1 -1
- data/src/cxx_supportlib/LoggingKit/Assert.h +1 -1
- data/src/cxx_supportlib/LoggingKit/Config.h +2 -1
- data/src/cxx_supportlib/LoggingKit/Context.h +1 -1
- data/src/cxx_supportlib/LoggingKit/Forward.h +1 -1
- data/src/cxx_supportlib/LoggingKit/Implementation.cpp +11 -1
- data/src/cxx_supportlib/LoggingKit/Logging.h +1 -1
- data/src/cxx_supportlib/LoggingKit/LoggingKit.h +1 -1
- data/src/cxx_supportlib/LveLoggingDecorator.h +1 -1
- data/src/cxx_supportlib/MemoryKit/mbuf.cpp +1 -1
- data/src/cxx_supportlib/MemoryKit/mbuf.h +1 -1
- data/src/cxx_supportlib/MemoryKit/palloc.cpp +1 -1
- data/src/cxx_supportlib/MemoryKit/palloc.h +1 -1
- data/src/cxx_supportlib/ProcessManagement/Ruby.cpp +1 -1
- data/src/cxx_supportlib/ProcessManagement/Ruby.h +1 -1
- data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +1 -1
- data/src/cxx_supportlib/ProcessManagement/Spawn.h +1 -1
- data/src/cxx_supportlib/ProcessManagement/Utils.cpp +1 -1
- data/src/cxx_supportlib/ProcessManagement/Utils.h +1 -1
- data/src/cxx_supportlib/RandomGenerator.h +1 -1
- data/src/cxx_supportlib/ResourceLocator.h +1 -1
- data/src/cxx_supportlib/SafeLibev.h +1 -1
- data/src/cxx_supportlib/SecurityKit/Crypto.cpp +9 -27
- data/src/cxx_supportlib/SecurityKit/Crypto.h +2 -2
- data/src/cxx_supportlib/SecurityKit/MemZeroGuard.h +1 -1
- data/src/cxx_supportlib/ServerKit/AcceptLoadBalancer.h +1 -1
- data/src/cxx_supportlib/ServerKit/Channel.h +1 -1
- data/src/cxx_supportlib/ServerKit/Client.h +1 -1
- data/src/cxx_supportlib/ServerKit/ClientRef.h +1 -1
- data/src/cxx_supportlib/ServerKit/Config.h +1 -1
- data/src/cxx_supportlib/ServerKit/Context.h +1 -1
- data/src/cxx_supportlib/ServerKit/CookieUtils.h +1 -1
- data/src/cxx_supportlib/ServerKit/Errors.h +1 -1
- data/src/cxx_supportlib/ServerKit/FdSinkChannel.h +1 -1
- data/src/cxx_supportlib/ServerKit/FdSourceChannel.h +1 -1
- data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +54 -2
- data/src/cxx_supportlib/ServerKit/FileBufferedFdSinkChannel.h +1 -1
- data/src/cxx_supportlib/ServerKit/HeaderTable.h +1 -1
- data/src/cxx_supportlib/ServerKit/Hooks.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpChunkedBodyParser.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpChunkedBodyParserState.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpClient.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpHeaderParserState.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpRequest.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpRequestRef.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpServer.h +1 -1
- data/src/cxx_supportlib/ServerKit/Implementation.cpp +1 -1
- data/src/cxx_supportlib/ServerKit/Server.h +4 -2
- data/src/cxx_supportlib/StaticString.h +1 -1
- data/src/cxx_supportlib/StrIntTools/DateParsing.h +1 -1
- data/src/cxx_supportlib/StrIntTools/StrIntUtils.cpp +1 -1
- data/src/cxx_supportlib/StrIntTools/StrIntUtils.h +1 -1
- data/src/cxx_supportlib/StrIntTools/StrIntUtilsNoStrictAliasing.cpp +1 -1
- data/src/cxx_supportlib/StrIntTools/StringScanning.h +1 -1
- data/src/cxx_supportlib/StrIntTools/Template.h +1 -1
- data/src/cxx_supportlib/SystemTools/ContainerHelpers.h +1 -1
- data/src/cxx_supportlib/SystemTools/ProcessMetricsCollector.h +1 -1
- data/src/cxx_supportlib/SystemTools/SystemMetricsCollector.h +1 -1
- data/src/cxx_supportlib/SystemTools/SystemTime.cpp +1 -1
- data/src/cxx_supportlib/SystemTools/SystemTime.h +1 -1
- data/src/cxx_supportlib/SystemTools/UserDatabase.cpp +1 -1
- data/src/cxx_supportlib/SystemTools/UserDatabase.h +1 -1
- data/src/cxx_supportlib/Utils/AnsiColorConstants.h +1 -1
- data/src/cxx_supportlib/Utils/AsyncSignalSafeUtils.h +1 -1
- data/src/cxx_supportlib/Utils/BlockingQueue.h +1 -1
- data/src/cxx_supportlib/Utils/CachedFileStat.cpp +1 -1
- data/src/cxx_supportlib/Utils/CachedFileStat.h +1 -1
- data/src/cxx_supportlib/Utils/CachedFileStat.hpp +1 -1
- data/src/cxx_supportlib/Utils/ClassUtils.h +1 -1
- data/src/cxx_supportlib/Utils/Curl.h +1 -1
- data/src/cxx_supportlib/Utils/FastStringStream.h +1 -1
- data/src/cxx_supportlib/Utils/FileChangeChecker.h +1 -1
- data/src/cxx_supportlib/Utils/HttpConstants.h +1 -1
- data/src/cxx_supportlib/Utils/IniFile.h +1 -1
- data/src/cxx_supportlib/Utils/MessagePassing.h +1 -1
- data/src/cxx_supportlib/Utils/OptionParsing.h +1 -1
- data/src/cxx_supportlib/Utils/ReleaseableScopedPointer.h +1 -1
- data/src/cxx_supportlib/Utils/ScopeGuard.h +1 -1
- data/src/cxx_supportlib/Utils/SpeedMeter.h +1 -1
- data/src/cxx_supportlib/Utils/Timer.h +1 -1
- data/src/cxx_supportlib/Utils/VariantMap.h +1 -1
- data/src/cxx_supportlib/Utils.cpp +1 -1
- data/src/cxx_supportlib/Utils.h +1 -1
- data/src/cxx_supportlib/WatchdogLauncher.cpp +1 -1
- data/src/cxx_supportlib/WatchdogLauncher.h +1 -1
- data/src/cxx_supportlib/WrapperRegistry/CBindings.cpp +1 -1
- data/src/cxx_supportlib/WrapperRegistry/CBindings.h +1 -1
- data/src/cxx_supportlib/WrapperRegistry/Entry.h +1 -1
- data/src/cxx_supportlib/WrapperRegistry/Registry.h +1 -1
- data/src/cxx_supportlib/oxt/backtrace.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/backtrace_disabled.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/backtrace_enabled.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/context.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/tracable_exception_disabled.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/tracable_exception_enabled.hpp +1 -1
- data/src/cxx_supportlib/oxt/dynamic_thread_group.hpp +1 -1
- data/src/cxx_supportlib/oxt/implementation.cpp +1 -1
- data/src/cxx_supportlib/oxt/initialize.hpp +1 -1
- data/src/cxx_supportlib/oxt/macros.hpp +1 -1
- data/src/cxx_supportlib/oxt/spin_lock.hpp +1 -1
- data/src/cxx_supportlib/oxt/system_calls.cpp +1 -1
- data/src/cxx_supportlib/oxt/system_calls.hpp +1 -1
- data/src/cxx_supportlib/oxt/thread.hpp +1 -1
- data/src/cxx_supportlib/oxt/tracable_exception.hpp +1 -1
- data/src/cxx_supportlib/vendor-copy/adhoc_lve.h +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/AUTHORS +353 -3
- data/src/cxx_supportlib/vendor-copy/libuv/ChangeLog +3981 -2
- data/src/cxx_supportlib/vendor-copy/libuv/LICENSE +1 -28
- data/src/cxx_supportlib/vendor-copy/libuv/LICENSE-docs +396 -0
- data/src/cxx_supportlib/vendor-copy/libuv/LICENSE-extra +36 -0
- data/src/cxx_supportlib/vendor-copy/libuv/Makefile.am +275 -58
- data/src/cxx_supportlib/vendor-copy/libuv/Makefile.in +4380 -2125
- data/src/cxx_supportlib/vendor-copy/libuv/aclocal.m4 +425 -221
- data/src/cxx_supportlib/vendor-copy/libuv/ar-lib +30 -10
- data/src/cxx_supportlib/vendor-copy/libuv/compile +31 -14
- data/src/cxx_supportlib/vendor-copy/libuv/config.guess +1084 -690
- data/src/cxx_supportlib/vendor-copy/libuv/config.sub +1844 -1297
- data/src/cxx_supportlib/vendor-copy/libuv/configure +6935 -3664
- data/src/cxx_supportlib/vendor-copy/libuv/configure.ac +43 -19
- data/src/cxx_supportlib/vendor-copy/libuv/depcomp +12 -11
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-darwin.h → uv/darwin.h} +3 -3
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-errno.h → uv/errno.h} +119 -60
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-linux.h → uv/linux.h} +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv/os390.h +33 -0
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv/posix.h +31 -0
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-threadpool.h → uv/threadpool.h} +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/include/{tree.h → uv/tree.h} +3 -250
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-unix.h → uv/unix.h} +186 -60
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-version.h → uv/version.h} +3 -3
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv/win.h +703 -0
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv.h +528 -40
- data/src/cxx_supportlib/vendor-copy/libuv/install-sh +110 -70
- data/src/cxx_supportlib/vendor-copy/libuv/libuv-static.pc.in +12 -0
- data/src/cxx_supportlib/vendor-copy/libuv/libuv.pc.in +4 -2
- data/src/cxx_supportlib/vendor-copy/libuv/ltmain.sh +995 -619
- data/src/cxx_supportlib/vendor-copy/libuv/m4/ax_pthread.m4 +485 -0
- data/src/cxx_supportlib/vendor-copy/libuv/m4/libtool.m4 +438 -289
- data/src/cxx_supportlib/vendor-copy/libuv/m4/libuv-check-flags.m4 +21 -4
- data/src/cxx_supportlib/vendor-copy/libuv/m4/libuv-check-versions.m4 +7 -0
- data/src/cxx_supportlib/vendor-copy/libuv/m4/ltoptions.m4 +69 -39
- data/src/cxx_supportlib/vendor-copy/libuv/m4/ltsugar.m4 +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/m4/ltversion.m4 +7 -6
- data/src/cxx_supportlib/vendor-copy/libuv/m4/lt~obsolete.m4 +2 -2
- data/src/cxx_supportlib/vendor-copy/libuv/missing +55 -34
- data/src/cxx_supportlib/vendor-copy/libuv/src/fs-poll.c +52 -20
- data/src/cxx_supportlib/vendor-copy/libuv/src/idna.c +560 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/idna.h +31 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/inet.c +5 -16
- data/src/cxx_supportlib/vendor-copy/libuv/src/queue.h +68 -86
- data/src/cxx_supportlib/vendor-copy/libuv/src/random.c +123 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/strscpy.c +38 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/strscpy.h +39 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/strtok.c +52 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/strtok.h +27 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/thread-common.c +175 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/threadpool.c +172 -57
- data/src/cxx_supportlib/vendor-copy/libuv/src/{unix/timer.c → timer.c} +57 -29
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/aix-common.c +89 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/aix.c +418 -256
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/async.c +168 -129
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/bsd-ifaddrs.c +163 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/bsd-proctitle.c +99 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/core.c +1312 -378
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/cygwin.c +93 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin-proctitle.c +18 -32
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin-stub.h +97 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin-syscalls.h +17 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin.c +41 -139
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/dl.c +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/freebsd.c +75 -235
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/fs.c +1308 -299
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/fsevents.c +150 -148
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/getaddrinfo.c +58 -8
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/getnameinfo.c +3 -2
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/haiku.c +172 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/hurd.c +172 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/ibmi.c +542 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/internal.h +297 -106
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/kqueue.c +325 -94
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux.c +2708 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/loop-watcher.c +11 -11
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/loop.c +105 -24
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/netbsd.c +51 -157
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/no-fsevents.c +42 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/no-proctitle.c +45 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/openbsd.c +42 -183
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390-proctitle.c +136 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390-syscalls.c +536 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390-syscalls.h +75 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390.c +1070 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/pipe.c +324 -55
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/poll.c +58 -11
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/posix-hrtime.c +36 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/posix-poll.c +385 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/process.c +795 -248
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/procfs-exepath.c +45 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/proctitle.c +77 -22
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/qnx.c +142 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-devurandom.c +93 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-getentropy.c +57 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-getrandom.c +86 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-sysctl-linux.c +99 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/signal.c +147 -39
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/stream.c +426 -474
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sunos.c +240 -98
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sysinfo-loadavg.c +36 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sysinfo-memory.c +42 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/tcp.c +402 -91
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/thread.c +497 -145
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/tty.c +269 -45
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/udp.c +695 -165
- data/src/cxx_supportlib/vendor-copy/libuv/src/uv-common.c +463 -61
- data/src/cxx_supportlib/vendor-copy/libuv/src/uv-common.h +248 -44
- data/src/cxx_supportlib/vendor-copy/libuv/src/uv-data-getter-setters.c +119 -0
- data/src/cxx_supportlib/vendor-copy/libuv/tsansupp.txt +2 -0
- data/src/cxx_supportlib/vendor-modified/libev/Changes +109 -0
- data/src/cxx_supportlib/vendor-modified/libev/Makefile.am +2 -1
- data/src/cxx_supportlib/vendor-modified/libev/Makefile.in +47 -33
- data/src/cxx_supportlib/vendor-modified/libev/README +2 -1
- data/src/cxx_supportlib/vendor-modified/libev/aclocal.m4 +1653 -1224
- data/src/cxx_supportlib/vendor-modified/libev/config.guess +376 -316
- data/src/cxx_supportlib/vendor-modified/libev/config.h.in +13 -2
- data/src/cxx_supportlib/vendor-modified/libev/config.sub +156 -154
- data/src/cxx_supportlib/vendor-modified/libev/configure +1431 -940
- data/src/cxx_supportlib/vendor-modified/libev/configure.ac +3 -3
- data/src/cxx_supportlib/vendor-modified/libev/depcomp +5 -5
- data/src/cxx_supportlib/vendor-modified/libev/ev++.h +109 -107
- data/src/cxx_supportlib/vendor-modified/libev/ev.c +807 -319
- data/src/cxx_supportlib/vendor-modified/libev/ev.h +111 -105
- data/src/cxx_supportlib/vendor-modified/libev/ev_epoll.c +42 -29
- data/src/cxx_supportlib/vendor-modified/libev/ev_iouring.c +694 -0
- data/src/cxx_supportlib/vendor-modified/libev/ev_kqueue.c +15 -9
- data/src/cxx_supportlib/vendor-modified/libev/ev_linuxaio.c +620 -0
- data/src/cxx_supportlib/vendor-modified/libev/ev_poll.c +19 -14
- data/src/cxx_supportlib/vendor-modified/libev/ev_port.c +8 -5
- data/src/cxx_supportlib/vendor-modified/libev/ev_select.c +6 -6
- data/src/cxx_supportlib/vendor-modified/libev/ev_vars.h +48 -3
- data/src/cxx_supportlib/vendor-modified/libev/ev_win32.c +2 -2
- data/src/cxx_supportlib/vendor-modified/libev/ev_wrap.h +72 -0
- data/src/cxx_supportlib/vendor-modified/libev/install-sh +23 -13
- data/src/cxx_supportlib/vendor-modified/libev/libev.m4 +6 -1
- data/src/cxx_supportlib/vendor-modified/libev/ltmain.sh +3581 -1993
- data/src/cxx_supportlib/vendor-modified/libev/missing +8 -8
- data/src/cxx_supportlib/vendor-modified/libev/mkinstalldirs +3 -3
- data/src/cxx_supportlib/vendor-modified/modp_b64_strict_aliasing.cpp +1 -1
- data/src/helper-scripts/backtrace-sanitizer.rb +1 -1
- data/src/helper-scripts/crash-watch.rb +1 -1
- data/src/helper-scripts/download_binaries/extconf.rb +1 -1
- data/src/helper-scripts/meteor-loader.rb +1 -1
- data/src/helper-scripts/node-loader.js +1 -1
- data/src/helper-scripts/prespawn +1 -1
- data/src/helper-scripts/rack-loader.rb +1 -1
- data/src/helper-scripts/rack-preloader.rb +1 -1
- data/src/helper-scripts/wsgi-loader.py +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c.cxxcodebuilder +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c.cxxcodebuilder +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c.cxxcodebuilder +1 -1
- data/src/nginx_module/Configuration.c +1 -1
- data/src/nginx_module/Configuration.h +1 -1
- data/src/nginx_module/ContentHandler.c +1 -1
- data/src/nginx_module/ContentHandler.h +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c.cxxcodebuilder +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c.cxxcodebuilder +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c.cxxcodebuilder +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c.cxxcodebuilder +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c.cxxcodebuilder +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c.cxxcodebuilder +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
- data/src/nginx_module/StaticContentHandler.c +1 -1
- data/src/nginx_module/StaticContentHandler.h +1 -1
- data/src/nginx_module/ngx_http_passenger_module.c +1 -1
- data/src/nginx_module/ngx_http_passenger_module.h +1 -1
- data/src/nodejs_supportlib/phusion_passenger/line_reader.js +1 -1
- data/src/ruby_native_extension/extconf.rb +1 -1
- data/src/ruby_native_extension/passenger_native_support.c +1 -1
- data/src/ruby_supportlib/phusion_passenger/abstract_installer.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/admin_tools/instance_registry.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/admin_tools/memory_stats.rb +2 -12
- data/src/ruby_supportlib/phusion_passenger/admin_tools.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/apache2/config_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/common_library.rb +8 -10
- data/src/ruby_supportlib/phusion_passenger/config/about_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/agent_compiler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/api_call_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/build_native_support_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/compile_agent_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/compile_nginx_engine_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/detach_process_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/download_agent_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/download_nginx_engine_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/install_agent_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/install_standalone_runtime_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/installation_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/list_instances_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/main.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +3 -2
- data/src/ruby_supportlib/phusion_passenger/config/reopen_logs_command.rb +6 -1
- data/src/ruby_supportlib/phusion_passenger/config/restart_app_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/system_metrics_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/system_properties_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/console_text_template.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/constants.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/debug_logging.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/message_channel.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/message_client.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/native_support.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +4 -3
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/binary_compatibility.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +195 -11
- data/src/ruby_supportlib/phusion_passenger/platform_info/crypto.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/curl.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/linux.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/networking.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/openssl.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/pcre.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/zlib.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/plugin.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/preloader_shared_helpers.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/public_api.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/rack/handler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/rack/out_of_band_gc.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/rack_handler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb +2 -7
- data/src/ruby_supportlib/phusion_passenger/request_handler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/ruby_core_enhancements.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/ruby_core_io_enhancements.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/simple_benchmarking.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/app_finder.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/control_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/main.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +4 -8
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/status_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/version_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/ansi_colors.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/download.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/file_system_watcher.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/hosts_file_parser.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/lock.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/native_support_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/progress_bar.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/strscan.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/terminal_choice_menu.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/unseekable_socket.rb +3 -13
- data/src/ruby_supportlib/phusion_passenger/utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/app.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/base.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/gdb_controller.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/lldb_controller.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/version.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/lock_file.rb +8 -6
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/spawn.rb +4 -3
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/version.rb +6 -4
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb +395 -579
- data/src/ruby_supportlib/phusion_passenger.rb +8 -8
- data/src/schema_printer/SchemaPrinterMain.cpp +1 -1
- data/src/schema_printer/SchemaPrinterMain.cpp.cxxcodebuilder +1 -1
- metadata +69 -32
- data/doc/DeveloperQuickstart.md +0 -70
- data/src/README.md +0 -7
- data/src/cxx_supportlib/vendor-copy/libuv/README.md +0 -245
- data/src/cxx_supportlib/vendor-copy/libuv/checksparse.sh +0 -234
- data/src/cxx_supportlib/vendor-copy/libuv/common.gypi +0 -210
- data/src/cxx_supportlib/vendor-copy/libuv/gyp_uv.py +0 -93
- data/src/cxx_supportlib/vendor-copy/libuv/include/android-ifaddrs.h +0 -54
- data/src/cxx_supportlib/vendor-copy/libuv/include/pthread-fixes.h +0 -72
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/android-ifaddrs.c +0 -703
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/atomic-ops.h +0 -77
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-core.c +0 -899
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-inotify.c +0 -285
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-syscalls.c +0 -471
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-syscalls.h +0 -158
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/pthread-fixes.c +0 -104
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/spinlock.h +0 -53
- data/src/cxx_supportlib/vendor-copy/libuv/uv.gyp +0 -508
- /data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-aix.h → uv/aix.h} +0 -0
- /data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-bsd.h → uv/bsd.h} +0 -0
- /data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-sunos.h → uv/sunos.h} +0 -0
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
#include <stdlib.h>
|
|
27
27
|
#include <assert.h>
|
|
28
28
|
#include <errno.h>
|
|
29
|
+
#include <signal.h>
|
|
30
|
+
#include <string.h>
|
|
29
31
|
|
|
30
32
|
#include <sys/types.h>
|
|
31
33
|
#include <sys/wait.h>
|
|
@@ -33,66 +35,129 @@
|
|
|
33
35
|
#include <fcntl.h>
|
|
34
36
|
#include <poll.h>
|
|
35
37
|
|
|
36
|
-
#if defined(__APPLE__)
|
|
38
|
+
#if defined(__APPLE__)
|
|
39
|
+
# include <spawn.h>
|
|
40
|
+
# include <paths.h>
|
|
41
|
+
# include <sys/kauth.h>
|
|
42
|
+
# include <sys/types.h>
|
|
43
|
+
# include <sys/sysctl.h>
|
|
44
|
+
# include <dlfcn.h>
|
|
37
45
|
# include <crt_externs.h>
|
|
46
|
+
# include <xlocale.h>
|
|
38
47
|
# define environ (*_NSGetEnviron())
|
|
48
|
+
|
|
49
|
+
/* macOS 10.14 back does not define this constant */
|
|
50
|
+
# ifndef POSIX_SPAWN_SETSID
|
|
51
|
+
# define POSIX_SPAWN_SETSID 1024
|
|
52
|
+
# endif
|
|
53
|
+
|
|
39
54
|
#else
|
|
40
55
|
extern char **environ;
|
|
41
56
|
#endif
|
|
42
57
|
|
|
43
|
-
#
|
|
58
|
+
#if defined(__linux__) || \
|
|
59
|
+
defined(__GNU__)
|
|
44
60
|
# include <grp.h>
|
|
45
61
|
#endif
|
|
46
62
|
|
|
63
|
+
#if defined(__MVS__)
|
|
64
|
+
# include "zos-base.h"
|
|
65
|
+
#endif
|
|
66
|
+
|
|
67
|
+
#ifdef UV_HAVE_KQUEUE
|
|
68
|
+
#include <sys/event.h>
|
|
69
|
+
#else
|
|
70
|
+
#define UV_USE_SIGCHLD
|
|
71
|
+
#endif
|
|
72
|
+
|
|
47
73
|
|
|
74
|
+
#ifdef UV_USE_SIGCHLD
|
|
48
75
|
static void uv__chld(uv_signal_t* handle, int signum) {
|
|
76
|
+
assert(signum == SIGCHLD);
|
|
77
|
+
uv__wait_children(handle->loop);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
int uv__process_init(uv_loop_t* loop) {
|
|
82
|
+
int err;
|
|
83
|
+
|
|
84
|
+
err = uv_signal_init(loop, &loop->child_watcher);
|
|
85
|
+
if (err)
|
|
86
|
+
return err;
|
|
87
|
+
uv__handle_unref(&loop->child_watcher);
|
|
88
|
+
loop->child_watcher.flags |= UV_HANDLE_INTERNAL;
|
|
89
|
+
return 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
#else
|
|
94
|
+
int uv__process_init(uv_loop_t* loop) {
|
|
95
|
+
memset(&loop->child_watcher, 0, sizeof(loop->child_watcher));
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
#endif
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
void uv__wait_children(uv_loop_t* loop) {
|
|
49
102
|
uv_process_t* process;
|
|
50
|
-
uv_loop_t* loop;
|
|
51
103
|
int exit_status;
|
|
52
104
|
int term_signal;
|
|
53
105
|
int status;
|
|
106
|
+
int options;
|
|
54
107
|
pid_t pid;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
108
|
+
struct uv__queue pending;
|
|
109
|
+
struct uv__queue* q;
|
|
110
|
+
struct uv__queue* h;
|
|
58
111
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
QUEUE_INIT(&pending);
|
|
62
|
-
loop = handle->loop;
|
|
112
|
+
uv__queue_init(&pending);
|
|
63
113
|
|
|
64
114
|
h = &loop->process_handles;
|
|
65
|
-
q =
|
|
115
|
+
q = uv__queue_head(h);
|
|
66
116
|
while (q != h) {
|
|
67
|
-
process =
|
|
68
|
-
q =
|
|
117
|
+
process = uv__queue_data(q, uv_process_t, queue);
|
|
118
|
+
q = uv__queue_next(q);
|
|
119
|
+
|
|
120
|
+
#ifndef UV_USE_SIGCHLD
|
|
121
|
+
if ((process->flags & UV_HANDLE_REAP) == 0)
|
|
122
|
+
continue;
|
|
123
|
+
options = 0;
|
|
124
|
+
process->flags &= ~UV_HANDLE_REAP;
|
|
125
|
+
loop->nfds--;
|
|
126
|
+
#else
|
|
127
|
+
options = WNOHANG;
|
|
128
|
+
#endif
|
|
69
129
|
|
|
70
130
|
do
|
|
71
|
-
pid = waitpid(process->pid, &status,
|
|
131
|
+
pid = waitpid(process->pid, &status, options);
|
|
72
132
|
while (pid == -1 && errno == EINTR);
|
|
73
133
|
|
|
74
|
-
|
|
134
|
+
#ifdef UV_USE_SIGCHLD
|
|
135
|
+
if (pid == 0) /* Not yet exited */
|
|
75
136
|
continue;
|
|
137
|
+
#endif
|
|
76
138
|
|
|
77
139
|
if (pid == -1) {
|
|
78
140
|
if (errno != ECHILD)
|
|
79
141
|
abort();
|
|
142
|
+
/* The child died, and we missed it. This probably means someone else
|
|
143
|
+
* stole the waitpid from us. Handle this by not handling it at all. */
|
|
80
144
|
continue;
|
|
81
145
|
}
|
|
82
146
|
|
|
147
|
+
assert(pid == process->pid);
|
|
83
148
|
process->status = status;
|
|
84
|
-
|
|
85
|
-
|
|
149
|
+
uv__queue_remove(&process->queue);
|
|
150
|
+
uv__queue_insert_tail(&pending, &process->queue);
|
|
86
151
|
}
|
|
87
152
|
|
|
88
153
|
h = &pending;
|
|
89
|
-
q =
|
|
154
|
+
q = uv__queue_head(h);
|
|
90
155
|
while (q != h) {
|
|
91
|
-
process =
|
|
92
|
-
q =
|
|
156
|
+
process = uv__queue_data(q, uv_process_t, queue);
|
|
157
|
+
q = uv__queue_next(q);
|
|
93
158
|
|
|
94
|
-
|
|
95
|
-
|
|
159
|
+
uv__queue_remove(&process->queue);
|
|
160
|
+
uv__queue_init(&process->queue);
|
|
96
161
|
uv__handle_stop(process);
|
|
97
162
|
|
|
98
163
|
if (process->exit_cb == NULL)
|
|
@@ -108,83 +173,18 @@ static void uv__chld(uv_signal_t* handle, int signum) {
|
|
|
108
173
|
|
|
109
174
|
process->exit_cb(process, exit_status, term_signal);
|
|
110
175
|
}
|
|
111
|
-
assert(
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
int uv__make_socketpair(int fds[2], int flags) {
|
|
116
|
-
#if defined(__linux__)
|
|
117
|
-
static int no_cloexec;
|
|
118
|
-
|
|
119
|
-
if (no_cloexec)
|
|
120
|
-
goto skip;
|
|
121
|
-
|
|
122
|
-
if (socketpair(AF_UNIX, SOCK_STREAM | UV__SOCK_CLOEXEC | flags, 0, fds) == 0)
|
|
123
|
-
return 0;
|
|
124
|
-
|
|
125
|
-
/* Retry on EINVAL, it means SOCK_CLOEXEC is not supported.
|
|
126
|
-
* Anything else is a genuine error.
|
|
127
|
-
*/
|
|
128
|
-
if (errno != EINVAL)
|
|
129
|
-
return -errno;
|
|
130
|
-
|
|
131
|
-
no_cloexec = 1;
|
|
132
|
-
|
|
133
|
-
skip:
|
|
134
|
-
#endif
|
|
135
|
-
|
|
136
|
-
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds))
|
|
137
|
-
return -errno;
|
|
138
|
-
|
|
139
|
-
uv__cloexec(fds[0], 1);
|
|
140
|
-
uv__cloexec(fds[1], 1);
|
|
141
|
-
|
|
142
|
-
if (flags & UV__F_NONBLOCK) {
|
|
143
|
-
uv__nonblock(fds[0], 1);
|
|
144
|
-
uv__nonblock(fds[1], 1);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return 0;
|
|
176
|
+
assert(uv__queue_empty(&pending));
|
|
148
177
|
}
|
|
149
178
|
|
|
150
|
-
|
|
151
|
-
int uv__make_pipe(int fds[2], int flags) {
|
|
152
|
-
#if defined(__linux__)
|
|
153
|
-
static int no_pipe2;
|
|
154
|
-
|
|
155
|
-
if (no_pipe2)
|
|
156
|
-
goto skip;
|
|
157
|
-
|
|
158
|
-
if (uv__pipe2(fds, flags | UV__O_CLOEXEC) == 0)
|
|
159
|
-
return 0;
|
|
160
|
-
|
|
161
|
-
if (errno != ENOSYS)
|
|
162
|
-
return -errno;
|
|
163
|
-
|
|
164
|
-
no_pipe2 = 1;
|
|
165
|
-
|
|
166
|
-
skip:
|
|
167
|
-
#endif
|
|
168
|
-
|
|
169
|
-
if (pipe(fds))
|
|
170
|
-
return -errno;
|
|
171
|
-
|
|
172
|
-
uv__cloexec(fds[0], 1);
|
|
173
|
-
uv__cloexec(fds[1], 1);
|
|
174
|
-
|
|
175
|
-
if (flags & UV__F_NONBLOCK) {
|
|
176
|
-
uv__nonblock(fds[0], 1);
|
|
177
|
-
uv__nonblock(fds[1], 1);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return 0;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
179
|
/*
|
|
185
180
|
* Used for initializing stdio streams like options.stdin_stream. Returns
|
|
186
181
|
* zero on success. See also the cleanup section in uv_spawn().
|
|
187
182
|
*/
|
|
183
|
+
#if !(defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH))
|
|
184
|
+
/* execvp is marked __WATCHOS_PROHIBITED __TVOS_PROHIBITED, so must be
|
|
185
|
+
* avoided. Since this isn't called on those targets, the function
|
|
186
|
+
* doesn't even need to be defined for them.
|
|
187
|
+
*/
|
|
188
188
|
static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) {
|
|
189
189
|
int mask;
|
|
190
190
|
int fd;
|
|
@@ -198,9 +198,9 @@ static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) {
|
|
|
198
198
|
case UV_CREATE_PIPE:
|
|
199
199
|
assert(container->data.stream != NULL);
|
|
200
200
|
if (container->data.stream->type != UV_NAMED_PIPE)
|
|
201
|
-
return
|
|
201
|
+
return UV_EINVAL;
|
|
202
202
|
else
|
|
203
|
-
return
|
|
203
|
+
return uv_socketpair(SOCK_STREAM, 0, fds, 0, 0);
|
|
204
204
|
|
|
205
205
|
case UV_INHERIT_FD:
|
|
206
206
|
case UV_INHERIT_STREAM:
|
|
@@ -210,21 +210,20 @@ static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) {
|
|
|
210
210
|
fd = uv__stream_fd(container->data.stream);
|
|
211
211
|
|
|
212
212
|
if (fd == -1)
|
|
213
|
-
return
|
|
213
|
+
return UV_EINVAL;
|
|
214
214
|
|
|
215
215
|
fds[1] = fd;
|
|
216
216
|
return 0;
|
|
217
217
|
|
|
218
218
|
default:
|
|
219
219
|
assert(0 && "Unexpected flags");
|
|
220
|
-
return
|
|
220
|
+
return UV_EINVAL;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
|
|
225
225
|
static int uv__process_open_stream(uv_stdio_container_t* container,
|
|
226
|
-
int pipefds[2]
|
|
227
|
-
int writable) {
|
|
226
|
+
int pipefds[2]) {
|
|
228
227
|
int flags;
|
|
229
228
|
int err;
|
|
230
229
|
|
|
@@ -232,19 +231,17 @@ static int uv__process_open_stream(uv_stdio_container_t* container,
|
|
|
232
231
|
return 0;
|
|
233
232
|
|
|
234
233
|
err = uv__close(pipefds[1]);
|
|
235
|
-
if (err != 0
|
|
234
|
+
if (err != 0)
|
|
236
235
|
abort();
|
|
237
236
|
|
|
238
237
|
pipefds[1] = -1;
|
|
239
238
|
uv__nonblock(pipefds[0], 1);
|
|
240
239
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
flags
|
|
244
|
-
|
|
245
|
-
flags
|
|
246
|
-
else
|
|
247
|
-
flags = UV_STREAM_READABLE;
|
|
240
|
+
flags = 0;
|
|
241
|
+
if (container->flags & UV_WRITABLE_PIPE)
|
|
242
|
+
flags |= UV_HANDLE_READABLE;
|
|
243
|
+
if (container->flags & UV_READABLE_PIPE)
|
|
244
|
+
flags |= UV_HANDLE_WRITABLE;
|
|
248
245
|
|
|
249
246
|
return uv__stream_open(container->data.stream, pipefds[0], flags);
|
|
250
247
|
}
|
|
@@ -252,7 +249,7 @@ static int uv__process_open_stream(uv_stdio_container_t* container,
|
|
|
252
249
|
|
|
253
250
|
static void uv__process_close_stream(uv_stdio_container_t* container) {
|
|
254
251
|
if (!(container->flags & UV_CREATE_PIPE)) return;
|
|
255
|
-
uv__stream_close(
|
|
252
|
+
uv__stream_close(container->data.stream);
|
|
256
253
|
}
|
|
257
254
|
|
|
258
255
|
|
|
@@ -263,25 +260,46 @@ static void uv__write_int(int fd, int val) {
|
|
|
263
260
|
n = write(fd, &val, sizeof(val));
|
|
264
261
|
while (n == -1 && errno == EINTR);
|
|
265
262
|
|
|
266
|
-
|
|
267
|
-
|
|
263
|
+
/* The write might have failed (e.g. if the parent process has died),
|
|
264
|
+
* but we have nothing left but to _exit ourself now too. */
|
|
265
|
+
_exit(127);
|
|
266
|
+
}
|
|
268
267
|
|
|
269
|
-
|
|
268
|
+
|
|
269
|
+
static void uv__write_errno(int error_fd) {
|
|
270
|
+
uv__write_int(error_fd, UV__ERR(errno));
|
|
270
271
|
}
|
|
271
272
|
|
|
272
273
|
|
|
273
|
-
#if !(defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH))
|
|
274
|
-
/* execvp is marked __WATCHOS_PROHIBITED __TVOS_PROHIBITED, so must be
|
|
275
|
-
* avoided. Since this isn't called on those targets, the function
|
|
276
|
-
* doesn't even need to be defined for them.
|
|
277
|
-
*/
|
|
278
274
|
static void uv__process_child_init(const uv_process_options_t* options,
|
|
279
275
|
int stdio_count,
|
|
280
276
|
int (*pipes)[2],
|
|
281
277
|
int error_fd) {
|
|
278
|
+
sigset_t signewset;
|
|
282
279
|
int close_fd;
|
|
283
280
|
int use_fd;
|
|
284
281
|
int fd;
|
|
282
|
+
int n;
|
|
283
|
+
|
|
284
|
+
/* Reset signal disposition first. Use a hard-coded limit because NSIG is not
|
|
285
|
+
* fixed on Linux: it's either 32, 34 or 64, depending on whether RT signals
|
|
286
|
+
* are enabled. We are not allowed to touch RT signal handlers, glibc uses
|
|
287
|
+
* them internally.
|
|
288
|
+
*/
|
|
289
|
+
for (n = 1; n < 32; n += 1) {
|
|
290
|
+
if (n == SIGKILL || n == SIGSTOP)
|
|
291
|
+
continue; /* Can't be changed. */
|
|
292
|
+
|
|
293
|
+
#if defined(__HAIKU__)
|
|
294
|
+
if (n == SIGKILLTHR)
|
|
295
|
+
continue; /* Can't be changed. */
|
|
296
|
+
#endif
|
|
297
|
+
|
|
298
|
+
if (SIG_ERR != signal(n, SIG_DFL))
|
|
299
|
+
continue;
|
|
300
|
+
|
|
301
|
+
uv__write_errno(error_fd);
|
|
302
|
+
}
|
|
285
303
|
|
|
286
304
|
if (options->flags & UV_PROCESS_DETACHED)
|
|
287
305
|
setsid();
|
|
@@ -294,62 +312,62 @@ static void uv__process_child_init(const uv_process_options_t* options,
|
|
|
294
312
|
use_fd = pipes[fd][1];
|
|
295
313
|
if (use_fd < 0 || use_fd >= fd)
|
|
296
314
|
continue;
|
|
315
|
+
#ifdef F_DUPFD_CLOEXEC /* POSIX 2008 */
|
|
316
|
+
pipes[fd][1] = fcntl(use_fd, F_DUPFD_CLOEXEC, stdio_count);
|
|
317
|
+
#else
|
|
297
318
|
pipes[fd][1] = fcntl(use_fd, F_DUPFD, stdio_count);
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
319
|
+
#endif
|
|
320
|
+
if (pipes[fd][1] == -1)
|
|
321
|
+
uv__write_errno(error_fd);
|
|
322
|
+
#ifndef F_DUPFD_CLOEXEC /* POSIX 2008 */
|
|
323
|
+
n = uv__cloexec(pipes[fd][1], 1);
|
|
324
|
+
if (n)
|
|
325
|
+
uv__write_int(error_fd, n);
|
|
326
|
+
#endif
|
|
302
327
|
}
|
|
303
328
|
|
|
304
329
|
for (fd = 0; fd < stdio_count; fd++) {
|
|
305
|
-
close_fd =
|
|
330
|
+
close_fd = -1;
|
|
306
331
|
use_fd = pipes[fd][1];
|
|
307
332
|
|
|
308
333
|
if (use_fd < 0) {
|
|
309
334
|
if (fd >= 3)
|
|
310
335
|
continue;
|
|
311
336
|
else {
|
|
312
|
-
/*
|
|
313
|
-
* set
|
|
314
|
-
|
|
337
|
+
/* Redirect stdin, stdout and stderr to /dev/null even if UV_IGNORE is
|
|
338
|
+
* set. */
|
|
339
|
+
uv__close_nocheckstdio(fd); /* Free up fd, if it happens to be open. */
|
|
315
340
|
use_fd = open("/dev/null", fd == 0 ? O_RDONLY : O_RDWR);
|
|
316
341
|
close_fd = use_fd;
|
|
317
342
|
|
|
318
|
-
if (use_fd
|
|
319
|
-
|
|
320
|
-
_exit(127);
|
|
321
|
-
}
|
|
343
|
+
if (use_fd < 0)
|
|
344
|
+
uv__write_errno(error_fd);
|
|
322
345
|
}
|
|
323
346
|
}
|
|
324
347
|
|
|
325
|
-
if (fd == use_fd)
|
|
326
|
-
|
|
327
|
-
|
|
348
|
+
if (fd == use_fd) {
|
|
349
|
+
if (close_fd == -1) {
|
|
350
|
+
n = uv__cloexec(use_fd, 0);
|
|
351
|
+
if (n)
|
|
352
|
+
uv__write_int(error_fd, n);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
328
356
|
fd = dup2(use_fd, fd);
|
|
329
|
-
|
|
330
|
-
if (fd == -1) {
|
|
331
|
-
uv__write_int(error_fd, -errno);
|
|
332
|
-
_exit(127);
|
|
333
357
|
}
|
|
334
358
|
|
|
335
|
-
if (fd
|
|
336
|
-
|
|
359
|
+
if (fd == -1)
|
|
360
|
+
uv__write_errno(error_fd);
|
|
361
|
+
|
|
362
|
+
if (fd <= 2 && close_fd == -1)
|
|
363
|
+
uv__nonblock_fcntl(fd, 0);
|
|
337
364
|
|
|
338
365
|
if (close_fd >= stdio_count)
|
|
339
366
|
uv__close(close_fd);
|
|
340
367
|
}
|
|
341
368
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
if (use_fd >= stdio_count)
|
|
346
|
-
uv__close(use_fd);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
if (options->cwd != NULL && chdir(options->cwd)) {
|
|
350
|
-
uv__write_int(error_fd, -errno);
|
|
351
|
-
_exit(127);
|
|
352
|
-
}
|
|
369
|
+
if (options->cwd != NULL && chdir(options->cwd))
|
|
370
|
+
uv__write_errno(error_fd);
|
|
353
371
|
|
|
354
372
|
if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
|
|
355
373
|
/* When dropping privileges from root, the `setgroups` call will
|
|
@@ -362,60 +380,614 @@ static void uv__process_child_init(const uv_process_options_t* options,
|
|
|
362
380
|
SAVE_ERRNO(setgroups(0, NULL));
|
|
363
381
|
}
|
|
364
382
|
|
|
365
|
-
if ((options->flags & UV_PROCESS_SETGID) && setgid(options->gid))
|
|
366
|
-
|
|
367
|
-
|
|
383
|
+
if ((options->flags & UV_PROCESS_SETGID) && setgid(options->gid))
|
|
384
|
+
uv__write_errno(error_fd);
|
|
385
|
+
|
|
386
|
+
if ((options->flags & UV_PROCESS_SETUID) && setuid(options->uid))
|
|
387
|
+
uv__write_errno(error_fd);
|
|
388
|
+
|
|
389
|
+
if (options->env != NULL)
|
|
390
|
+
environ = options->env;
|
|
391
|
+
|
|
392
|
+
/* Reset signal mask just before exec. */
|
|
393
|
+
sigemptyset(&signewset);
|
|
394
|
+
if (sigprocmask(SIG_SETMASK, &signewset, NULL) != 0)
|
|
395
|
+
abort();
|
|
396
|
+
|
|
397
|
+
#ifdef __MVS__
|
|
398
|
+
execvpe(options->file, options->args, environ);
|
|
399
|
+
#else
|
|
400
|
+
execvp(options->file, options->args);
|
|
401
|
+
#endif
|
|
402
|
+
|
|
403
|
+
uv__write_errno(error_fd);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
#if defined(__APPLE__)
|
|
408
|
+
typedef struct uv__posix_spawn_fncs_tag {
|
|
409
|
+
struct {
|
|
410
|
+
int (*addchdir_np)(const posix_spawn_file_actions_t *, const char *);
|
|
411
|
+
} file_actions;
|
|
412
|
+
} uv__posix_spawn_fncs_t;
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
static uv_once_t posix_spawn_init_once = UV_ONCE_INIT;
|
|
416
|
+
static uv__posix_spawn_fncs_t posix_spawn_fncs;
|
|
417
|
+
static int posix_spawn_can_use_setsid;
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
static void uv__spawn_init_posix_spawn_fncs(void) {
|
|
421
|
+
/* Try to locate all non-portable functions at runtime */
|
|
422
|
+
posix_spawn_fncs.file_actions.addchdir_np =
|
|
423
|
+
dlsym(RTLD_DEFAULT, "posix_spawn_file_actions_addchdir_np");
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
static void uv__spawn_init_can_use_setsid(void) {
|
|
428
|
+
int which[] = {CTL_KERN, KERN_OSRELEASE};
|
|
429
|
+
unsigned major;
|
|
430
|
+
unsigned minor;
|
|
431
|
+
unsigned patch;
|
|
432
|
+
char buf[256];
|
|
433
|
+
size_t len;
|
|
434
|
+
|
|
435
|
+
len = sizeof(buf);
|
|
436
|
+
if (sysctl(which, ARRAY_SIZE(which), buf, &len, NULL, 0))
|
|
437
|
+
return;
|
|
438
|
+
|
|
439
|
+
/* NULL specifies to use LC_C_LOCALE */
|
|
440
|
+
if (3 != sscanf_l(buf, NULL, "%u.%u.%u", &major, &minor, &patch))
|
|
441
|
+
return;
|
|
442
|
+
|
|
443
|
+
posix_spawn_can_use_setsid = (major >= 19); /* macOS Catalina */
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
static void uv__spawn_init_posix_spawn(void) {
|
|
448
|
+
/* Init handles to all potentially non-defined functions */
|
|
449
|
+
uv__spawn_init_posix_spawn_fncs();
|
|
450
|
+
|
|
451
|
+
/* Init feature detection for POSIX_SPAWN_SETSID flag */
|
|
452
|
+
uv__spawn_init_can_use_setsid();
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
static int uv__spawn_set_posix_spawn_attrs(
|
|
457
|
+
posix_spawnattr_t* attrs,
|
|
458
|
+
const uv__posix_spawn_fncs_t* posix_spawn_fncs,
|
|
459
|
+
const uv_process_options_t* options) {
|
|
460
|
+
int err;
|
|
461
|
+
unsigned int flags;
|
|
462
|
+
sigset_t signal_set;
|
|
463
|
+
|
|
464
|
+
err = posix_spawnattr_init(attrs);
|
|
465
|
+
if (err != 0) {
|
|
466
|
+
/* If initialization fails, no need to de-init, just return */
|
|
467
|
+
return err;
|
|
368
468
|
}
|
|
369
469
|
|
|
370
|
-
if (
|
|
371
|
-
|
|
372
|
-
|
|
470
|
+
if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
|
|
471
|
+
/* kauth_cred_issuser currently requires exactly uid == 0 for these
|
|
472
|
+
* posixspawn_attrs (set_groups_np, setuid_np, setgid_np), which deviates
|
|
473
|
+
* from the normal specification of setuid (which also uses euid), and they
|
|
474
|
+
* are also undocumented syscalls, so we do not use them. */
|
|
475
|
+
err = ENOSYS;
|
|
476
|
+
goto error;
|
|
373
477
|
}
|
|
374
478
|
|
|
375
|
-
|
|
376
|
-
|
|
479
|
+
/* Set flags for spawn behavior
|
|
480
|
+
* 1) POSIX_SPAWN_CLOEXEC_DEFAULT: (Apple Extension) All descriptors in the
|
|
481
|
+
* parent will be treated as if they had been created with O_CLOEXEC. The
|
|
482
|
+
* only fds that will be passed on to the child are those manipulated by
|
|
483
|
+
* the file actions
|
|
484
|
+
* 2) POSIX_SPAWN_SETSIGDEF: Signals mentioned in spawn-sigdefault in the
|
|
485
|
+
* spawn attributes will be reset to behave as their default
|
|
486
|
+
* 3) POSIX_SPAWN_SETSIGMASK: Signal mask will be set to the value of
|
|
487
|
+
* spawn-sigmask in attributes
|
|
488
|
+
* 4) POSIX_SPAWN_SETSID: Make the process a new session leader if a detached
|
|
489
|
+
* session was requested. */
|
|
490
|
+
flags = POSIX_SPAWN_CLOEXEC_DEFAULT |
|
|
491
|
+
POSIX_SPAWN_SETSIGDEF |
|
|
492
|
+
POSIX_SPAWN_SETSIGMASK;
|
|
493
|
+
if (options->flags & UV_PROCESS_DETACHED) {
|
|
494
|
+
/* If running on a version of macOS where this flag is not supported,
|
|
495
|
+
* revert back to the fork/exec flow. Otherwise posix_spawn will
|
|
496
|
+
* silently ignore the flag. */
|
|
497
|
+
if (!posix_spawn_can_use_setsid) {
|
|
498
|
+
err = ENOSYS;
|
|
499
|
+
goto error;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
flags |= POSIX_SPAWN_SETSID;
|
|
377
503
|
}
|
|
504
|
+
err = posix_spawnattr_setflags(attrs, flags);
|
|
505
|
+
if (err != 0)
|
|
506
|
+
goto error;
|
|
378
507
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
508
|
+
/* Reset all signal the child to their default behavior */
|
|
509
|
+
sigfillset(&signal_set);
|
|
510
|
+
err = posix_spawnattr_setsigdefault(attrs, &signal_set);
|
|
511
|
+
if (err != 0)
|
|
512
|
+
goto error;
|
|
513
|
+
|
|
514
|
+
/* Reset the signal mask for all signals */
|
|
515
|
+
sigemptyset(&signal_set);
|
|
516
|
+
err = posix_spawnattr_setsigmask(attrs, &signal_set);
|
|
517
|
+
if (err != 0)
|
|
518
|
+
goto error;
|
|
519
|
+
|
|
520
|
+
return err;
|
|
521
|
+
|
|
522
|
+
error:
|
|
523
|
+
(void) posix_spawnattr_destroy(attrs);
|
|
524
|
+
return err;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
static int uv__spawn_set_posix_spawn_file_actions(
|
|
529
|
+
posix_spawn_file_actions_t* actions,
|
|
530
|
+
const uv__posix_spawn_fncs_t* posix_spawn_fncs,
|
|
531
|
+
const uv_process_options_t* options,
|
|
532
|
+
int stdio_count,
|
|
533
|
+
int (*pipes)[2]) {
|
|
534
|
+
int fd;
|
|
535
|
+
int fd2;
|
|
536
|
+
int use_fd;
|
|
537
|
+
int err;
|
|
538
|
+
|
|
539
|
+
err = posix_spawn_file_actions_init(actions);
|
|
540
|
+
if (err != 0) {
|
|
541
|
+
/* If initialization fails, no need to de-init, just return */
|
|
542
|
+
return err;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/* Set the current working directory if requested */
|
|
546
|
+
if (options->cwd != NULL) {
|
|
547
|
+
if (posix_spawn_fncs->file_actions.addchdir_np == NULL) {
|
|
548
|
+
err = ENOSYS;
|
|
549
|
+
goto error;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
err = posix_spawn_fncs->file_actions.addchdir_np(actions, options->cwd);
|
|
553
|
+
if (err != 0)
|
|
554
|
+
goto error;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/* Do not return ENOSYS after this point, as we may mutate pipes. */
|
|
558
|
+
|
|
559
|
+
/* First duplicate low numbered fds, since it's not safe to duplicate them,
|
|
560
|
+
* they could get replaced. Example: swapping stdout and stderr; without
|
|
561
|
+
* this fd 2 (stderr) would be duplicated into fd 1, thus making both
|
|
562
|
+
* stdout and stderr go to the same fd, which was not the intention. */
|
|
563
|
+
for (fd = 0; fd < stdio_count; fd++) {
|
|
564
|
+
use_fd = pipes[fd][1];
|
|
565
|
+
if (use_fd < 0 || use_fd >= fd)
|
|
566
|
+
continue;
|
|
567
|
+
use_fd = stdio_count;
|
|
568
|
+
for (fd2 = 0; fd2 < stdio_count; fd2++) {
|
|
569
|
+
/* If we were not setting POSIX_SPAWN_CLOEXEC_DEFAULT, we would need to
|
|
570
|
+
* also consider whether fcntl(fd, F_GETFD) returned without the
|
|
571
|
+
* FD_CLOEXEC flag set. */
|
|
572
|
+
if (pipes[fd2][1] == use_fd) {
|
|
573
|
+
use_fd++;
|
|
574
|
+
fd2 = 0;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
err = posix_spawn_file_actions_adddup2(
|
|
578
|
+
actions,
|
|
579
|
+
pipes[fd][1],
|
|
580
|
+
use_fd);
|
|
581
|
+
assert(err != ENOSYS);
|
|
582
|
+
if (err != 0)
|
|
583
|
+
goto error;
|
|
584
|
+
pipes[fd][1] = use_fd;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/* Second, move the descriptors into their respective places */
|
|
588
|
+
for (fd = 0; fd < stdio_count; fd++) {
|
|
589
|
+
use_fd = pipes[fd][1];
|
|
590
|
+
if (use_fd < 0) {
|
|
591
|
+
if (fd >= 3)
|
|
592
|
+
continue;
|
|
593
|
+
else {
|
|
594
|
+
/* If ignored, redirect to (or from) /dev/null, */
|
|
595
|
+
err = posix_spawn_file_actions_addopen(
|
|
596
|
+
actions,
|
|
597
|
+
fd,
|
|
598
|
+
"/dev/null",
|
|
599
|
+
fd == 0 ? O_RDONLY : O_RDWR,
|
|
600
|
+
0);
|
|
601
|
+
assert(err != ENOSYS);
|
|
602
|
+
if (err != 0)
|
|
603
|
+
goto error;
|
|
604
|
+
continue;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
if (fd == use_fd)
|
|
609
|
+
err = posix_spawn_file_actions_addinherit_np(actions, fd);
|
|
610
|
+
else
|
|
611
|
+
err = posix_spawn_file_actions_adddup2(actions, use_fd, fd);
|
|
612
|
+
assert(err != ENOSYS);
|
|
613
|
+
if (err != 0)
|
|
614
|
+
goto error;
|
|
615
|
+
|
|
616
|
+
/* Make sure the fd is marked as non-blocking (state shared between child
|
|
617
|
+
* and parent). */
|
|
618
|
+
uv__nonblock_fcntl(use_fd, 0);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/* Finally, close all the superfluous descriptors */
|
|
622
|
+
for (fd = 0; fd < stdio_count; fd++) {
|
|
623
|
+
use_fd = pipes[fd][1];
|
|
624
|
+
if (use_fd < stdio_count)
|
|
625
|
+
continue;
|
|
626
|
+
|
|
627
|
+
/* Check if we already closed this. */
|
|
628
|
+
for (fd2 = 0; fd2 < fd; fd2++) {
|
|
629
|
+
if (pipes[fd2][1] == use_fd)
|
|
630
|
+
break;
|
|
631
|
+
}
|
|
632
|
+
if (fd2 < fd)
|
|
633
|
+
continue;
|
|
634
|
+
|
|
635
|
+
err = posix_spawn_file_actions_addclose(actions, use_fd);
|
|
636
|
+
assert(err != ENOSYS);
|
|
637
|
+
if (err != 0)
|
|
638
|
+
goto error;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
return 0;
|
|
642
|
+
|
|
643
|
+
error:
|
|
644
|
+
(void) posix_spawn_file_actions_destroy(actions);
|
|
645
|
+
return err;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
char* uv__spawn_find_path_in_env(char** env) {
|
|
649
|
+
char** env_iterator;
|
|
650
|
+
const char path_var[] = "PATH=";
|
|
651
|
+
|
|
652
|
+
/* Look for an environment variable called PATH in the
|
|
653
|
+
* provided env array, and return its value if found */
|
|
654
|
+
for (env_iterator = env; *env_iterator != NULL; env_iterator++) {
|
|
655
|
+
if (strncmp(*env_iterator, path_var, sizeof(path_var) - 1) == 0) {
|
|
656
|
+
/* Found "PATH=" at the beginning of the string */
|
|
657
|
+
return *env_iterator + sizeof(path_var) - 1;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
return NULL;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
static int uv__spawn_resolve_and_spawn(const uv_process_options_t* options,
|
|
666
|
+
posix_spawnattr_t* attrs,
|
|
667
|
+
posix_spawn_file_actions_t* actions,
|
|
668
|
+
pid_t* pid) {
|
|
669
|
+
const char *p;
|
|
670
|
+
const char *z;
|
|
671
|
+
const char *path;
|
|
672
|
+
size_t l;
|
|
673
|
+
size_t k;
|
|
674
|
+
int err;
|
|
675
|
+
int seen_eacces;
|
|
676
|
+
|
|
677
|
+
path = NULL;
|
|
678
|
+
err = -1;
|
|
679
|
+
seen_eacces = 0;
|
|
680
|
+
|
|
681
|
+
/* Short circuit for erroneous case */
|
|
682
|
+
if (options->file == NULL)
|
|
683
|
+
return ENOENT;
|
|
684
|
+
|
|
685
|
+
/* The environment for the child process is that of the parent unless overridden
|
|
686
|
+
* by options->env */
|
|
687
|
+
char** env = environ;
|
|
688
|
+
if (options->env != NULL)
|
|
689
|
+
env = options->env;
|
|
690
|
+
|
|
691
|
+
/* If options->file contains a slash, posix_spawn/posix_spawnp should behave
|
|
692
|
+
* the same, and do not involve PATH resolution at all. The libc
|
|
693
|
+
* `posix_spawnp` provided by Apple is buggy (since 10.15), so we now emulate it
|
|
694
|
+
* here, per https://github.com/libuv/libuv/pull/3583. */
|
|
695
|
+
if (strchr(options->file, '/') != NULL) {
|
|
696
|
+
do
|
|
697
|
+
err = posix_spawn(pid, options->file, actions, attrs, options->args, env);
|
|
698
|
+
while (err == EINTR);
|
|
699
|
+
return err;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/* Look for the definition of PATH in the provided env */
|
|
703
|
+
path = uv__spawn_find_path_in_env(env);
|
|
704
|
+
|
|
705
|
+
/* The following resolution logic (execvpe emulation) is copied from
|
|
706
|
+
* https://git.musl-libc.org/cgit/musl/tree/src/process/execvp.c
|
|
707
|
+
* and adapted to work for our specific usage */
|
|
708
|
+
|
|
709
|
+
/* If no path was provided in env, use the default value
|
|
710
|
+
* to look for the executable */
|
|
711
|
+
if (path == NULL)
|
|
712
|
+
path = _PATH_DEFPATH;
|
|
713
|
+
|
|
714
|
+
k = strnlen(options->file, NAME_MAX + 1);
|
|
715
|
+
if (k > NAME_MAX)
|
|
716
|
+
return ENAMETOOLONG;
|
|
717
|
+
|
|
718
|
+
l = strnlen(path, PATH_MAX - 1) + 1;
|
|
719
|
+
|
|
720
|
+
for (p = path;; p = z) {
|
|
721
|
+
/* Compose the new process file from the entry in the PATH
|
|
722
|
+
* environment variable and the actual file name */
|
|
723
|
+
char b[PATH_MAX + NAME_MAX];
|
|
724
|
+
z = strchr(p, ':');
|
|
725
|
+
if (!z)
|
|
726
|
+
z = p + strlen(p);
|
|
727
|
+
if ((size_t)(z - p) >= l) {
|
|
728
|
+
if (!*z++)
|
|
729
|
+
break;
|
|
730
|
+
|
|
731
|
+
continue;
|
|
732
|
+
}
|
|
733
|
+
memcpy(b, p, z - p);
|
|
734
|
+
b[z - p] = '/';
|
|
735
|
+
memcpy(b + (z - p) + (z > p), options->file, k + 1);
|
|
736
|
+
|
|
737
|
+
/* Try to spawn the new process file. If it fails with ENOENT, the
|
|
738
|
+
* new process file is not in this PATH entry, continue with the next
|
|
739
|
+
* PATH entry. */
|
|
740
|
+
do
|
|
741
|
+
err = posix_spawn(pid, b, actions, attrs, options->args, env);
|
|
742
|
+
while (err == EINTR);
|
|
743
|
+
|
|
744
|
+
switch (err) {
|
|
745
|
+
case EACCES:
|
|
746
|
+
seen_eacces = 1;
|
|
747
|
+
break; /* continue search */
|
|
748
|
+
case ENOENT:
|
|
749
|
+
case ENOTDIR:
|
|
750
|
+
break; /* continue search */
|
|
751
|
+
default:
|
|
752
|
+
return err;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
if (!*z++)
|
|
756
|
+
break;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
if (seen_eacces)
|
|
760
|
+
return EACCES;
|
|
761
|
+
return err;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
static int uv__spawn_and_init_child_posix_spawn(
|
|
766
|
+
const uv_process_options_t* options,
|
|
767
|
+
int stdio_count,
|
|
768
|
+
int (*pipes)[2],
|
|
769
|
+
pid_t* pid,
|
|
770
|
+
const uv__posix_spawn_fncs_t* posix_spawn_fncs) {
|
|
771
|
+
int err;
|
|
772
|
+
posix_spawnattr_t attrs;
|
|
773
|
+
posix_spawn_file_actions_t actions;
|
|
774
|
+
|
|
775
|
+
err = uv__spawn_set_posix_spawn_attrs(&attrs, posix_spawn_fncs, options);
|
|
776
|
+
if (err != 0)
|
|
777
|
+
goto error;
|
|
778
|
+
|
|
779
|
+
/* This may mutate pipes. */
|
|
780
|
+
err = uv__spawn_set_posix_spawn_file_actions(&actions,
|
|
781
|
+
posix_spawn_fncs,
|
|
782
|
+
options,
|
|
783
|
+
stdio_count,
|
|
784
|
+
pipes);
|
|
785
|
+
if (err != 0) {
|
|
786
|
+
(void) posix_spawnattr_destroy(&attrs);
|
|
787
|
+
goto error;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
/* Try to spawn options->file resolving in the provided environment
|
|
791
|
+
* if any */
|
|
792
|
+
err = uv__spawn_resolve_and_spawn(options, &attrs, &actions, pid);
|
|
793
|
+
assert(err != ENOSYS);
|
|
794
|
+
|
|
795
|
+
/* Destroy the actions/attributes */
|
|
796
|
+
(void) posix_spawn_file_actions_destroy(&actions);
|
|
797
|
+
(void) posix_spawnattr_destroy(&attrs);
|
|
798
|
+
|
|
799
|
+
error:
|
|
800
|
+
/* In an error situation, the attributes and file actions are
|
|
801
|
+
* already destroyed, only the happy path requires cleanup */
|
|
802
|
+
return UV__ERR(err);
|
|
382
803
|
}
|
|
383
804
|
#endif
|
|
384
805
|
|
|
806
|
+
static int uv__spawn_and_init_child_fork(const uv_process_options_t* options,
|
|
807
|
+
int stdio_count,
|
|
808
|
+
int (*pipes)[2],
|
|
809
|
+
int error_fd,
|
|
810
|
+
pid_t* pid) {
|
|
811
|
+
sigset_t signewset;
|
|
812
|
+
sigset_t sigoldset;
|
|
813
|
+
|
|
814
|
+
/* Start the child with most signals blocked, to avoid any issues before we
|
|
815
|
+
* can reset them, but allow program failures to exit (and not hang). */
|
|
816
|
+
sigfillset(&signewset);
|
|
817
|
+
sigdelset(&signewset, SIGKILL);
|
|
818
|
+
sigdelset(&signewset, SIGSTOP);
|
|
819
|
+
sigdelset(&signewset, SIGTRAP);
|
|
820
|
+
sigdelset(&signewset, SIGSEGV);
|
|
821
|
+
sigdelset(&signewset, SIGBUS);
|
|
822
|
+
sigdelset(&signewset, SIGILL);
|
|
823
|
+
sigdelset(&signewset, SIGSYS);
|
|
824
|
+
sigdelset(&signewset, SIGABRT);
|
|
825
|
+
if (pthread_sigmask(SIG_BLOCK, &signewset, &sigoldset) != 0)
|
|
826
|
+
abort();
|
|
827
|
+
|
|
828
|
+
*pid = fork();
|
|
829
|
+
|
|
830
|
+
if (*pid == 0) {
|
|
831
|
+
/* Fork succeeded, in the child process */
|
|
832
|
+
uv__process_child_init(options, stdio_count, pipes, error_fd);
|
|
833
|
+
abort();
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
if (pthread_sigmask(SIG_SETMASK, &sigoldset, NULL) != 0)
|
|
837
|
+
abort();
|
|
838
|
+
|
|
839
|
+
if (*pid == -1)
|
|
840
|
+
/* Failed to fork */
|
|
841
|
+
return UV__ERR(errno);
|
|
842
|
+
|
|
843
|
+
/* Fork succeeded, in the parent process */
|
|
844
|
+
return 0;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
static int uv__spawn_and_init_child(
|
|
848
|
+
uv_loop_t* loop,
|
|
849
|
+
const uv_process_options_t* options,
|
|
850
|
+
int stdio_count,
|
|
851
|
+
int (*pipes)[2],
|
|
852
|
+
pid_t* pid) {
|
|
853
|
+
int signal_pipe[2] = { -1, -1 };
|
|
854
|
+
int status;
|
|
855
|
+
int err;
|
|
856
|
+
int exec_errorno;
|
|
857
|
+
ssize_t r;
|
|
858
|
+
|
|
859
|
+
#if defined(__APPLE__)
|
|
860
|
+
uv_once(&posix_spawn_init_once, uv__spawn_init_posix_spawn);
|
|
861
|
+
|
|
862
|
+
/* Special child process spawn case for macOS Big Sur (11.0) onwards
|
|
863
|
+
*
|
|
864
|
+
* Big Sur introduced a significant performance degradation on a call to
|
|
865
|
+
* fork/exec when the process has many pages mmaped in with MAP_JIT, like, say
|
|
866
|
+
* a javascript interpreter. Electron-based applications, for example,
|
|
867
|
+
* are impacted; though the magnitude of the impact depends on how much the
|
|
868
|
+
* app relies on subprocesses.
|
|
869
|
+
*
|
|
870
|
+
* On macOS, though, posix_spawn is implemented in a way that does not
|
|
871
|
+
* exhibit the problem. This block implements the forking and preparation
|
|
872
|
+
* logic with posix_spawn and its related primitives. It also takes advantage of
|
|
873
|
+
* the macOS extension POSIX_SPAWN_CLOEXEC_DEFAULT that makes impossible to
|
|
874
|
+
* leak descriptors to the child process. */
|
|
875
|
+
err = uv__spawn_and_init_child_posix_spawn(options,
|
|
876
|
+
stdio_count,
|
|
877
|
+
pipes,
|
|
878
|
+
pid,
|
|
879
|
+
&posix_spawn_fncs);
|
|
880
|
+
|
|
881
|
+
/* The posix_spawn flow will return UV_ENOSYS if any of the posix_spawn_x_np
|
|
882
|
+
* non-standard functions is both _needed_ and _undefined_. In those cases,
|
|
883
|
+
* default back to the fork/execve strategy. For all other errors, just fail. */
|
|
884
|
+
if (err != UV_ENOSYS)
|
|
885
|
+
return err;
|
|
886
|
+
|
|
887
|
+
#endif
|
|
888
|
+
|
|
889
|
+
/* This pipe is used by the parent to wait until
|
|
890
|
+
* the child has called `execve()`. We need this
|
|
891
|
+
* to avoid the following race condition:
|
|
892
|
+
*
|
|
893
|
+
* if ((pid = fork()) > 0) {
|
|
894
|
+
* kill(pid, SIGTERM);
|
|
895
|
+
* }
|
|
896
|
+
* else if (pid == 0) {
|
|
897
|
+
* execve("/bin/cat", argp, envp);
|
|
898
|
+
* }
|
|
899
|
+
*
|
|
900
|
+
* The parent sends a signal immediately after forking.
|
|
901
|
+
* Since the child may not have called `execve()` yet,
|
|
902
|
+
* there is no telling what process receives the signal,
|
|
903
|
+
* our fork or /bin/cat.
|
|
904
|
+
*
|
|
905
|
+
* To avoid ambiguity, we create a pipe with both ends
|
|
906
|
+
* marked close-on-exec. Then, after the call to `fork()`,
|
|
907
|
+
* the parent polls the read end until it EOFs or errors with EPIPE.
|
|
908
|
+
*/
|
|
909
|
+
err = uv__make_pipe(signal_pipe, 0);
|
|
910
|
+
if (err)
|
|
911
|
+
return err;
|
|
912
|
+
|
|
913
|
+
/* Acquire write lock to prevent opening new fds in worker threads */
|
|
914
|
+
uv_rwlock_wrlock(&loop->cloexec_lock);
|
|
915
|
+
|
|
916
|
+
err = uv__spawn_and_init_child_fork(options, stdio_count, pipes, signal_pipe[1], pid);
|
|
917
|
+
|
|
918
|
+
/* Release lock in parent process */
|
|
919
|
+
uv_rwlock_wrunlock(&loop->cloexec_lock);
|
|
920
|
+
|
|
921
|
+
uv__close(signal_pipe[1]);
|
|
922
|
+
|
|
923
|
+
if (err == 0) {
|
|
924
|
+
do
|
|
925
|
+
r = read(signal_pipe[0], &exec_errorno, sizeof(exec_errorno));
|
|
926
|
+
while (r == -1 && errno == EINTR);
|
|
927
|
+
|
|
928
|
+
if (r == 0)
|
|
929
|
+
; /* okay, EOF */
|
|
930
|
+
else if (r == sizeof(exec_errorno)) {
|
|
931
|
+
do
|
|
932
|
+
err = waitpid(*pid, &status, 0); /* okay, read errorno */
|
|
933
|
+
while (err == -1 && errno == EINTR);
|
|
934
|
+
assert(err == *pid);
|
|
935
|
+
err = exec_errorno;
|
|
936
|
+
} else if (r == -1 && errno == EPIPE) {
|
|
937
|
+
/* Something unknown happened to our child before spawn */
|
|
938
|
+
do
|
|
939
|
+
err = waitpid(*pid, &status, 0); /* okay, got EPIPE */
|
|
940
|
+
while (err == -1 && errno == EINTR);
|
|
941
|
+
assert(err == *pid);
|
|
942
|
+
err = UV_EPIPE;
|
|
943
|
+
} else
|
|
944
|
+
abort();
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
uv__close_nocheckstdio(signal_pipe[0]);
|
|
948
|
+
|
|
949
|
+
return err;
|
|
950
|
+
}
|
|
951
|
+
#endif /* ISN'T TARGET_OS_TV || TARGET_OS_WATCH */
|
|
385
952
|
|
|
386
953
|
int uv_spawn(uv_loop_t* loop,
|
|
387
954
|
uv_process_t* process,
|
|
388
955
|
const uv_process_options_t* options) {
|
|
389
956
|
#if defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH)
|
|
390
957
|
/* fork is marked __WATCHOS_PROHIBITED __TVOS_PROHIBITED. */
|
|
391
|
-
return
|
|
958
|
+
return UV_ENOSYS;
|
|
392
959
|
#else
|
|
393
|
-
int
|
|
960
|
+
int pipes_storage[8][2];
|
|
394
961
|
int (*pipes)[2];
|
|
395
962
|
int stdio_count;
|
|
396
|
-
ssize_t r;
|
|
397
963
|
pid_t pid;
|
|
398
964
|
int err;
|
|
399
965
|
int exec_errorno;
|
|
400
966
|
int i;
|
|
401
|
-
int status;
|
|
402
967
|
|
|
403
968
|
assert(options->file != NULL);
|
|
404
969
|
assert(!(options->flags & ~(UV_PROCESS_DETACHED |
|
|
405
970
|
UV_PROCESS_SETGID |
|
|
406
971
|
UV_PROCESS_SETUID |
|
|
972
|
+
UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME |
|
|
407
973
|
UV_PROCESS_WINDOWS_HIDE |
|
|
974
|
+
UV_PROCESS_WINDOWS_HIDE_CONSOLE |
|
|
975
|
+
UV_PROCESS_WINDOWS_HIDE_GUI |
|
|
408
976
|
UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS)));
|
|
409
977
|
|
|
410
978
|
uv__handle_init(loop, (uv_handle_t*)process, UV_PROCESS);
|
|
411
|
-
|
|
979
|
+
uv__queue_init(&process->queue);
|
|
980
|
+
process->status = 0;
|
|
412
981
|
|
|
413
982
|
stdio_count = options->stdio_count;
|
|
414
983
|
if (stdio_count < 3)
|
|
415
984
|
stdio_count = 3;
|
|
416
985
|
|
|
417
|
-
err =
|
|
418
|
-
pipes =
|
|
986
|
+
err = UV_ENOMEM;
|
|
987
|
+
pipes = pipes_storage;
|
|
988
|
+
if (stdio_count > (int) ARRAY_SIZE(pipes_storage))
|
|
989
|
+
pipes = uv__malloc(stdio_count * sizeof(*pipes));
|
|
990
|
+
|
|
419
991
|
if (pipes == NULL)
|
|
420
992
|
goto error;
|
|
421
993
|
|
|
@@ -430,78 +1002,49 @@ int uv_spawn(uv_loop_t* loop,
|
|
|
430
1002
|
goto error;
|
|
431
1003
|
}
|
|
432
1004
|
|
|
433
|
-
|
|
434
|
-
* the child has called `execve()`. We need this
|
|
435
|
-
* to avoid the following race condition:
|
|
436
|
-
*
|
|
437
|
-
* if ((pid = fork()) > 0) {
|
|
438
|
-
* kill(pid, SIGTERM);
|
|
439
|
-
* }
|
|
440
|
-
* else if (pid == 0) {
|
|
441
|
-
* execve("/bin/cat", argp, envp);
|
|
442
|
-
* }
|
|
443
|
-
*
|
|
444
|
-
* The parent sends a signal immediately after forking.
|
|
445
|
-
* Since the child may not have called `execve()` yet,
|
|
446
|
-
* there is no telling what process receives the signal,
|
|
447
|
-
* our fork or /bin/cat.
|
|
448
|
-
*
|
|
449
|
-
* To avoid ambiguity, we create a pipe with both ends
|
|
450
|
-
* marked close-on-exec. Then, after the call to `fork()`,
|
|
451
|
-
* the parent polls the read end until it EOFs or errors with EPIPE.
|
|
452
|
-
*/
|
|
453
|
-
err = uv__make_pipe(signal_pipe, 0);
|
|
454
|
-
if (err)
|
|
455
|
-
goto error;
|
|
456
|
-
|
|
1005
|
+
#ifdef UV_USE_SIGCHLD
|
|
457
1006
|
uv_signal_start(&loop->child_watcher, uv__chld, SIGCHLD);
|
|
1007
|
+
#endif
|
|
458
1008
|
|
|
459
|
-
/*
|
|
460
|
-
|
|
461
|
-
pid = fork();
|
|
462
|
-
|
|
463
|
-
if (pid == -1) {
|
|
464
|
-
err = -errno;
|
|
465
|
-
uv_rwlock_wrunlock(&loop->cloexec_lock);
|
|
466
|
-
uv__close(signal_pipe[0]);
|
|
467
|
-
uv__close(signal_pipe[1]);
|
|
468
|
-
goto error;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
if (pid == 0) {
|
|
472
|
-
uv__process_child_init(options, stdio_count, pipes, signal_pipe[1]);
|
|
473
|
-
abort();
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
/* Release lock in parent process */
|
|
477
|
-
uv_rwlock_wrunlock(&loop->cloexec_lock);
|
|
478
|
-
uv__close(signal_pipe[1]);
|
|
1009
|
+
/* Spawn the child */
|
|
1010
|
+
exec_errorno = uv__spawn_and_init_child(loop, options, stdio_count, pipes, &pid);
|
|
479
1011
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
1012
|
+
#if 0
|
|
1013
|
+
/* This runs into a nodejs issue (it expects initialized streams, even if the
|
|
1014
|
+
* exec failed).
|
|
1015
|
+
* See https://github.com/libuv/libuv/pull/3107#issuecomment-782482608 */
|
|
1016
|
+
if (exec_errorno != 0)
|
|
1017
|
+
goto error;
|
|
1018
|
+
#endif
|
|
485
1019
|
|
|
486
|
-
if (
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
1020
|
+
/* Activate this handle if exec() happened successfully, even if we later
|
|
1021
|
+
* fail to open a stdio handle. This ensures we can eventually reap the child
|
|
1022
|
+
* with waitpid. */
|
|
1023
|
+
if (exec_errorno == 0) {
|
|
1024
|
+
#ifndef UV_USE_SIGCHLD
|
|
1025
|
+
struct kevent event;
|
|
1026
|
+
EV_SET(&event, pid, EVFILT_PROC, EV_ADD | EV_ONESHOT, NOTE_EXIT, 0, 0);
|
|
1027
|
+
if (kevent(loop->backend_fd, &event, 1, NULL, 0, NULL)) {
|
|
1028
|
+
if (errno != ESRCH)
|
|
1029
|
+
abort();
|
|
1030
|
+
/* Process already exited. Call waitpid on the next loop iteration. */
|
|
1031
|
+
process->flags |= UV_HANDLE_REAP;
|
|
1032
|
+
loop->flags |= UV_LOOP_REAP_CHILDREN;
|
|
1033
|
+
}
|
|
1034
|
+
/* This prevents uv__io_poll() from bailing out prematurely, being unaware
|
|
1035
|
+
* that we added an event here for it to react to. We will decrement this
|
|
1036
|
+
* again after the waitpid call succeeds. */
|
|
1037
|
+
loop->nfds++;
|
|
1038
|
+
#endif
|
|
500
1039
|
|
|
501
|
-
|
|
1040
|
+
process->pid = pid;
|
|
1041
|
+
process->exit_cb = options->exit_cb;
|
|
1042
|
+
uv__queue_insert_tail(&loop->process_handles, &process->queue);
|
|
1043
|
+
uv__handle_start(process);
|
|
1044
|
+
}
|
|
502
1045
|
|
|
503
1046
|
for (i = 0; i < options->stdio_count; i++) {
|
|
504
|
-
err = uv__process_open_stream(options->stdio + i, pipes[i]
|
|
1047
|
+
err = uv__process_open_stream(options->stdio + i, pipes[i]);
|
|
505
1048
|
if (err == 0)
|
|
506
1049
|
continue;
|
|
507
1050
|
|
|
@@ -511,16 +1054,9 @@ int uv_spawn(uv_loop_t* loop,
|
|
|
511
1054
|
goto error;
|
|
512
1055
|
}
|
|
513
1056
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
QUEUE_INSERT_TAIL(&loop->process_handles, &process->queue);
|
|
517
|
-
uv__handle_start(process);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
process->pid = pid;
|
|
521
|
-
process->exit_cb = options->exit_cb;
|
|
1057
|
+
if (pipes != pipes_storage)
|
|
1058
|
+
uv__free(pipes);
|
|
522
1059
|
|
|
523
|
-
uv__free(pipes);
|
|
524
1060
|
return exec_errorno;
|
|
525
1061
|
|
|
526
1062
|
error:
|
|
@@ -530,11 +1066,13 @@ error:
|
|
|
530
1066
|
if (options->stdio[i].flags & (UV_INHERIT_FD | UV_INHERIT_STREAM))
|
|
531
1067
|
continue;
|
|
532
1068
|
if (pipes[i][0] != -1)
|
|
533
|
-
|
|
1069
|
+
uv__close_nocheckstdio(pipes[i][0]);
|
|
534
1070
|
if (pipes[i][1] != -1)
|
|
535
|
-
|
|
1071
|
+
uv__close_nocheckstdio(pipes[i][1]);
|
|
536
1072
|
}
|
|
537
|
-
|
|
1073
|
+
|
|
1074
|
+
if (pipes != pipes_storage)
|
|
1075
|
+
uv__free(pipes);
|
|
538
1076
|
}
|
|
539
1077
|
|
|
540
1078
|
return err;
|
|
@@ -548,16 +1086,25 @@ int uv_process_kill(uv_process_t* process, int signum) {
|
|
|
548
1086
|
|
|
549
1087
|
|
|
550
1088
|
int uv_kill(int pid, int signum) {
|
|
551
|
-
if (kill(pid, signum))
|
|
552
|
-
|
|
553
|
-
|
|
1089
|
+
if (kill(pid, signum)) {
|
|
1090
|
+
#if defined(__MVS__)
|
|
1091
|
+
/* EPERM is returned if the process is a zombie. */
|
|
1092
|
+
siginfo_t infop;
|
|
1093
|
+
if (errno == EPERM &&
|
|
1094
|
+
waitid(P_PID, pid, &infop, WNOHANG | WNOWAIT | WEXITED) == 0)
|
|
1095
|
+
return 0;
|
|
1096
|
+
#endif
|
|
1097
|
+
return UV__ERR(errno);
|
|
1098
|
+
} else
|
|
554
1099
|
return 0;
|
|
555
1100
|
}
|
|
556
1101
|
|
|
557
1102
|
|
|
558
1103
|
void uv__process_close(uv_process_t* handle) {
|
|
559
|
-
|
|
1104
|
+
uv__queue_remove(&handle->queue);
|
|
560
1105
|
uv__handle_stop(handle);
|
|
561
|
-
|
|
1106
|
+
#ifdef UV_USE_SIGCHLD
|
|
1107
|
+
if (uv__queue_empty(&handle->loop->process_handles))
|
|
562
1108
|
uv_signal_stop(&handle->loop->child_watcher);
|
|
1109
|
+
#endif
|
|
563
1110
|
}
|