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
|
@@ -60,12 +60,23 @@ struct uv__stream_select_s {
|
|
|
60
60
|
};
|
|
61
61
|
#endif /* defined(__APPLE__) */
|
|
62
62
|
|
|
63
|
+
union uv__cmsg {
|
|
64
|
+
struct cmsghdr hdr;
|
|
65
|
+
/* This cannot be larger because of the IBMi PASE limitation that
|
|
66
|
+
* the total size of control messages cannot exceed 256 bytes.
|
|
67
|
+
*/
|
|
68
|
+
char pad[256];
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
STATIC_ASSERT(256 == sizeof(union uv__cmsg));
|
|
72
|
+
|
|
63
73
|
static void uv__stream_connect(uv_stream_t*);
|
|
64
74
|
static void uv__write(uv_stream_t* stream);
|
|
65
75
|
static void uv__read(uv_stream_t* stream);
|
|
66
76
|
static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events);
|
|
67
77
|
static void uv__write_callbacks(uv_stream_t* stream);
|
|
68
78
|
static size_t uv__write_req_size(uv_write_t* req);
|
|
79
|
+
static void uv__drain(uv_stream_t* stream);
|
|
69
80
|
|
|
70
81
|
|
|
71
82
|
void uv__stream_init(uv_loop_t* loop,
|
|
@@ -83,8 +94,8 @@ void uv__stream_init(uv_loop_t* loop,
|
|
|
83
94
|
stream->accepted_fd = -1;
|
|
84
95
|
stream->queued_fds = NULL;
|
|
85
96
|
stream->delayed_error = 0;
|
|
86
|
-
|
|
87
|
-
|
|
97
|
+
uv__queue_init(&stream->write_queue);
|
|
98
|
+
uv__queue_init(&stream->write_completed_queue);
|
|
88
99
|
stream->write_queue_size = 0;
|
|
89
100
|
|
|
90
101
|
if (loop->emfile_fd == -1) {
|
|
@@ -150,7 +161,7 @@ static void uv__stream_osx_select(void* arg) {
|
|
|
150
161
|
else
|
|
151
162
|
max_fd = s->int_fd;
|
|
152
163
|
|
|
153
|
-
|
|
164
|
+
for (;;) {
|
|
154
165
|
/* Terminate on semaphore */
|
|
155
166
|
if (uv_sem_trywait(&s->close_sem) == 0)
|
|
156
167
|
break;
|
|
@@ -159,9 +170,9 @@ static void uv__stream_osx_select(void* arg) {
|
|
|
159
170
|
memset(s->sread, 0, s->sread_sz);
|
|
160
171
|
memset(s->swrite, 0, s->swrite_sz);
|
|
161
172
|
|
|
162
|
-
if (uv__io_active(&stream->io_watcher,
|
|
173
|
+
if (uv__io_active(&stream->io_watcher, POLLIN))
|
|
163
174
|
FD_SET(fd, s->sread);
|
|
164
|
-
if (uv__io_active(&stream->io_watcher,
|
|
175
|
+
if (uv__io_active(&stream->io_watcher, POLLOUT))
|
|
165
176
|
FD_SET(fd, s->swrite);
|
|
166
177
|
FD_SET(s->int_fd, s->sread);
|
|
167
178
|
|
|
@@ -181,7 +192,7 @@ static void uv__stream_osx_select(void* arg) {
|
|
|
181
192
|
|
|
182
193
|
/* Empty socketpair's buffer in case of interruption */
|
|
183
194
|
if (FD_ISSET(s->int_fd, s->sread))
|
|
184
|
-
|
|
195
|
+
for (;;) {
|
|
185
196
|
r = read(s->int_fd, buf, sizeof(buf));
|
|
186
197
|
|
|
187
198
|
if (r == sizeof(buf))
|
|
@@ -202,9 +213,9 @@ static void uv__stream_osx_select(void* arg) {
|
|
|
202
213
|
/* Handle events */
|
|
203
214
|
events = 0;
|
|
204
215
|
if (FD_ISSET(fd, s->sread))
|
|
205
|
-
events |=
|
|
216
|
+
events |= POLLIN;
|
|
206
217
|
if (FD_ISSET(fd, s->swrite))
|
|
207
|
-
events |=
|
|
218
|
+
events |= POLLOUT;
|
|
208
219
|
|
|
209
220
|
assert(events != 0 || FD_ISSET(s->int_fd, s->sread));
|
|
210
221
|
if (events != 0) {
|
|
@@ -214,7 +225,7 @@ static void uv__stream_osx_select(void* arg) {
|
|
|
214
225
|
uv_sem_wait(&s->async_sem);
|
|
215
226
|
|
|
216
227
|
/* Should be processed at this stage */
|
|
217
|
-
assert((s->events == 0) || (stream->flags &
|
|
228
|
+
assert((s->events == 0) || (stream->flags & UV_HANDLE_CLOSING));
|
|
218
229
|
}
|
|
219
230
|
}
|
|
220
231
|
}
|
|
@@ -233,16 +244,16 @@ static void uv__stream_osx_select_cb(uv_async_t* handle) {
|
|
|
233
244
|
ACCESS_ONCE(int, s->events) = 0;
|
|
234
245
|
|
|
235
246
|
assert(events != 0);
|
|
236
|
-
assert(events == (events & (
|
|
247
|
+
assert(events == (events & (POLLIN | POLLOUT)));
|
|
237
248
|
|
|
238
249
|
/* Invoke callback on event-loop */
|
|
239
|
-
if ((events &
|
|
240
|
-
uv__stream_io(stream->loop, &stream->io_watcher,
|
|
250
|
+
if ((events & POLLIN) && uv__io_active(&stream->io_watcher, POLLIN))
|
|
251
|
+
uv__stream_io(stream->loop, &stream->io_watcher, POLLIN);
|
|
241
252
|
|
|
242
|
-
if ((events &
|
|
243
|
-
uv__stream_io(stream->loop, &stream->io_watcher,
|
|
253
|
+
if ((events & POLLOUT) && uv__io_active(&stream->io_watcher, POLLOUT))
|
|
254
|
+
uv__stream_io(stream->loop, &stream->io_watcher, POLLOUT);
|
|
244
255
|
|
|
245
|
-
if (stream->flags &
|
|
256
|
+
if (stream->flags & UV_HANDLE_CLOSING)
|
|
246
257
|
return;
|
|
247
258
|
|
|
248
259
|
/* NOTE: It is important to do it here, otherwise `select()` might be called
|
|
@@ -282,7 +293,7 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) {
|
|
|
282
293
|
kq = kqueue();
|
|
283
294
|
if (kq == -1) {
|
|
284
295
|
perror("(libuv) kqueue()");
|
|
285
|
-
return
|
|
296
|
+
return UV__ERR(errno);
|
|
286
297
|
}
|
|
287
298
|
|
|
288
299
|
EV_SET(&filter[0], *fd, EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, 0);
|
|
@@ -291,11 +302,14 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) {
|
|
|
291
302
|
timeout.tv_sec = 0;
|
|
292
303
|
timeout.tv_nsec = 1;
|
|
293
304
|
|
|
294
|
-
|
|
305
|
+
do
|
|
306
|
+
ret = kevent(kq, filter, 1, events, 1, &timeout);
|
|
307
|
+
while (ret == -1 && errno == EINTR);
|
|
308
|
+
|
|
295
309
|
uv__close(kq);
|
|
296
310
|
|
|
297
311
|
if (ret == -1)
|
|
298
|
-
return
|
|
312
|
+
return UV__ERR(errno);
|
|
299
313
|
|
|
300
314
|
if (ret == 0 || (events[0].flags & EV_ERROR) == 0 || events[0].data != EINVAL)
|
|
301
315
|
return 0;
|
|
@@ -307,7 +321,7 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) {
|
|
|
307
321
|
* NOTE: do it ahead of malloc below to allocate enough space for fd_sets
|
|
308
322
|
*/
|
|
309
323
|
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds))
|
|
310
|
-
return
|
|
324
|
+
return UV__ERR(errno);
|
|
311
325
|
|
|
312
326
|
max_fd = *fd;
|
|
313
327
|
if (fds[1] > max_fd)
|
|
@@ -318,7 +332,7 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) {
|
|
|
318
332
|
|
|
319
333
|
s = uv__malloc(sizeof(*s) + sread_sz + swrite_sz);
|
|
320
334
|
if (s == NULL) {
|
|
321
|
-
err =
|
|
335
|
+
err = UV_ENOMEM;
|
|
322
336
|
goto failed_malloc;
|
|
323
337
|
}
|
|
324
338
|
|
|
@@ -333,7 +347,7 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) {
|
|
|
333
347
|
if (err)
|
|
334
348
|
goto failed_async_init;
|
|
335
349
|
|
|
336
|
-
s->async.flags |=
|
|
350
|
+
s->async.flags |= UV_HANDLE_INTERNAL;
|
|
337
351
|
uv__handle_unref(&s->async);
|
|
338
352
|
|
|
339
353
|
err = uv_sem_init(&s->close_sem, 0);
|
|
@@ -392,18 +406,20 @@ int uv__stream_open(uv_stream_t* stream, int fd, int flags) {
|
|
|
392
406
|
#endif
|
|
393
407
|
|
|
394
408
|
if (!(stream->io_watcher.fd == -1 || stream->io_watcher.fd == fd))
|
|
395
|
-
return
|
|
409
|
+
return UV_EBUSY;
|
|
396
410
|
|
|
397
411
|
assert(fd >= 0);
|
|
398
412
|
stream->flags |= flags;
|
|
399
413
|
|
|
400
414
|
if (stream->type == UV_TCP) {
|
|
401
|
-
if ((stream->flags &
|
|
402
|
-
return
|
|
415
|
+
if ((stream->flags & UV_HANDLE_TCP_NODELAY) && uv__tcp_nodelay(fd, 1))
|
|
416
|
+
return UV__ERR(errno);
|
|
403
417
|
|
|
404
418
|
/* TODO Use delay the user passed in. */
|
|
405
|
-
if ((stream->flags &
|
|
406
|
-
|
|
419
|
+
if ((stream->flags & UV_HANDLE_TCP_KEEPALIVE) &&
|
|
420
|
+
uv__tcp_keepalive(fd, 1, 60)) {
|
|
421
|
+
return UV__ERR(errno);
|
|
422
|
+
}
|
|
407
423
|
}
|
|
408
424
|
|
|
409
425
|
#if defined(__APPLE__)
|
|
@@ -411,7 +427,7 @@ int uv__stream_open(uv_stream_t* stream, int fd, int flags) {
|
|
|
411
427
|
if (setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &enable, sizeof(enable)) &&
|
|
412
428
|
errno != ENOTSOCK &&
|
|
413
429
|
errno != EINVAL) {
|
|
414
|
-
return
|
|
430
|
+
return UV__ERR(errno);
|
|
415
431
|
}
|
|
416
432
|
#endif
|
|
417
433
|
|
|
@@ -423,42 +439,32 @@ int uv__stream_open(uv_stream_t* stream, int fd, int flags) {
|
|
|
423
439
|
|
|
424
440
|
void uv__stream_flush_write_queue(uv_stream_t* stream, int error) {
|
|
425
441
|
uv_write_t* req;
|
|
426
|
-
|
|
427
|
-
while (!
|
|
428
|
-
q =
|
|
429
|
-
|
|
442
|
+
struct uv__queue* q;
|
|
443
|
+
while (!uv__queue_empty(&stream->write_queue)) {
|
|
444
|
+
q = uv__queue_head(&stream->write_queue);
|
|
445
|
+
uv__queue_remove(q);
|
|
430
446
|
|
|
431
|
-
req =
|
|
447
|
+
req = uv__queue_data(q, uv_write_t, queue);
|
|
432
448
|
req->error = error;
|
|
433
449
|
|
|
434
|
-
|
|
450
|
+
uv__queue_insert_tail(&stream->write_completed_queue, &req->queue);
|
|
435
451
|
}
|
|
436
452
|
}
|
|
437
453
|
|
|
438
454
|
|
|
439
455
|
void uv__stream_destroy(uv_stream_t* stream) {
|
|
440
|
-
assert(!uv__io_active(&stream->io_watcher,
|
|
441
|
-
assert(stream->flags &
|
|
456
|
+
assert(!uv__io_active(&stream->io_watcher, POLLIN | POLLOUT));
|
|
457
|
+
assert(stream->flags & UV_HANDLE_CLOSED);
|
|
442
458
|
|
|
443
459
|
if (stream->connect_req) {
|
|
444
|
-
uv__req_unregister(stream->loop
|
|
445
|
-
stream->connect_req->cb(stream->connect_req,
|
|
460
|
+
uv__req_unregister(stream->loop);
|
|
461
|
+
stream->connect_req->cb(stream->connect_req, UV_ECANCELED);
|
|
446
462
|
stream->connect_req = NULL;
|
|
447
463
|
}
|
|
448
464
|
|
|
449
|
-
uv__stream_flush_write_queue(stream,
|
|
465
|
+
uv__stream_flush_write_queue(stream, UV_ECANCELED);
|
|
450
466
|
uv__write_callbacks(stream);
|
|
451
|
-
|
|
452
|
-
if (stream->shutdown_req) {
|
|
453
|
-
/* The ECANCELED error code is a lie, the shutdown(2) syscall is a
|
|
454
|
-
* fait accompli at this point. Maybe we should revisit this in v0.11.
|
|
455
|
-
* A possible reason for leaving it unchanged is that it informs the
|
|
456
|
-
* callee that the handle has been destroyed.
|
|
457
|
-
*/
|
|
458
|
-
uv__req_unregister(stream->loop, stream->shutdown_req);
|
|
459
|
-
stream->shutdown_req->cb(stream->shutdown_req, -ECANCELED);
|
|
460
|
-
stream->shutdown_req = NULL;
|
|
461
|
-
}
|
|
467
|
+
uv__drain(stream);
|
|
462
468
|
|
|
463
469
|
assert(stream->write_queue_size == 0);
|
|
464
470
|
}
|
|
@@ -480,7 +486,7 @@ static int uv__emfile_trick(uv_loop_t* loop, int accept_fd) {
|
|
|
480
486
|
int emfile_fd;
|
|
481
487
|
|
|
482
488
|
if (loop->emfile_fd == -1)
|
|
483
|
-
return
|
|
489
|
+
return UV_EMFILE;
|
|
484
490
|
|
|
485
491
|
uv__close(loop->emfile_fd);
|
|
486
492
|
loop->emfile_fd = -1;
|
|
@@ -489,7 +495,7 @@ static int uv__emfile_trick(uv_loop_t* loop, int accept_fd) {
|
|
|
489
495
|
err = uv__accept(accept_fd);
|
|
490
496
|
if (err >= 0)
|
|
491
497
|
uv__close(err);
|
|
492
|
-
} while (err >= 0 || err ==
|
|
498
|
+
} while (err >= 0 || err == UV_EINTR);
|
|
493
499
|
|
|
494
500
|
emfile_fd = uv__open_cloexec("/", O_RDONLY);
|
|
495
501
|
if (emfile_fd >= 0)
|
|
@@ -499,90 +505,48 @@ static int uv__emfile_trick(uv_loop_t* loop, int accept_fd) {
|
|
|
499
505
|
}
|
|
500
506
|
|
|
501
507
|
|
|
502
|
-
#if defined(UV_HAVE_KQUEUE)
|
|
503
|
-
# define UV_DEC_BACKLOG(w) w->rcount--;
|
|
504
|
-
#else
|
|
505
|
-
# define UV_DEC_BACKLOG(w) /* no-op */
|
|
506
|
-
#endif /* defined(UV_HAVE_KQUEUE) */
|
|
507
|
-
|
|
508
|
-
|
|
509
508
|
void uv__server_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
|
510
509
|
uv_stream_t* stream;
|
|
511
510
|
int err;
|
|
511
|
+
int fd;
|
|
512
512
|
|
|
513
513
|
stream = container_of(w, uv_stream_t, io_watcher);
|
|
514
|
-
assert(events
|
|
514
|
+
assert(events & POLLIN);
|
|
515
515
|
assert(stream->accepted_fd == -1);
|
|
516
|
-
assert(!(stream->flags &
|
|
517
|
-
|
|
518
|
-
uv__io_start(stream->loop, &stream->io_watcher, UV__POLLIN);
|
|
519
|
-
|
|
520
|
-
/* connection_cb can close the server socket while we're
|
|
521
|
-
* in the loop so check it on each iteration.
|
|
522
|
-
*/
|
|
523
|
-
while (uv__stream_fd(stream) != -1) {
|
|
524
|
-
assert(stream->accepted_fd == -1);
|
|
525
|
-
|
|
526
|
-
#if defined(UV_HAVE_KQUEUE)
|
|
527
|
-
if (w->rcount <= 0)
|
|
528
|
-
return;
|
|
529
|
-
#endif /* defined(UV_HAVE_KQUEUE) */
|
|
516
|
+
assert(!(stream->flags & UV_HANDLE_CLOSING));
|
|
530
517
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
if (err == -EAGAIN || err == -EWOULDBLOCK)
|
|
534
|
-
return; /* Not an error. */
|
|
518
|
+
fd = uv__stream_fd(stream);
|
|
519
|
+
err = uv__accept(fd);
|
|
535
520
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
if (err == -EMFILE || err == -ENFILE) {
|
|
540
|
-
err = uv__emfile_trick(loop, uv__stream_fd(stream));
|
|
541
|
-
if (err == -EAGAIN || err == -EWOULDBLOCK)
|
|
542
|
-
break;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
stream->connection_cb(stream, err);
|
|
546
|
-
continue;
|
|
547
|
-
}
|
|
521
|
+
if (err == UV_EMFILE || err == UV_ENFILE)
|
|
522
|
+
err = uv__emfile_trick(loop, fd); /* Shed load. */
|
|
548
523
|
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
stream->connection_cb(stream, 0);
|
|
524
|
+
if (err < 0)
|
|
525
|
+
return;
|
|
552
526
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
uv__io_stop(loop, &stream->io_watcher, UV__POLLIN);
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
527
|
+
stream->accepted_fd = err;
|
|
528
|
+
stream->connection_cb(stream, 0);
|
|
558
529
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
nanosleep(&timeout, NULL);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
530
|
+
if (stream->accepted_fd != -1)
|
|
531
|
+
/* The user hasn't yet accepted called uv_accept() */
|
|
532
|
+
uv__io_stop(loop, &stream->io_watcher, POLLIN);
|
|
565
533
|
}
|
|
566
534
|
|
|
567
535
|
|
|
568
|
-
#undef UV_DEC_BACKLOG
|
|
569
|
-
|
|
570
|
-
|
|
571
536
|
int uv_accept(uv_stream_t* server, uv_stream_t* client) {
|
|
572
537
|
int err;
|
|
573
538
|
|
|
574
|
-
/* TODO document this */
|
|
575
539
|
assert(server->loop == client->loop);
|
|
576
540
|
|
|
577
541
|
if (server->accepted_fd == -1)
|
|
578
|
-
return
|
|
542
|
+
return UV_EAGAIN;
|
|
579
543
|
|
|
580
544
|
switch (client->type) {
|
|
581
545
|
case UV_NAMED_PIPE:
|
|
582
546
|
case UV_TCP:
|
|
583
547
|
err = uv__stream_open(client,
|
|
584
548
|
server->accepted_fd,
|
|
585
|
-
|
|
549
|
+
UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
|
|
586
550
|
if (err) {
|
|
587
551
|
/* TODO handle error */
|
|
588
552
|
uv__close(server->accepted_fd);
|
|
@@ -599,9 +563,11 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client) {
|
|
|
599
563
|
break;
|
|
600
564
|
|
|
601
565
|
default:
|
|
602
|
-
return
|
|
566
|
+
return UV_EINVAL;
|
|
603
567
|
}
|
|
604
568
|
|
|
569
|
+
client->flags |= UV_HANDLE_BOUND;
|
|
570
|
+
|
|
605
571
|
done:
|
|
606
572
|
/* Process queued fds */
|
|
607
573
|
if (server->queued_fds != NULL) {
|
|
@@ -626,7 +592,7 @@ done:
|
|
|
626
592
|
} else {
|
|
627
593
|
server->accepted_fd = -1;
|
|
628
594
|
if (err == 0)
|
|
629
|
-
uv__io_start(server->loop, &server->io_watcher,
|
|
595
|
+
uv__io_start(server->loop, &server->io_watcher, POLLIN);
|
|
630
596
|
}
|
|
631
597
|
return err;
|
|
632
598
|
}
|
|
@@ -634,18 +600,20 @@ done:
|
|
|
634
600
|
|
|
635
601
|
int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb) {
|
|
636
602
|
int err;
|
|
637
|
-
|
|
603
|
+
if (uv__is_closing(stream)) {
|
|
604
|
+
return UV_EINVAL;
|
|
605
|
+
}
|
|
638
606
|
switch (stream->type) {
|
|
639
607
|
case UV_TCP:
|
|
640
|
-
err =
|
|
608
|
+
err = uv__tcp_listen((uv_tcp_t*)stream, backlog, cb);
|
|
641
609
|
break;
|
|
642
610
|
|
|
643
611
|
case UV_NAMED_PIPE:
|
|
644
|
-
err =
|
|
612
|
+
err = uv__pipe_listen((uv_pipe_t*)stream, backlog, cb);
|
|
645
613
|
break;
|
|
646
614
|
|
|
647
615
|
default:
|
|
648
|
-
err =
|
|
616
|
+
err = UV_EINVAL;
|
|
649
617
|
}
|
|
650
618
|
|
|
651
619
|
if (err == 0)
|
|
@@ -659,27 +627,31 @@ static void uv__drain(uv_stream_t* stream) {
|
|
|
659
627
|
uv_shutdown_t* req;
|
|
660
628
|
int err;
|
|
661
629
|
|
|
662
|
-
assert(
|
|
663
|
-
|
|
664
|
-
|
|
630
|
+
assert(uv__queue_empty(&stream->write_queue));
|
|
631
|
+
if (!(stream->flags & UV_HANDLE_CLOSING)) {
|
|
632
|
+
uv__io_stop(stream->loop, &stream->io_watcher, POLLOUT);
|
|
633
|
+
uv__stream_osx_interrupt_select(stream);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
if (!uv__is_stream_shutting(stream))
|
|
637
|
+
return;
|
|
665
638
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
!(stream->flags & UV_CLOSING) &&
|
|
669
|
-
!(stream->flags & UV_STREAM_SHUT)) {
|
|
670
|
-
assert(stream->shutdown_req);
|
|
639
|
+
req = stream->shutdown_req;
|
|
640
|
+
assert(req);
|
|
671
641
|
|
|
672
|
-
|
|
642
|
+
if ((stream->flags & UV_HANDLE_CLOSING) ||
|
|
643
|
+
!(stream->flags & UV_HANDLE_SHUT)) {
|
|
673
644
|
stream->shutdown_req = NULL;
|
|
674
|
-
stream->
|
|
675
|
-
uv__req_unregister(stream->loop, req);
|
|
645
|
+
uv__req_unregister(stream->loop);
|
|
676
646
|
|
|
677
647
|
err = 0;
|
|
678
|
-
if (
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
if (
|
|
682
|
-
|
|
648
|
+
if (stream->flags & UV_HANDLE_CLOSING)
|
|
649
|
+
/* The user destroyed the stream before we got to do the shutdown. */
|
|
650
|
+
err = UV_ECANCELED;
|
|
651
|
+
else if (shutdown(uv__stream_fd(stream), SHUT_WR))
|
|
652
|
+
err = UV__ERR(errno);
|
|
653
|
+
else /* Success. */
|
|
654
|
+
stream->flags |= UV_HANDLE_SHUT;
|
|
683
655
|
|
|
684
656
|
if (req->cb != NULL)
|
|
685
657
|
req->cb(req, err);
|
|
@@ -687,6 +659,14 @@ static void uv__drain(uv_stream_t* stream) {
|
|
|
687
659
|
}
|
|
688
660
|
|
|
689
661
|
|
|
662
|
+
static ssize_t uv__writev(int fd, struct iovec* vec, size_t n) {
|
|
663
|
+
if (n == 1)
|
|
664
|
+
return write(fd, vec->iov_base, vec->iov_len);
|
|
665
|
+
else
|
|
666
|
+
return writev(fd, vec, n);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
|
|
690
670
|
static size_t uv__write_req_size(uv_write_t* req) {
|
|
691
671
|
size_t size;
|
|
692
672
|
|
|
@@ -699,11 +679,43 @@ static size_t uv__write_req_size(uv_write_t* req) {
|
|
|
699
679
|
}
|
|
700
680
|
|
|
701
681
|
|
|
682
|
+
/* Returns 1 if all write request data has been written, or 0 if there is still
|
|
683
|
+
* more data to write.
|
|
684
|
+
*
|
|
685
|
+
* Note: the return value only says something about the *current* request.
|
|
686
|
+
* There may still be other write requests sitting in the queue.
|
|
687
|
+
*/
|
|
688
|
+
static int uv__write_req_update(uv_stream_t* stream,
|
|
689
|
+
uv_write_t* req,
|
|
690
|
+
size_t n) {
|
|
691
|
+
uv_buf_t* buf;
|
|
692
|
+
size_t len;
|
|
693
|
+
|
|
694
|
+
assert(n <= stream->write_queue_size);
|
|
695
|
+
stream->write_queue_size -= n;
|
|
696
|
+
|
|
697
|
+
buf = req->bufs + req->write_index;
|
|
698
|
+
|
|
699
|
+
do {
|
|
700
|
+
len = n < buf->len ? n : buf->len;
|
|
701
|
+
if (buf->len != 0)
|
|
702
|
+
buf->base += len;
|
|
703
|
+
buf->len -= len;
|
|
704
|
+
buf += (buf->len == 0); /* Advance to next buffer if this one is empty. */
|
|
705
|
+
n -= len;
|
|
706
|
+
} while (n > 0);
|
|
707
|
+
|
|
708
|
+
req->write_index = buf - req->bufs;
|
|
709
|
+
|
|
710
|
+
return req->write_index == req->nbufs;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
|
|
702
714
|
static void uv__write_req_finish(uv_write_t* req) {
|
|
703
715
|
uv_stream_t* stream = req->handle;
|
|
704
716
|
|
|
705
717
|
/* Pop the req off tcp->write_queue. */
|
|
706
|
-
|
|
718
|
+
uv__queue_remove(&req->queue);
|
|
707
719
|
|
|
708
720
|
/* Only free when there was no error. On error, we touch up write_queue_size
|
|
709
721
|
* right before making the callback. The reason we don't do that right away
|
|
@@ -720,7 +732,7 @@ static void uv__write_req_finish(uv_write_t* req) {
|
|
|
720
732
|
/* Add it to the write_completed_queue where it will have its
|
|
721
733
|
* callback called in the near future.
|
|
722
734
|
*/
|
|
723
|
-
|
|
735
|
+
uv__queue_insert_tail(&stream->write_completed_queue, &req->queue);
|
|
724
736
|
uv__io_feed(stream->loop, &stream->io_watcher);
|
|
725
737
|
}
|
|
726
738
|
|
|
@@ -739,32 +751,21 @@ static int uv__handle_fd(uv_handle_t* handle) {
|
|
|
739
751
|
}
|
|
740
752
|
}
|
|
741
753
|
|
|
742
|
-
static
|
|
754
|
+
static int uv__try_write(uv_stream_t* stream,
|
|
755
|
+
const uv_buf_t bufs[],
|
|
756
|
+
unsigned int nbufs,
|
|
757
|
+
uv_stream_t* send_handle) {
|
|
743
758
|
struct iovec* iov;
|
|
744
|
-
QUEUE* q;
|
|
745
|
-
uv_write_t* req;
|
|
746
759
|
int iovmax;
|
|
747
760
|
int iovcnt;
|
|
748
761
|
ssize_t n;
|
|
749
762
|
|
|
750
|
-
start:
|
|
751
|
-
|
|
752
|
-
assert(uv__stream_fd(stream) >= 0);
|
|
753
|
-
|
|
754
|
-
if (QUEUE_EMPTY(&stream->write_queue))
|
|
755
|
-
return;
|
|
756
|
-
|
|
757
|
-
q = QUEUE_HEAD(&stream->write_queue);
|
|
758
|
-
req = QUEUE_DATA(q, uv_write_t, queue);
|
|
759
|
-
assert(req->handle == stream);
|
|
760
|
-
|
|
761
763
|
/*
|
|
762
764
|
* Cast to iovec. We had to have our own uv_buf_t instead of iovec
|
|
763
765
|
* because Windows's WSABUF is not an iovec.
|
|
764
766
|
*/
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
iovcnt = req->nbufs - req->write_index;
|
|
767
|
+
iov = (struct iovec*) bufs;
|
|
768
|
+
iovcnt = nbufs;
|
|
768
769
|
|
|
769
770
|
iovmax = uv__getiovmax();
|
|
770
771
|
|
|
@@ -776,12 +777,17 @@ start:
|
|
|
776
777
|
* Now do the actual writev. Note that we've been updating the pointers
|
|
777
778
|
* inside the iov each time we write. So there is no need to offset it.
|
|
778
779
|
*/
|
|
779
|
-
|
|
780
|
-
|
|
780
|
+
if (send_handle != NULL) {
|
|
781
|
+
int fd_to_send;
|
|
781
782
|
struct msghdr msg;
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
783
|
+
union uv__cmsg cmsg;
|
|
784
|
+
|
|
785
|
+
if (uv__is_closing(send_handle))
|
|
786
|
+
return UV_EBADF;
|
|
787
|
+
|
|
788
|
+
fd_to_send = uv__handle_fd((uv_handle_t*) send_handle);
|
|
789
|
+
|
|
790
|
+
memset(&cmsg, 0, sizeof(cmsg));
|
|
785
791
|
|
|
786
792
|
assert(fd_to_send >= 0);
|
|
787
793
|
|
|
@@ -791,142 +797,123 @@ start:
|
|
|
791
797
|
msg.msg_iovlen = iovcnt;
|
|
792
798
|
msg.msg_flags = 0;
|
|
793
799
|
|
|
794
|
-
msg.msg_control =
|
|
800
|
+
msg.msg_control = &cmsg.hdr;
|
|
795
801
|
msg.msg_controllen = CMSG_SPACE(sizeof(fd_to_send));
|
|
796
802
|
|
|
797
|
-
cmsg =
|
|
798
|
-
cmsg
|
|
799
|
-
cmsg
|
|
800
|
-
cmsg
|
|
801
|
-
|
|
802
|
-
/* silence aliasing warning */
|
|
803
|
-
{
|
|
804
|
-
void* pv = CMSG_DATA(cmsg);
|
|
805
|
-
int* pi = pv;
|
|
806
|
-
*pi = fd_to_send;
|
|
807
|
-
}
|
|
803
|
+
cmsg.hdr.cmsg_level = SOL_SOCKET;
|
|
804
|
+
cmsg.hdr.cmsg_type = SCM_RIGHTS;
|
|
805
|
+
cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(fd_to_send));
|
|
806
|
+
memcpy(CMSG_DATA(&cmsg.hdr), &fd_to_send, sizeof(fd_to_send));
|
|
808
807
|
|
|
809
|
-
do
|
|
808
|
+
do
|
|
810
809
|
n = sendmsg(uv__stream_fd(stream), &msg, 0);
|
|
811
|
-
}
|
|
812
|
-
#if defined(__APPLE__)
|
|
813
|
-
/*
|
|
814
|
-
* Due to a possible kernel bug at least in OS X 10.10 "Yosemite",
|
|
815
|
-
* EPROTOTYPE can be returned while trying to write to a socket that is
|
|
816
|
-
* shutting down. If we retry the write, we should get the expected EPIPE
|
|
817
|
-
* instead.
|
|
818
|
-
*/
|
|
819
|
-
while (n == -1 && (errno == EINTR || errno == EPROTOTYPE));
|
|
820
|
-
#else
|
|
821
810
|
while (n == -1 && errno == EINTR);
|
|
822
|
-
#endif
|
|
823
811
|
} else {
|
|
824
|
-
do
|
|
825
|
-
|
|
826
|
-
n = write(uv__stream_fd(stream), iov[0].iov_base, iov[0].iov_len);
|
|
827
|
-
} else {
|
|
828
|
-
n = writev(uv__stream_fd(stream), iov, iovcnt);
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
#if defined(__APPLE__)
|
|
832
|
-
/*
|
|
833
|
-
* Due to a possible kernel bug at least in OS X 10.10 "Yosemite",
|
|
834
|
-
* EPROTOTYPE can be returned while trying to write to a socket that is
|
|
835
|
-
* shutting down. If we retry the write, we should get the expected EPIPE
|
|
836
|
-
* instead.
|
|
837
|
-
*/
|
|
838
|
-
while (n == -1 && (errno == EINTR || errno == EPROTOTYPE));
|
|
839
|
-
#else
|
|
812
|
+
do
|
|
813
|
+
n = uv__writev(uv__stream_fd(stream), iov, iovcnt);
|
|
840
814
|
while (n == -1 && errno == EINTR);
|
|
841
|
-
#endif
|
|
842
815
|
}
|
|
843
816
|
|
|
844
|
-
if (n
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
817
|
+
if (n >= 0)
|
|
818
|
+
return n;
|
|
819
|
+
|
|
820
|
+
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)
|
|
821
|
+
return UV_EAGAIN;
|
|
822
|
+
|
|
823
|
+
#ifdef __APPLE__
|
|
824
|
+
/* macOS versions 10.10 and 10.15 - and presumbaly 10.11 to 10.14, too -
|
|
825
|
+
* have a bug where a race condition causes the kernel to return EPROTOTYPE
|
|
826
|
+
* because the socket isn't fully constructed. It's probably the result of
|
|
827
|
+
* the peer closing the connection and that is why libuv translates it to
|
|
828
|
+
* ECONNRESET. Previously, libuv retried until the EPROTOTYPE error went
|
|
829
|
+
* away but some VPN software causes the same behavior except the error is
|
|
830
|
+
* permanent, not transient, turning the retry mechanism into an infinite
|
|
831
|
+
* loop. See https://github.com/libuv/libuv/pull/482.
|
|
832
|
+
*/
|
|
833
|
+
if (errno == EPROTOTYPE)
|
|
834
|
+
return UV_ECONNRESET;
|
|
835
|
+
#endif /* __APPLE__ */
|
|
836
|
+
|
|
837
|
+
return UV__ERR(errno);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
static void uv__write(uv_stream_t* stream) {
|
|
841
|
+
struct uv__queue* q;
|
|
842
|
+
uv_write_t* req;
|
|
843
|
+
ssize_t n;
|
|
844
|
+
int count;
|
|
845
|
+
|
|
846
|
+
assert(uv__stream_fd(stream) >= 0);
|
|
847
|
+
|
|
848
|
+
/* Prevent loop starvation when the consumer of this stream read as fast as
|
|
849
|
+
* (or faster than) we can write it. This `count` mechanism does not need to
|
|
850
|
+
* change even if we switch to edge-triggered I/O.
|
|
851
|
+
*/
|
|
852
|
+
count = 32;
|
|
853
|
+
|
|
854
|
+
for (;;) {
|
|
855
|
+
if (uv__queue_empty(&stream->write_queue))
|
|
853
856
|
return;
|
|
854
|
-
} else if (stream->flags & UV_STREAM_BLOCKING) {
|
|
855
|
-
/* If this is a blocking stream, try again. */
|
|
856
|
-
goto start;
|
|
857
|
-
}
|
|
858
|
-
} else {
|
|
859
|
-
/* Successful write */
|
|
860
|
-
|
|
861
|
-
while (n >= 0) {
|
|
862
|
-
uv_buf_t* buf = &(req->bufs[req->write_index]);
|
|
863
|
-
size_t len = buf->len;
|
|
864
|
-
|
|
865
|
-
assert(req->write_index < req->nbufs);
|
|
866
|
-
|
|
867
|
-
if ((size_t)n < len) {
|
|
868
|
-
buf->base += n;
|
|
869
|
-
buf->len -= n;
|
|
870
|
-
stream->write_queue_size -= n;
|
|
871
|
-
n = 0;
|
|
872
|
-
|
|
873
|
-
/* There is more to write. */
|
|
874
|
-
if (stream->flags & UV_STREAM_BLOCKING) {
|
|
875
|
-
/*
|
|
876
|
-
* If we're blocking then we should not be enabling the write
|
|
877
|
-
* watcher - instead we need to try again.
|
|
878
|
-
*/
|
|
879
|
-
goto start;
|
|
880
|
-
} else {
|
|
881
|
-
/* Break loop and ensure the watcher is pending. */
|
|
882
|
-
break;
|
|
883
|
-
}
|
|
884
857
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
858
|
+
q = uv__queue_head(&stream->write_queue);
|
|
859
|
+
req = uv__queue_data(q, uv_write_t, queue);
|
|
860
|
+
assert(req->handle == stream);
|
|
888
861
|
|
|
889
|
-
|
|
890
|
-
|
|
862
|
+
n = uv__try_write(stream,
|
|
863
|
+
&(req->bufs[req->write_index]),
|
|
864
|
+
req->nbufs - req->write_index,
|
|
865
|
+
req->send_handle);
|
|
891
866
|
|
|
892
|
-
|
|
893
|
-
|
|
867
|
+
/* Ensure the handle isn't sent again in case this is a partial write. */
|
|
868
|
+
if (n >= 0) {
|
|
869
|
+
req->send_handle = NULL;
|
|
870
|
+
if (uv__write_req_update(stream, req, n)) {
|
|
871
|
+
uv__write_req_finish(req);
|
|
872
|
+
if (count-- > 0)
|
|
873
|
+
continue; /* Start trying to write the next request. */
|
|
894
874
|
|
|
895
|
-
|
|
896
|
-
/* Then we're done! */
|
|
897
|
-
assert(n == 0);
|
|
898
|
-
uv__write_req_finish(req);
|
|
899
|
-
/* TODO: start trying to write the next request. */
|
|
900
|
-
return;
|
|
901
|
-
}
|
|
875
|
+
return;
|
|
902
876
|
}
|
|
903
|
-
}
|
|
904
|
-
|
|
877
|
+
} else if (n != UV_EAGAIN)
|
|
878
|
+
goto error;
|
|
905
879
|
|
|
906
|
-
|
|
907
|
-
|
|
880
|
+
/* If this is a blocking stream, try again. */
|
|
881
|
+
if (stream->flags & UV_HANDLE_BLOCKING_WRITES)
|
|
882
|
+
continue;
|
|
908
883
|
|
|
909
|
-
|
|
910
|
-
|
|
884
|
+
/* We're not done. */
|
|
885
|
+
uv__io_start(stream->loop, &stream->io_watcher, POLLOUT);
|
|
911
886
|
|
|
912
|
-
|
|
913
|
-
|
|
887
|
+
/* Notify select() thread about state change */
|
|
888
|
+
uv__stream_osx_interrupt_select(stream);
|
|
914
889
|
|
|
915
|
-
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
error:
|
|
894
|
+
req->error = n;
|
|
895
|
+
uv__write_req_finish(req);
|
|
896
|
+
uv__io_stop(stream->loop, &stream->io_watcher, POLLOUT);
|
|
916
897
|
uv__stream_osx_interrupt_select(stream);
|
|
917
898
|
}
|
|
918
899
|
|
|
919
900
|
|
|
920
901
|
static void uv__write_callbacks(uv_stream_t* stream) {
|
|
921
902
|
uv_write_t* req;
|
|
922
|
-
|
|
903
|
+
struct uv__queue* q;
|
|
904
|
+
struct uv__queue pq;
|
|
905
|
+
|
|
906
|
+
if (uv__queue_empty(&stream->write_completed_queue))
|
|
907
|
+
return;
|
|
923
908
|
|
|
924
|
-
|
|
909
|
+
uv__queue_move(&stream->write_completed_queue, &pq);
|
|
910
|
+
|
|
911
|
+
while (!uv__queue_empty(&pq)) {
|
|
925
912
|
/* Pop a req off write_completed_queue. */
|
|
926
|
-
q =
|
|
927
|
-
req =
|
|
928
|
-
|
|
929
|
-
uv__req_unregister(stream->loop
|
|
913
|
+
q = uv__queue_head(&pq);
|
|
914
|
+
req = uv__queue_data(q, uv_write_t, queue);
|
|
915
|
+
uv__queue_remove(q);
|
|
916
|
+
uv__req_unregister(stream->loop);
|
|
930
917
|
|
|
931
918
|
if (req->bufs != NULL) {
|
|
932
919
|
stream->write_queue_size -= uv__write_req_size(req);
|
|
@@ -939,53 +926,16 @@ static void uv__write_callbacks(uv_stream_t* stream) {
|
|
|
939
926
|
if (req->cb)
|
|
940
927
|
req->cb(req, req->error);
|
|
941
928
|
}
|
|
942
|
-
|
|
943
|
-
assert(QUEUE_EMPTY(&stream->write_completed_queue));
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
uv_handle_type uv__handle_type(int fd) {
|
|
948
|
-
struct sockaddr_storage ss;
|
|
949
|
-
socklen_t len;
|
|
950
|
-
int type;
|
|
951
|
-
|
|
952
|
-
memset(&ss, 0, sizeof(ss));
|
|
953
|
-
len = sizeof(ss);
|
|
954
|
-
|
|
955
|
-
if (getsockname(fd, (struct sockaddr*)&ss, &len))
|
|
956
|
-
return UV_UNKNOWN_HANDLE;
|
|
957
|
-
|
|
958
|
-
len = sizeof type;
|
|
959
|
-
|
|
960
|
-
if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &type, &len))
|
|
961
|
-
return UV_UNKNOWN_HANDLE;
|
|
962
|
-
|
|
963
|
-
if (type == SOCK_STREAM) {
|
|
964
|
-
switch (ss.ss_family) {
|
|
965
|
-
case AF_UNIX:
|
|
966
|
-
return UV_NAMED_PIPE;
|
|
967
|
-
case AF_INET:
|
|
968
|
-
case AF_INET6:
|
|
969
|
-
return UV_TCP;
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
if (type == SOCK_DGRAM &&
|
|
974
|
-
(ss.ss_family == AF_INET || ss.ss_family == AF_INET6))
|
|
975
|
-
return UV_UDP;
|
|
976
|
-
|
|
977
|
-
return UV_UNKNOWN_HANDLE;
|
|
978
929
|
}
|
|
979
930
|
|
|
980
931
|
|
|
981
932
|
static void uv__stream_eof(uv_stream_t* stream, const uv_buf_t* buf) {
|
|
982
|
-
stream->flags |=
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
933
|
+
stream->flags |= UV_HANDLE_READ_EOF;
|
|
934
|
+
stream->flags &= ~UV_HANDLE_READING;
|
|
935
|
+
uv__io_stop(stream->loop, &stream->io_watcher, POLLIN);
|
|
936
|
+
uv__handle_stop(stream);
|
|
986
937
|
uv__stream_osx_interrupt_select(stream);
|
|
987
938
|
stream->read_cb(stream, UV_EOF, buf);
|
|
988
|
-
stream->flags &= ~UV_STREAM_READING;
|
|
989
939
|
}
|
|
990
940
|
|
|
991
941
|
|
|
@@ -999,7 +949,7 @@ static int uv__stream_queue_fd(uv_stream_t* stream, int fd) {
|
|
|
999
949
|
queued_fds = uv__malloc((queue_size - 1) * sizeof(*queued_fds->fds) +
|
|
1000
950
|
sizeof(*queued_fds));
|
|
1001
951
|
if (queued_fds == NULL)
|
|
1002
|
-
return
|
|
952
|
+
return UV_ENOMEM;
|
|
1003
953
|
queued_fds->size = queue_size;
|
|
1004
954
|
queued_fds->offset = 0;
|
|
1005
955
|
stream->queued_fds = queued_fds;
|
|
@@ -1016,7 +966,7 @@ static int uv__stream_queue_fd(uv_stream_t* stream, int fd) {
|
|
|
1016
966
|
* NOTE: if it is fatal - sockets will be closed in uv__stream_close
|
|
1017
967
|
*/
|
|
1018
968
|
if (queued_fds == NULL)
|
|
1019
|
-
return
|
|
969
|
+
return UV_ENOMEM;
|
|
1020
970
|
queued_fds->size = queue_size;
|
|
1021
971
|
stream->queued_fds = queued_fds;
|
|
1022
972
|
}
|
|
@@ -1028,57 +978,47 @@ static int uv__stream_queue_fd(uv_stream_t* stream, int fd) {
|
|
|
1028
978
|
}
|
|
1029
979
|
|
|
1030
980
|
|
|
1031
|
-
#define UV__CMSG_FD_COUNT 64
|
|
1032
|
-
#define UV__CMSG_FD_SIZE (UV__CMSG_FD_COUNT * sizeof(int))
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
981
|
static int uv__stream_recv_cmsg(uv_stream_t* stream, struct msghdr* msg) {
|
|
1036
982
|
struct cmsghdr* cmsg;
|
|
983
|
+
char* p;
|
|
984
|
+
char* pe;
|
|
985
|
+
int fd;
|
|
986
|
+
int err;
|
|
987
|
+
size_t count;
|
|
1037
988
|
|
|
989
|
+
err = 0;
|
|
1038
990
|
for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) {
|
|
1039
|
-
char* start;
|
|
1040
|
-
char* end;
|
|
1041
|
-
int err;
|
|
1042
|
-
void* pv;
|
|
1043
|
-
int* pi;
|
|
1044
|
-
unsigned int i;
|
|
1045
|
-
unsigned int count;
|
|
1046
|
-
|
|
1047
991
|
if (cmsg->cmsg_type != SCM_RIGHTS) {
|
|
1048
992
|
fprintf(stderr, "ignoring non-SCM_RIGHTS ancillary data: %d\n",
|
|
1049
993
|
cmsg->cmsg_type);
|
|
1050
994
|
continue;
|
|
1051
995
|
}
|
|
1052
996
|
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
while (
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
/* Close rest */
|
|
1071
|
-
for (; i < count; i++)
|
|
1072
|
-
uv__close(pi[i]);
|
|
1073
|
-
return err;
|
|
1074
|
-
}
|
|
1075
|
-
} else {
|
|
1076
|
-
stream->accepted_fd = pi[i];
|
|
997
|
+
assert(cmsg->cmsg_len >= CMSG_LEN(0));
|
|
998
|
+
count = cmsg->cmsg_len - CMSG_LEN(0);
|
|
999
|
+
assert(count % sizeof(fd) == 0);
|
|
1000
|
+
count /= sizeof(fd);
|
|
1001
|
+
|
|
1002
|
+
p = (void*) CMSG_DATA(cmsg);
|
|
1003
|
+
pe = p + count * sizeof(fd);
|
|
1004
|
+
|
|
1005
|
+
while (p < pe) {
|
|
1006
|
+
memcpy(&fd, p, sizeof(fd));
|
|
1007
|
+
p += sizeof(fd);
|
|
1008
|
+
|
|
1009
|
+
if (err == 0) {
|
|
1010
|
+
if (stream->accepted_fd == -1)
|
|
1011
|
+
stream->accepted_fd = fd;
|
|
1012
|
+
else
|
|
1013
|
+
err = uv__stream_queue_fd(stream, fd);
|
|
1077
1014
|
}
|
|
1015
|
+
|
|
1016
|
+
if (err != 0)
|
|
1017
|
+
uv__close(fd);
|
|
1078
1018
|
}
|
|
1079
1019
|
}
|
|
1080
1020
|
|
|
1081
|
-
return
|
|
1021
|
+
return err;
|
|
1082
1022
|
}
|
|
1083
1023
|
|
|
1084
1024
|
|
|
@@ -1086,12 +1026,12 @@ static void uv__read(uv_stream_t* stream) {
|
|
|
1086
1026
|
uv_buf_t buf;
|
|
1087
1027
|
ssize_t nread;
|
|
1088
1028
|
struct msghdr msg;
|
|
1089
|
-
|
|
1029
|
+
union uv__cmsg cmsg;
|
|
1090
1030
|
int count;
|
|
1091
1031
|
int err;
|
|
1092
1032
|
int is_ipc;
|
|
1093
1033
|
|
|
1094
|
-
stream->flags &= ~
|
|
1034
|
+
stream->flags &= ~UV_HANDLE_READ_PARTIAL;
|
|
1095
1035
|
|
|
1096
1036
|
/* Prevent loop starvation when the data comes in as fast as (or faster than)
|
|
1097
1037
|
* we can read it. XXX Need to rearm fd if we switch to edge-triggered I/O.
|
|
@@ -1100,16 +1040,17 @@ static void uv__read(uv_stream_t* stream) {
|
|
|
1100
1040
|
|
|
1101
1041
|
is_ipc = stream->type == UV_NAMED_PIPE && ((uv_pipe_t*) stream)->ipc;
|
|
1102
1042
|
|
|
1103
|
-
/* XXX: Maybe instead of having
|
|
1043
|
+
/* XXX: Maybe instead of having UV_HANDLE_READING we just test if
|
|
1104
1044
|
* tcp->read_cb is NULL or not?
|
|
1105
1045
|
*/
|
|
1106
1046
|
while (stream->read_cb
|
|
1107
|
-
&& (stream->flags &
|
|
1047
|
+
&& (stream->flags & UV_HANDLE_READING)
|
|
1108
1048
|
&& (count-- > 0)) {
|
|
1109
1049
|
assert(stream->alloc_cb != NULL);
|
|
1110
1050
|
|
|
1051
|
+
buf = uv_buf_init(NULL, 0);
|
|
1111
1052
|
stream->alloc_cb((uv_handle_t*)stream, 64 * 1024, &buf);
|
|
1112
|
-
if (buf.len == 0) {
|
|
1053
|
+
if (buf.base == NULL || buf.len == 0) {
|
|
1113
1054
|
/* User indicates it can't or won't handle the read. */
|
|
1114
1055
|
stream->read_cb(stream, UV_ENOBUFS, &buf);
|
|
1115
1056
|
return;
|
|
@@ -1131,8 +1072,8 @@ static void uv__read(uv_stream_t* stream) {
|
|
|
1131
1072
|
msg.msg_name = NULL;
|
|
1132
1073
|
msg.msg_namelen = 0;
|
|
1133
1074
|
/* Set up to receive a descriptor even if one isn't in the message */
|
|
1134
|
-
msg.msg_controllen = sizeof(
|
|
1135
|
-
msg.msg_control =
|
|
1075
|
+
msg.msg_controllen = sizeof(cmsg);
|
|
1076
|
+
msg.msg_control = &cmsg.hdr;
|
|
1136
1077
|
|
|
1137
1078
|
do {
|
|
1138
1079
|
nread = uv__recvmsg(uv__stream_fd(stream), &msg, 0);
|
|
@@ -1144,19 +1085,24 @@ static void uv__read(uv_stream_t* stream) {
|
|
|
1144
1085
|
/* Error */
|
|
1145
1086
|
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
|
1146
1087
|
/* Wait for the next one. */
|
|
1147
|
-
if (stream->flags &
|
|
1148
|
-
uv__io_start(stream->loop, &stream->io_watcher,
|
|
1088
|
+
if (stream->flags & UV_HANDLE_READING) {
|
|
1089
|
+
uv__io_start(stream->loop, &stream->io_watcher, POLLIN);
|
|
1149
1090
|
uv__stream_osx_interrupt_select(stream);
|
|
1150
1091
|
}
|
|
1151
1092
|
stream->read_cb(stream, 0, &buf);
|
|
1093
|
+
#if defined(__CYGWIN__) || defined(__MSYS__)
|
|
1094
|
+
} else if (errno == ECONNRESET && stream->type == UV_NAMED_PIPE) {
|
|
1095
|
+
uv__stream_eof(stream, &buf);
|
|
1096
|
+
return;
|
|
1097
|
+
#endif
|
|
1152
1098
|
} else {
|
|
1153
1099
|
/* Error. User should call uv_close(). */
|
|
1154
|
-
stream->
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1100
|
+
stream->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
|
|
1101
|
+
stream->read_cb(stream, UV__ERR(errno), &buf);
|
|
1102
|
+
if (stream->flags & UV_HANDLE_READING) {
|
|
1103
|
+
stream->flags &= ~UV_HANDLE_READING;
|
|
1104
|
+
uv__io_stop(stream->loop, &stream->io_watcher, POLLIN);
|
|
1105
|
+
uv__handle_stop(stream);
|
|
1160
1106
|
uv__stream_osx_interrupt_select(stream);
|
|
1161
1107
|
}
|
|
1162
1108
|
}
|
|
@@ -1175,11 +1121,35 @@ static void uv__read(uv_stream_t* stream) {
|
|
|
1175
1121
|
return;
|
|
1176
1122
|
}
|
|
1177
1123
|
}
|
|
1124
|
+
|
|
1125
|
+
#if defined(__MVS__)
|
|
1126
|
+
if (is_ipc && msg.msg_controllen > 0) {
|
|
1127
|
+
uv_buf_t blankbuf;
|
|
1128
|
+
int nread;
|
|
1129
|
+
struct iovec *old;
|
|
1130
|
+
|
|
1131
|
+
blankbuf.base = 0;
|
|
1132
|
+
blankbuf.len = 0;
|
|
1133
|
+
old = msg.msg_iov;
|
|
1134
|
+
msg.msg_iov = (struct iovec*) &blankbuf;
|
|
1135
|
+
nread = 0;
|
|
1136
|
+
do {
|
|
1137
|
+
nread = uv__recvmsg(uv__stream_fd(stream), &msg, 0);
|
|
1138
|
+
err = uv__stream_recv_cmsg(stream, &msg);
|
|
1139
|
+
if (err != 0) {
|
|
1140
|
+
stream->read_cb(stream, err, &buf);
|
|
1141
|
+
msg.msg_iov = old;
|
|
1142
|
+
return;
|
|
1143
|
+
}
|
|
1144
|
+
} while (nread == 0 && msg.msg_controllen > 0);
|
|
1145
|
+
msg.msg_iov = old;
|
|
1146
|
+
}
|
|
1147
|
+
#endif
|
|
1178
1148
|
stream->read_cb(stream, nread, &buf);
|
|
1179
1149
|
|
|
1180
1150
|
/* Return if we didn't fill the buffer, there is no more data to read. */
|
|
1181
1151
|
if (nread < buflen) {
|
|
1182
|
-
stream->flags |=
|
|
1152
|
+
stream->flags |= UV_HANDLE_READ_PARTIAL;
|
|
1183
1153
|
return;
|
|
1184
1154
|
}
|
|
1185
1155
|
}
|
|
@@ -1187,33 +1157,30 @@ static void uv__read(uv_stream_t* stream) {
|
|
|
1187
1157
|
}
|
|
1188
1158
|
|
|
1189
1159
|
|
|
1190
|
-
#undef UV__CMSG_FD_COUNT
|
|
1191
|
-
#undef UV__CMSG_FD_SIZE
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
1160
|
int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) {
|
|
1195
|
-
assert(
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
stream->flags &
|
|
1201
|
-
stream
|
|
1202
|
-
stream
|
|
1203
|
-
return
|
|
1161
|
+
assert(stream->type == UV_TCP ||
|
|
1162
|
+
stream->type == UV_TTY ||
|
|
1163
|
+
stream->type == UV_NAMED_PIPE);
|
|
1164
|
+
|
|
1165
|
+
if (!(stream->flags & UV_HANDLE_WRITABLE) ||
|
|
1166
|
+
stream->flags & UV_HANDLE_SHUT ||
|
|
1167
|
+
uv__is_stream_shutting(stream) ||
|
|
1168
|
+
uv__is_closing(stream)) {
|
|
1169
|
+
return UV_ENOTCONN;
|
|
1204
1170
|
}
|
|
1205
1171
|
|
|
1206
1172
|
assert(uv__stream_fd(stream) >= 0);
|
|
1207
1173
|
|
|
1208
|
-
/* Initialize request
|
|
1174
|
+
/* Initialize request. The `shutdown(2)` call will always be deferred until
|
|
1175
|
+
* `uv__drain`, just before the callback is run. */
|
|
1209
1176
|
uv__req_init(stream->loop, req, UV_SHUTDOWN);
|
|
1210
1177
|
req->handle = stream;
|
|
1211
1178
|
req->cb = cb;
|
|
1212
1179
|
stream->shutdown_req = req;
|
|
1213
|
-
stream->flags
|
|
1180
|
+
stream->flags &= ~UV_HANDLE_WRITABLE;
|
|
1214
1181
|
|
|
1215
|
-
|
|
1216
|
-
|
|
1182
|
+
if (uv__queue_empty(&stream->write_queue))
|
|
1183
|
+
uv__io_feed(stream->loop, &stream->io_watcher);
|
|
1217
1184
|
|
|
1218
1185
|
return 0;
|
|
1219
1186
|
}
|
|
@@ -1227,7 +1194,7 @@ static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
|
|
1227
1194
|
assert(stream->type == UV_TCP ||
|
|
1228
1195
|
stream->type == UV_NAMED_PIPE ||
|
|
1229
1196
|
stream->type == UV_TTY);
|
|
1230
|
-
assert(!(stream->flags &
|
|
1197
|
+
assert(!(stream->flags & UV_HANDLE_CLOSING));
|
|
1231
1198
|
|
|
1232
1199
|
if (stream->connect_req) {
|
|
1233
1200
|
uv__stream_connect(stream);
|
|
@@ -1236,8 +1203,8 @@ static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
|
|
1236
1203
|
|
|
1237
1204
|
assert(uv__stream_fd(stream) >= 0);
|
|
1238
1205
|
|
|
1239
|
-
/* Ignore POLLHUP here. Even
|
|
1240
|
-
if (events & (
|
|
1206
|
+
/* Ignore POLLHUP here. Even if it's set, there may still be data to read. */
|
|
1207
|
+
if (events & (POLLIN | POLLERR | POLLHUP))
|
|
1241
1208
|
uv__read(stream);
|
|
1242
1209
|
|
|
1243
1210
|
if (uv__stream_fd(stream) == -1)
|
|
@@ -1249,10 +1216,10 @@ static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
|
|
1249
1216
|
* have to do anything. If the partial read flag is not set, we can't
|
|
1250
1217
|
* report the EOF yet because there is still data to read.
|
|
1251
1218
|
*/
|
|
1252
|
-
if ((events &
|
|
1253
|
-
(stream->flags &
|
|
1254
|
-
(stream->flags &
|
|
1255
|
-
!(stream->flags &
|
|
1219
|
+
if ((events & POLLHUP) &&
|
|
1220
|
+
(stream->flags & UV_HANDLE_READING) &&
|
|
1221
|
+
(stream->flags & UV_HANDLE_READ_PARTIAL) &&
|
|
1222
|
+
!(stream->flags & UV_HANDLE_READ_EOF)) {
|
|
1256
1223
|
uv_buf_t buf = { NULL, 0 };
|
|
1257
1224
|
uv__stream_eof(stream, &buf);
|
|
1258
1225
|
}
|
|
@@ -1260,12 +1227,12 @@ static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
|
|
1260
1227
|
if (uv__stream_fd(stream) == -1)
|
|
1261
1228
|
return; /* read_cb closed stream. */
|
|
1262
1229
|
|
|
1263
|
-
if (events & (
|
|
1230
|
+
if (events & (POLLOUT | POLLERR | POLLHUP)) {
|
|
1264
1231
|
uv__write(stream);
|
|
1265
1232
|
uv__write_callbacks(stream);
|
|
1266
1233
|
|
|
1267
1234
|
/* Write queue drained. */
|
|
1268
|
-
if (
|
|
1235
|
+
if (uv__queue_empty(&stream->write_queue))
|
|
1269
1236
|
uv__drain(stream);
|
|
1270
1237
|
}
|
|
1271
1238
|
}
|
|
@@ -1299,17 +1266,17 @@ static void uv__stream_connect(uv_stream_t* stream) {
|
|
|
1299
1266
|
SO_ERROR,
|
|
1300
1267
|
&error,
|
|
1301
1268
|
&errorsize);
|
|
1302
|
-
error =
|
|
1269
|
+
error = UV__ERR(error);
|
|
1303
1270
|
}
|
|
1304
1271
|
|
|
1305
|
-
if (error ==
|
|
1272
|
+
if (error == UV__ERR(EINPROGRESS))
|
|
1306
1273
|
return;
|
|
1307
1274
|
|
|
1308
1275
|
stream->connect_req = NULL;
|
|
1309
|
-
uv__req_unregister(stream->loop
|
|
1276
|
+
uv__req_unregister(stream->loop);
|
|
1310
1277
|
|
|
1311
|
-
if (error < 0 ||
|
|
1312
|
-
uv__io_stop(stream->loop, &stream->io_watcher,
|
|
1278
|
+
if (error < 0 || uv__queue_empty(&stream->write_queue)) {
|
|
1279
|
+
uv__io_stop(stream->loop, &stream->io_watcher, POLLOUT);
|
|
1313
1280
|
}
|
|
1314
1281
|
|
|
1315
1282
|
if (req->cb)
|
|
@@ -1319,20 +1286,15 @@ static void uv__stream_connect(uv_stream_t* stream) {
|
|
|
1319
1286
|
return;
|
|
1320
1287
|
|
|
1321
1288
|
if (error < 0) {
|
|
1322
|
-
uv__stream_flush_write_queue(stream,
|
|
1289
|
+
uv__stream_flush_write_queue(stream, UV_ECANCELED);
|
|
1323
1290
|
uv__write_callbacks(stream);
|
|
1324
1291
|
}
|
|
1325
1292
|
}
|
|
1326
1293
|
|
|
1327
1294
|
|
|
1328
|
-
int
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
unsigned int nbufs,
|
|
1332
|
-
uv_stream_t* send_handle,
|
|
1333
|
-
uv_write_cb cb) {
|
|
1334
|
-
int empty_queue;
|
|
1335
|
-
|
|
1295
|
+
static int uv__check_before_write(uv_stream_t* stream,
|
|
1296
|
+
unsigned int nbufs,
|
|
1297
|
+
uv_stream_t* send_handle) {
|
|
1336
1298
|
assert(nbufs > 0);
|
|
1337
1299
|
assert((stream->type == UV_TCP ||
|
|
1338
1300
|
stream->type == UV_NAMED_PIPE ||
|
|
@@ -1340,11 +1302,14 @@ int uv_write2(uv_write_t* req,
|
|
|
1340
1302
|
"uv_write (unix) does not yet support other types of streams");
|
|
1341
1303
|
|
|
1342
1304
|
if (uv__stream_fd(stream) < 0)
|
|
1343
|
-
return
|
|
1305
|
+
return UV_EBADF;
|
|
1344
1306
|
|
|
1345
|
-
if (
|
|
1307
|
+
if (!(stream->flags & UV_HANDLE_WRITABLE))
|
|
1308
|
+
return UV_EPIPE;
|
|
1309
|
+
|
|
1310
|
+
if (send_handle != NULL) {
|
|
1346
1311
|
if (stream->type != UV_NAMED_PIPE || !((uv_pipe_t*)stream)->ipc)
|
|
1347
|
-
return
|
|
1312
|
+
return UV_EINVAL;
|
|
1348
1313
|
|
|
1349
1314
|
/* XXX We abuse uv_write2() to send over UDP handles to child processes.
|
|
1350
1315
|
* Don't call uv__stream_fd() on those handles, it's a macro that on OS X
|
|
@@ -1353,9 +1318,31 @@ int uv_write2(uv_write_t* req,
|
|
|
1353
1318
|
* which works but only by accident.
|
|
1354
1319
|
*/
|
|
1355
1320
|
if (uv__handle_fd((uv_handle_t*) send_handle) < 0)
|
|
1356
|
-
return
|
|
1321
|
+
return UV_EBADF;
|
|
1322
|
+
|
|
1323
|
+
#if defined(__CYGWIN__) || defined(__MSYS__)
|
|
1324
|
+
/* Cygwin recvmsg always sets msg_controllen to zero, so we cannot send it.
|
|
1325
|
+
See https://github.com/mirror/newlib-cygwin/blob/86fc4bf0/winsup/cygwin/fhandler_socket.cc#L1736-L1743 */
|
|
1326
|
+
return UV_ENOSYS;
|
|
1327
|
+
#endif
|
|
1357
1328
|
}
|
|
1358
1329
|
|
|
1330
|
+
return 0;
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
int uv_write2(uv_write_t* req,
|
|
1334
|
+
uv_stream_t* stream,
|
|
1335
|
+
const uv_buf_t bufs[],
|
|
1336
|
+
unsigned int nbufs,
|
|
1337
|
+
uv_stream_t* send_handle,
|
|
1338
|
+
uv_write_cb cb) {
|
|
1339
|
+
int empty_queue;
|
|
1340
|
+
int err;
|
|
1341
|
+
|
|
1342
|
+
err = uv__check_before_write(stream, nbufs, send_handle);
|
|
1343
|
+
if (err < 0)
|
|
1344
|
+
return err;
|
|
1345
|
+
|
|
1359
1346
|
/* It's legal for write_queue_size > 0 even when the write_queue is empty;
|
|
1360
1347
|
* it means there are error-state requests in the write_completed_queue that
|
|
1361
1348
|
* will touch up write_queue_size later, see also uv__write_req_finish().
|
|
@@ -1370,14 +1357,14 @@ int uv_write2(uv_write_t* req,
|
|
|
1370
1357
|
req->handle = stream;
|
|
1371
1358
|
req->error = 0;
|
|
1372
1359
|
req->send_handle = send_handle;
|
|
1373
|
-
|
|
1360
|
+
uv__queue_init(&req->queue);
|
|
1374
1361
|
|
|
1375
1362
|
req->bufs = req->bufsml;
|
|
1376
1363
|
if (nbufs > ARRAY_SIZE(req->bufsml))
|
|
1377
1364
|
req->bufs = uv__malloc(nbufs * sizeof(bufs[0]));
|
|
1378
1365
|
|
|
1379
1366
|
if (req->bufs == NULL)
|
|
1380
|
-
return
|
|
1367
|
+
return UV_ENOMEM;
|
|
1381
1368
|
|
|
1382
1369
|
memcpy(req->bufs, bufs, nbufs * sizeof(bufs[0]));
|
|
1383
1370
|
req->nbufs = nbufs;
|
|
@@ -1385,7 +1372,7 @@ int uv_write2(uv_write_t* req,
|
|
|
1385
1372
|
stream->write_queue_size += uv__count_bufs(bufs, nbufs);
|
|
1386
1373
|
|
|
1387
1374
|
/* Append the request to write_queue. */
|
|
1388
|
-
|
|
1375
|
+
uv__queue_insert_tail(&stream->write_queue, &req->queue);
|
|
1389
1376
|
|
|
1390
1377
|
/* If the queue was empty when this function began, we should attempt to
|
|
1391
1378
|
* do the write immediately. Otherwise start the write_watcher and wait
|
|
@@ -1403,8 +1390,8 @@ int uv_write2(uv_write_t* req,
|
|
|
1403
1390
|
* if this assert fires then somehow the blocking stream isn't being
|
|
1404
1391
|
* sufficiently flushed in uv__write.
|
|
1405
1392
|
*/
|
|
1406
|
-
assert(!(stream->flags &
|
|
1407
|
-
uv__io_start(stream->loop, &stream->io_watcher,
|
|
1393
|
+
assert(!(stream->flags & UV_HANDLE_BLOCKING_WRITES));
|
|
1394
|
+
uv__io_start(stream->loop, &stream->io_watcher, POLLOUT);
|
|
1408
1395
|
uv__stream_osx_interrupt_select(stream);
|
|
1409
1396
|
}
|
|
1410
1397
|
|
|
@@ -1424,85 +1411,50 @@ int uv_write(uv_write_t* req,
|
|
|
1424
1411
|
}
|
|
1425
1412
|
|
|
1426
1413
|
|
|
1427
|
-
void uv_try_write_cb(uv_write_t* req, int status) {
|
|
1428
|
-
/* Should not be called */
|
|
1429
|
-
abort();
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
1414
|
int uv_try_write(uv_stream_t* stream,
|
|
1434
1415
|
const uv_buf_t bufs[],
|
|
1435
1416
|
unsigned int nbufs) {
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
size_t written;
|
|
1439
|
-
size_t req_size;
|
|
1440
|
-
uv_write_t req;
|
|
1417
|
+
return uv_try_write2(stream, bufs, nbufs, NULL);
|
|
1418
|
+
}
|
|
1441
1419
|
|
|
1442
|
-
/* Connecting or already writing some data */
|
|
1443
|
-
if (stream->connect_req != NULL || stream->write_queue_size != 0)
|
|
1444
|
-
return -EAGAIN;
|
|
1445
1420
|
|
|
1446
|
-
|
|
1421
|
+
int uv_try_write2(uv_stream_t* stream,
|
|
1422
|
+
const uv_buf_t bufs[],
|
|
1423
|
+
unsigned int nbufs,
|
|
1424
|
+
uv_stream_t* send_handle) {
|
|
1425
|
+
int err;
|
|
1447
1426
|
|
|
1448
|
-
|
|
1449
|
-
if (
|
|
1450
|
-
return
|
|
1427
|
+
/* Connecting or already writing some data */
|
|
1428
|
+
if (stream->connect_req != NULL || stream->write_queue_size != 0)
|
|
1429
|
+
return UV_EAGAIN;
|
|
1451
1430
|
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
req_size = uv__write_req_size(&req);
|
|
1456
|
-
else
|
|
1457
|
-
req_size = 0;
|
|
1458
|
-
written -= req_size;
|
|
1459
|
-
stream->write_queue_size -= req_size;
|
|
1460
|
-
|
|
1461
|
-
/* Unqueue request, regardless of immediateness */
|
|
1462
|
-
QUEUE_REMOVE(&req.queue);
|
|
1463
|
-
uv__req_unregister(stream->loop, &req);
|
|
1464
|
-
if (req.bufs != req.bufsml)
|
|
1465
|
-
uv__free(req.bufs);
|
|
1466
|
-
req.bufs = NULL;
|
|
1467
|
-
|
|
1468
|
-
/* Do not poll for writable, if we wasn't before calling this */
|
|
1469
|
-
if (!has_pollout) {
|
|
1470
|
-
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT);
|
|
1471
|
-
uv__stream_osx_interrupt_select(stream);
|
|
1472
|
-
}
|
|
1431
|
+
err = uv__check_before_write(stream, nbufs, NULL);
|
|
1432
|
+
if (err < 0)
|
|
1433
|
+
return err;
|
|
1473
1434
|
|
|
1474
|
-
|
|
1475
|
-
return -EAGAIN;
|
|
1476
|
-
else
|
|
1477
|
-
return written;
|
|
1435
|
+
return uv__try_write(stream, bufs, nbufs, send_handle);
|
|
1478
1436
|
}
|
|
1479
1437
|
|
|
1480
1438
|
|
|
1481
|
-
int
|
|
1482
|
-
|
|
1483
|
-
|
|
1439
|
+
int uv__read_start(uv_stream_t* stream,
|
|
1440
|
+
uv_alloc_cb alloc_cb,
|
|
1441
|
+
uv_read_cb read_cb) {
|
|
1484
1442
|
assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE ||
|
|
1485
1443
|
stream->type == UV_TTY);
|
|
1486
1444
|
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
* expresses the desired state of the user.
|
|
1492
|
-
*/
|
|
1493
|
-
stream->flags |= UV_STREAM_READING;
|
|
1445
|
+
/* The UV_HANDLE_READING flag is irrelevant of the state of the stream - it
|
|
1446
|
+
* just expresses the desired state of the user. */
|
|
1447
|
+
stream->flags |= UV_HANDLE_READING;
|
|
1448
|
+
stream->flags &= ~UV_HANDLE_READ_EOF;
|
|
1494
1449
|
|
|
1495
1450
|
/* TODO: try to do the read inline? */
|
|
1496
|
-
/* TODO: keep track of tcp state. If we've gotten a EOF then we should
|
|
1497
|
-
* not start the IO watcher.
|
|
1498
|
-
*/
|
|
1499
1451
|
assert(uv__stream_fd(stream) >= 0);
|
|
1500
1452
|
assert(alloc_cb);
|
|
1501
1453
|
|
|
1502
1454
|
stream->read_cb = read_cb;
|
|
1503
1455
|
stream->alloc_cb = alloc_cb;
|
|
1504
1456
|
|
|
1505
|
-
uv__io_start(stream->loop, &stream->io_watcher,
|
|
1457
|
+
uv__io_start(stream->loop, &stream->io_watcher, POLLIN);
|
|
1506
1458
|
uv__handle_start(stream);
|
|
1507
1459
|
uv__stream_osx_interrupt_select(stream);
|
|
1508
1460
|
|
|
@@ -1511,13 +1463,12 @@ int uv_read_start(uv_stream_t* stream,
|
|
|
1511
1463
|
|
|
1512
1464
|
|
|
1513
1465
|
int uv_read_stop(uv_stream_t* stream) {
|
|
1514
|
-
if (!(stream->flags &
|
|
1466
|
+
if (!(stream->flags & UV_HANDLE_READING))
|
|
1515
1467
|
return 0;
|
|
1516
1468
|
|
|
1517
|
-
stream->flags &= ~
|
|
1518
|
-
uv__io_stop(stream->loop, &stream->io_watcher,
|
|
1519
|
-
|
|
1520
|
-
uv__handle_stop(stream);
|
|
1469
|
+
stream->flags &= ~UV_HANDLE_READING;
|
|
1470
|
+
uv__io_stop(stream->loop, &stream->io_watcher, POLLIN);
|
|
1471
|
+
uv__handle_stop(stream);
|
|
1521
1472
|
uv__stream_osx_interrupt_select(stream);
|
|
1522
1473
|
|
|
1523
1474
|
stream->read_cb = NULL;
|
|
@@ -1527,12 +1478,12 @@ int uv_read_stop(uv_stream_t* stream) {
|
|
|
1527
1478
|
|
|
1528
1479
|
|
|
1529
1480
|
int uv_is_readable(const uv_stream_t* stream) {
|
|
1530
|
-
return !!(stream->flags &
|
|
1481
|
+
return !!(stream->flags & UV_HANDLE_READABLE);
|
|
1531
1482
|
}
|
|
1532
1483
|
|
|
1533
1484
|
|
|
1534
1485
|
int uv_is_writable(const uv_stream_t* stream) {
|
|
1535
|
-
return !!(stream->flags &
|
|
1486
|
+
return !!(stream->flags & UV_HANDLE_WRITABLE);
|
|
1536
1487
|
}
|
|
1537
1488
|
|
|
1538
1489
|
|
|
@@ -1581,6 +1532,7 @@ void uv__stream_close(uv_stream_t* handle) {
|
|
|
1581
1532
|
uv__io_close(handle->loop, &handle->io_watcher);
|
|
1582
1533
|
uv_read_stop(handle);
|
|
1583
1534
|
uv__handle_stop(handle);
|
|
1535
|
+
handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
|
|
1584
1536
|
|
|
1585
1537
|
if (handle->io_watcher.fd != -1) {
|
|
1586
1538
|
/* Don't close stdio file descriptors. Nothing good comes from it. */
|
|
@@ -1603,7 +1555,7 @@ void uv__stream_close(uv_stream_t* handle) {
|
|
|
1603
1555
|
handle->queued_fds = NULL;
|
|
1604
1556
|
}
|
|
1605
1557
|
|
|
1606
|
-
assert(!uv__io_active(&handle->io_watcher,
|
|
1558
|
+
assert(!uv__io_active(&handle->io_watcher, POLLIN | POLLOUT));
|
|
1607
1559
|
}
|
|
1608
1560
|
|
|
1609
1561
|
|