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.
Files changed (650) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +33 -1
  3. data/CONTRIBUTING.md +7 -311
  4. data/CONTRIBUTORS +1 -0
  5. data/LICENSE +1 -1
  6. data/README.md +1 -1
  7. data/Rakefile +1 -1
  8. data/bin/passenger +1 -1
  9. data/bin/passenger-config +1 -1
  10. data/bin/passenger-install-apache2-module +1 -1
  11. data/bin/passenger-install-nginx-module +4 -9
  12. data/bin/passenger-memory-stats +1 -1
  13. data/bin/passenger-status +1 -1
  14. data/build/agent.rb +13 -15
  15. data/build/apache2.rb +13 -16
  16. data/build/basics.rb +10 -13
  17. data/build/common_library.rb +5 -9
  18. data/build/cxx_tests.rb +37 -12
  19. data/build/integration_tests.rb +5 -2
  20. data/build/misc.rb +1 -1
  21. data/build/nginx.rb +1 -1
  22. data/build/node_tests.rb +1 -1
  23. data/build/oxt_tests.rb +6 -8
  24. data/build/packaging.rb +1 -1
  25. data/build/ruby_extension.rb +1 -1
  26. data/build/ruby_tests.rb +1 -1
  27. data/build/schema_printer.rb +13 -15
  28. data/build/support/cplusplus.rb +61 -69
  29. data/build/support/cxx_dependency_map.rb +2 -1
  30. data/build/support/general.rb +1 -1
  31. data/build/support/vendor/cxx_hinted_parser/LICENSE.md +1 -1
  32. data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser/parser.rb +1 -1
  33. data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser.rb +1 -1
  34. data/build/support/vendor/cxxcodebuilder/LICENSE.md +1 -1
  35. data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/builder.rb +1 -1
  36. data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/initializer_builder.rb +1 -1
  37. data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder.rb +1 -1
  38. data/build/test_basics.rb +1 -1
  39. data/dev/copy_boost_headers +1 -1
  40. data/dev/index_cxx_dependencies.rb +5 -1
  41. data/dev/libev-changes.patch +108 -0
  42. data/dev/nginx_version_sha256 +1 -1
  43. data/dev/ruby_server.rb +1 -6
  44. data/dev/upgrading_libuv.sh +16 -0
  45. data/doc/BasicArchitectureOverview.md +55 -0
  46. data/doc/BuildCaching.md +23 -0
  47. data/doc/BuildSystem.md +49 -0
  48. data/doc/DebuggingAndStressTesting.md +2 -0
  49. data/doc/DesignAspects/LimitedGemDependencies.md +1 -0
  50. data/doc/DevEnvironmentSetup.md +46 -0
  51. data/doc/DevHandbook.md +28 -0
  52. data/doc/Packaging.md +1 -1
  53. data/doc/RunningTests.md +88 -0
  54. data/doc/{TempFileHandling.md → SecureTempFileHandling.md} +1 -1
  55. data/doc/{CxxTestingGuide.md → WritingCxxTests.md} +1 -20
  56. data/src/agent/AgentMain.cpp +1 -1
  57. data/src/agent/Core/ApiServer.h +1 -1
  58. data/src/agent/Core/ApplicationPool/AbstractSession.h +1 -1
  59. data/src/agent/Core/ApplicationPool/BasicGroupInfo.h +1 -1
  60. data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +1 -1
  61. data/src/agent/Core/ApplicationPool/Common.h +1 -1
  62. data/src/agent/Core/ApplicationPool/Context.h +1 -1
  63. data/src/agent/Core/ApplicationPool/Group/InitializationAndShutdown.cpp +1 -1
  64. data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +1 -1
  65. data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +1 -1
  66. data/src/agent/Core/ApplicationPool/Group/Miscellaneous.cpp +1 -1
  67. data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
  68. data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +1 -1
  69. data/src/agent/Core/ApplicationPool/Group/SessionManagement.cpp +1 -1
  70. data/src/agent/Core/ApplicationPool/Group/SpawningAndRestarting.cpp +1 -1
  71. data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +1 -1
  72. data/src/agent/Core/ApplicationPool/Group/Verification.cpp +1 -1
  73. data/src/agent/Core/ApplicationPool/Group.h +1 -1
  74. data/src/agent/Core/ApplicationPool/Implementation.cpp +1 -1
  75. data/src/agent/Core/ApplicationPool/Options.h +1 -1
  76. data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +1 -1
  77. data/src/agent/Core/ApplicationPool/Pool/GarbageCollection.cpp +1 -1
  78. data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +1 -1
  79. data/src/agent/Core/ApplicationPool/Pool/GroupUtils.cpp +1 -1
  80. data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +1 -1
  81. data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +1 -1
  82. data/src/agent/Core/ApplicationPool/Pool/ProcessUtils.cpp +1 -1
  83. data/src/agent/Core/ApplicationPool/Pool/StateInspection.cpp +1 -1
  84. data/src/agent/Core/ApplicationPool/Pool.h +1 -1
  85. data/src/agent/Core/ApplicationPool/Process.cpp +1 -1
  86. data/src/agent/Core/ApplicationPool/Process.h +1 -1
  87. data/src/agent/Core/ApplicationPool/Session.h +1 -1
  88. data/src/agent/Core/ApplicationPool/Socket.h +1 -1
  89. data/src/agent/Core/ApplicationPool/TestSession.h +1 -1
  90. data/src/agent/Core/Config.h +3 -2
  91. data/src/agent/Core/ConfigChange.cpp +1 -1
  92. data/src/agent/Core/ConfigChange.h +1 -1
  93. data/src/agent/Core/Controller/AppResponse.h +1 -1
  94. data/src/agent/Core/Controller/BufferBody.cpp +1 -1
  95. data/src/agent/Core/Controller/CheckoutSession.cpp +8 -5
  96. data/src/agent/Core/Controller/Client.h +1 -1
  97. data/src/agent/Core/Controller/Config.cpp +1 -1
  98. data/src/agent/Core/Controller/Config.h +2 -2
  99. data/src/agent/Core/Controller/ForwardResponse.cpp +2 -2
  100. data/src/agent/Core/Controller/Hooks.cpp +12 -9
  101. data/src/agent/Core/Controller/Implementation.cpp +1 -1
  102. data/src/agent/Core/Controller/InitRequest.cpp +1 -1
  103. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +1 -1
  104. data/src/agent/Core/Controller/InternalUtils.cpp +1 -1
  105. data/src/agent/Core/Controller/Miscellaneous.cpp +1 -1
  106. data/src/agent/Core/Controller/Request.h +1 -1
  107. data/src/agent/Core/Controller/SendRequest.cpp +1 -1
  108. data/src/agent/Core/Controller/StateInspection.cpp +1 -1
  109. data/src/agent/Core/Controller/TurboCaching.h +1 -1
  110. data/src/agent/Core/Controller.h +1 -1
  111. data/src/agent/Core/CoreMain.cpp +1 -1
  112. data/src/agent/Core/OptionParser.h +1 -1
  113. data/src/agent/Core/ResponseCache.h +1 -1
  114. data/src/agent/Core/SecurityUpdateChecker.h +1 -1
  115. data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +1 -1
  116. data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h.cxxcodebuilder +1 -1
  117. data/src/agent/Core/SpawningKit/Config.h +1 -1
  118. data/src/agent/Core/SpawningKit/Context.h +1 -1
  119. data/src/agent/Core/SpawningKit/DirectSpawner.h +1 -1
  120. data/src/agent/Core/SpawningKit/DummySpawner.h +1 -1
  121. data/src/agent/Core/SpawningKit/ErrorRenderer.h +1 -1
  122. data/src/agent/Core/SpawningKit/Exceptions.h +63 -2
  123. data/src/agent/Core/SpawningKit/Factory.h +1 -1
  124. data/src/agent/Core/SpawningKit/Handshake/BackgroundIOCapturer.h +1 -1
  125. data/src/agent/Core/SpawningKit/Handshake/Perform.h +3 -2
  126. data/src/agent/Core/SpawningKit/Handshake/Prepare.h +1 -1
  127. data/src/agent/Core/SpawningKit/Handshake/Session.h +1 -1
  128. data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +1 -1
  129. data/src/agent/Core/SpawningKit/Journey.h +1 -1
  130. data/src/agent/Core/SpawningKit/PipeWatcher.h +1 -1
  131. data/src/agent/Core/SpawningKit/README.md +3 -3
  132. data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +1 -1
  133. data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h.cxxcodebuilder +1 -1
  134. data/src/agent/Core/SpawningKit/Result.h +1 -1
  135. data/src/agent/Core/SpawningKit/SmartSpawner.h +17 -17
  136. data/src/agent/Core/SpawningKit/Spawner.h +1 -1
  137. data/src/agent/Core/SpawningKit/UserSwitchingRules.h +1 -1
  138. data/src/agent/Core/TelemetryCollector.h +1 -1
  139. data/src/agent/ExecHelper/ExecHelperMain.cpp +1 -1
  140. data/src/agent/FileReadHelper/FileReadHelperMain.cpp +1 -1
  141. data/src/agent/MainFunctions.h +1 -1
  142. data/src/agent/Shared/ApiAccountUtils.h +4 -3
  143. data/src/agent/Shared/ApiServerUtils.h +1 -2
  144. data/src/agent/Shared/ApplicationPoolApiKey.h +1 -1
  145. data/src/agent/Shared/Fundamentals/AbortHandler.cpp +1 -1
  146. data/src/agent/Shared/Fundamentals/AbortHandler.h +1 -1
  147. data/src/agent/Shared/Fundamentals/Initialization.cpp +1 -1
  148. data/src/agent/Shared/Fundamentals/Initialization.h +1 -1
  149. data/src/agent/Shared/Fundamentals/Utils.cpp +1 -1
  150. data/src/agent/Shared/Fundamentals/Utils.h +1 -1
  151. data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +1 -1
  152. data/src/agent/SystemMetrics/SystemMetricsMain.cpp +1 -1
  153. data/src/agent/TempDirToucher/TempDirToucherMain.cpp +1 -1
  154. data/src/agent/Watchdog/ApiServer.h +7 -6
  155. data/src/agent/Watchdog/Config.h +2 -2
  156. data/src/apache2_module/Bucket.cpp +1 -1
  157. data/src/apache2_module/Bucket.h +1 -1
  158. data/src/apache2_module/CBindings.cpp +1 -1
  159. data/src/apache2_module/Config.cpp +1 -1
  160. data/src/apache2_module/Config.h +1 -1
  161. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +104 -104
  162. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp.cxxcodebuilder +2 -2
  163. data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +1 -1
  164. data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp.cxxcodebuilder +1 -1
  165. data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +1 -1
  166. data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp.cxxcodebuilder +1 -1
  167. data/src/apache2_module/ConfigGeneral/Common.h +1 -1
  168. data/src/apache2_module/ConfigGeneral/ManifestGeneration.h +1 -1
  169. data/src/apache2_module/ConfigGeneral/SetterFuncs.h +1 -1
  170. data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +1 -1
  171. data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp.cxxcodebuilder +1 -1
  172. data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +1 -1
  173. data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp.cxxcodebuilder +1 -1
  174. data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +1 -1
  175. data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +1 -1
  176. data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +1 -1
  177. data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp.cxxcodebuilder +1 -1
  178. data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +1 -1
  179. data/src/apache2_module/DirConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
  180. data/src/apache2_module/DirectoryMapper.h +1 -1
  181. data/src/apache2_module/Hooks.cpp +8 -2
  182. data/src/apache2_module/Hooks.h +1 -1
  183. data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +1 -1
  184. data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +1 -1
  185. data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +1 -1
  186. data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
  187. data/src/apache2_module/Utils.h +1 -1
  188. data/src/apache2_module/mod_passenger.c +1 -1
  189. data/src/cxx_supportlib/Algorithms/Hasher.cpp +1 -1
  190. data/src/cxx_supportlib/Algorithms/Hasher.h +1 -1
  191. data/src/cxx_supportlib/Algorithms/MovingAverage.h +1 -1
  192. data/src/cxx_supportlib/AppLocalConfigFileUtils.h +1 -1
  193. data/src/cxx_supportlib/AppTypeDetector/CBindings.cpp +1 -1
  194. data/src/cxx_supportlib/AppTypeDetector/CBindings.h +1 -1
  195. data/src/cxx_supportlib/AppTypeDetector/Detector.h +1 -1
  196. data/src/cxx_supportlib/BackgroundEventLoop.cpp +1 -1
  197. data/src/cxx_supportlib/BackgroundEventLoop.h +1 -1
  198. data/src/cxx_supportlib/ConfigKit/AsyncUtils.h +1 -1
  199. data/src/cxx_supportlib/ConfigKit/Common.h +1 -1
  200. data/src/cxx_supportlib/ConfigKit/ConfigKit.h +1 -1
  201. data/src/cxx_supportlib/ConfigKit/DummyTranslator.h +1 -1
  202. data/src/cxx_supportlib/ConfigKit/IN_PRACTICE.md +1 -3
  203. data/src/cxx_supportlib/ConfigKit/PrefixTranslator.h +3 -3
  204. data/src/cxx_supportlib/ConfigKit/Schema.h +1 -1
  205. data/src/cxx_supportlib/ConfigKit/SchemaUtils.h +1 -1
  206. data/src/cxx_supportlib/ConfigKit/Store.h +1 -1
  207. data/src/cxx_supportlib/ConfigKit/SubComponentUtils.h +1 -1
  208. data/src/cxx_supportlib/ConfigKit/TableTranslator.h +1 -1
  209. data/src/cxx_supportlib/ConfigKit/Translator.h +1 -1
  210. data/src/cxx_supportlib/ConfigKit/Utils.h +1 -1
  211. data/src/cxx_supportlib/Constants.h +2 -2
  212. data/src/cxx_supportlib/Constants.h.cxxcodebuilder +1 -1
  213. data/src/cxx_supportlib/DataStructures/HashedStaticString.h +1 -1
  214. data/src/cxx_supportlib/DataStructures/LString.cpp +1 -1
  215. data/src/cxx_supportlib/DataStructures/LString.h +1 -1
  216. data/src/cxx_supportlib/DataStructures/StringKeyTable.h +1 -1
  217. data/src/cxx_supportlib/DataStructures/StringMap.h +1 -1
  218. data/src/cxx_supportlib/Exceptions.cpp +1 -1
  219. data/src/cxx_supportlib/Exceptions.h +1 -1
  220. data/src/cxx_supportlib/FileDescriptor.h +1 -1
  221. data/src/cxx_supportlib/FileTools/FileManip.cpp +1 -1
  222. data/src/cxx_supportlib/FileTools/FileManip.h +1 -1
  223. data/src/cxx_supportlib/FileTools/PathManip.cpp +1 -1
  224. data/src/cxx_supportlib/FileTools/PathManip.h +1 -1
  225. data/src/cxx_supportlib/FileTools/PathManipCBindings.cpp +1 -1
  226. data/src/cxx_supportlib/FileTools/PathManipCBindings.h +1 -1
  227. data/src/cxx_supportlib/FileTools/PathSecurityCheck.cpp +1 -1
  228. data/src/cxx_supportlib/FileTools/PathSecurityCheck.h +1 -1
  229. data/src/cxx_supportlib/Hooks.h +1 -1
  230. data/src/cxx_supportlib/IOTools/BufferedIO.h +1 -1
  231. data/src/cxx_supportlib/IOTools/IOUtils.cpp +10 -10
  232. data/src/cxx_supportlib/IOTools/IOUtils.h +1 -1
  233. data/src/cxx_supportlib/IOTools/MessageIO.h +1 -1
  234. data/src/cxx_supportlib/IOTools/MessageSerialization.h +1 -1
  235. data/src/cxx_supportlib/InstanceDirectory.h +1 -1
  236. data/src/cxx_supportlib/Integrations/LibevJsonUtils.h +1 -1
  237. data/src/cxx_supportlib/JsonTools/Autocast.h +1 -1
  238. data/src/cxx_supportlib/JsonTools/CBindings.cpp +1 -1
  239. data/src/cxx_supportlib/JsonTools/CBindings.h +1 -1
  240. data/src/cxx_supportlib/JsonTools/JsonUtils.h +1 -1
  241. data/src/cxx_supportlib/LoggingKit/Assert.h +1 -1
  242. data/src/cxx_supportlib/LoggingKit/Config.h +2 -1
  243. data/src/cxx_supportlib/LoggingKit/Context.h +1 -1
  244. data/src/cxx_supportlib/LoggingKit/Forward.h +1 -1
  245. data/src/cxx_supportlib/LoggingKit/Implementation.cpp +11 -1
  246. data/src/cxx_supportlib/LoggingKit/Logging.h +1 -1
  247. data/src/cxx_supportlib/LoggingKit/LoggingKit.h +1 -1
  248. data/src/cxx_supportlib/LveLoggingDecorator.h +1 -1
  249. data/src/cxx_supportlib/MemoryKit/mbuf.cpp +1 -1
  250. data/src/cxx_supportlib/MemoryKit/mbuf.h +1 -1
  251. data/src/cxx_supportlib/MemoryKit/palloc.cpp +1 -1
  252. data/src/cxx_supportlib/MemoryKit/palloc.h +1 -1
  253. data/src/cxx_supportlib/ProcessManagement/Ruby.cpp +1 -1
  254. data/src/cxx_supportlib/ProcessManagement/Ruby.h +1 -1
  255. data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +1 -1
  256. data/src/cxx_supportlib/ProcessManagement/Spawn.h +1 -1
  257. data/src/cxx_supportlib/ProcessManagement/Utils.cpp +1 -1
  258. data/src/cxx_supportlib/ProcessManagement/Utils.h +1 -1
  259. data/src/cxx_supportlib/RandomGenerator.h +1 -1
  260. data/src/cxx_supportlib/ResourceLocator.h +1 -1
  261. data/src/cxx_supportlib/SafeLibev.h +1 -1
  262. data/src/cxx_supportlib/SecurityKit/Crypto.cpp +9 -27
  263. data/src/cxx_supportlib/SecurityKit/Crypto.h +2 -2
  264. data/src/cxx_supportlib/SecurityKit/MemZeroGuard.h +1 -1
  265. data/src/cxx_supportlib/ServerKit/AcceptLoadBalancer.h +1 -1
  266. data/src/cxx_supportlib/ServerKit/Channel.h +1 -1
  267. data/src/cxx_supportlib/ServerKit/Client.h +1 -1
  268. data/src/cxx_supportlib/ServerKit/ClientRef.h +1 -1
  269. data/src/cxx_supportlib/ServerKit/Config.h +1 -1
  270. data/src/cxx_supportlib/ServerKit/Context.h +1 -1
  271. data/src/cxx_supportlib/ServerKit/CookieUtils.h +1 -1
  272. data/src/cxx_supportlib/ServerKit/Errors.h +1 -1
  273. data/src/cxx_supportlib/ServerKit/FdSinkChannel.h +1 -1
  274. data/src/cxx_supportlib/ServerKit/FdSourceChannel.h +1 -1
  275. data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +54 -2
  276. data/src/cxx_supportlib/ServerKit/FileBufferedFdSinkChannel.h +1 -1
  277. data/src/cxx_supportlib/ServerKit/HeaderTable.h +1 -1
  278. data/src/cxx_supportlib/ServerKit/Hooks.h +1 -1
  279. data/src/cxx_supportlib/ServerKit/HttpChunkedBodyParser.h +1 -1
  280. data/src/cxx_supportlib/ServerKit/HttpChunkedBodyParserState.h +1 -1
  281. data/src/cxx_supportlib/ServerKit/HttpClient.h +1 -1
  282. data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +1 -1
  283. data/src/cxx_supportlib/ServerKit/HttpHeaderParserState.h +1 -1
  284. data/src/cxx_supportlib/ServerKit/HttpRequest.h +1 -1
  285. data/src/cxx_supportlib/ServerKit/HttpRequestRef.h +1 -1
  286. data/src/cxx_supportlib/ServerKit/HttpServer.h +1 -1
  287. data/src/cxx_supportlib/ServerKit/Implementation.cpp +1 -1
  288. data/src/cxx_supportlib/ServerKit/Server.h +4 -2
  289. data/src/cxx_supportlib/StaticString.h +1 -1
  290. data/src/cxx_supportlib/StrIntTools/DateParsing.h +1 -1
  291. data/src/cxx_supportlib/StrIntTools/StrIntUtils.cpp +1 -1
  292. data/src/cxx_supportlib/StrIntTools/StrIntUtils.h +1 -1
  293. data/src/cxx_supportlib/StrIntTools/StrIntUtilsNoStrictAliasing.cpp +1 -1
  294. data/src/cxx_supportlib/StrIntTools/StringScanning.h +1 -1
  295. data/src/cxx_supportlib/StrIntTools/Template.h +1 -1
  296. data/src/cxx_supportlib/SystemTools/ContainerHelpers.h +1 -1
  297. data/src/cxx_supportlib/SystemTools/ProcessMetricsCollector.h +1 -1
  298. data/src/cxx_supportlib/SystemTools/SystemMetricsCollector.h +1 -1
  299. data/src/cxx_supportlib/SystemTools/SystemTime.cpp +1 -1
  300. data/src/cxx_supportlib/SystemTools/SystemTime.h +1 -1
  301. data/src/cxx_supportlib/SystemTools/UserDatabase.cpp +1 -1
  302. data/src/cxx_supportlib/SystemTools/UserDatabase.h +1 -1
  303. data/src/cxx_supportlib/Utils/AnsiColorConstants.h +1 -1
  304. data/src/cxx_supportlib/Utils/AsyncSignalSafeUtils.h +1 -1
  305. data/src/cxx_supportlib/Utils/BlockingQueue.h +1 -1
  306. data/src/cxx_supportlib/Utils/CachedFileStat.cpp +1 -1
  307. data/src/cxx_supportlib/Utils/CachedFileStat.h +1 -1
  308. data/src/cxx_supportlib/Utils/CachedFileStat.hpp +1 -1
  309. data/src/cxx_supportlib/Utils/ClassUtils.h +1 -1
  310. data/src/cxx_supportlib/Utils/Curl.h +1 -1
  311. data/src/cxx_supportlib/Utils/FastStringStream.h +1 -1
  312. data/src/cxx_supportlib/Utils/FileChangeChecker.h +1 -1
  313. data/src/cxx_supportlib/Utils/HttpConstants.h +1 -1
  314. data/src/cxx_supportlib/Utils/IniFile.h +1 -1
  315. data/src/cxx_supportlib/Utils/MessagePassing.h +1 -1
  316. data/src/cxx_supportlib/Utils/OptionParsing.h +1 -1
  317. data/src/cxx_supportlib/Utils/ReleaseableScopedPointer.h +1 -1
  318. data/src/cxx_supportlib/Utils/ScopeGuard.h +1 -1
  319. data/src/cxx_supportlib/Utils/SpeedMeter.h +1 -1
  320. data/src/cxx_supportlib/Utils/Timer.h +1 -1
  321. data/src/cxx_supportlib/Utils/VariantMap.h +1 -1
  322. data/src/cxx_supportlib/Utils.cpp +1 -1
  323. data/src/cxx_supportlib/Utils.h +1 -1
  324. data/src/cxx_supportlib/WatchdogLauncher.cpp +1 -1
  325. data/src/cxx_supportlib/WatchdogLauncher.h +1 -1
  326. data/src/cxx_supportlib/WrapperRegistry/CBindings.cpp +1 -1
  327. data/src/cxx_supportlib/WrapperRegistry/CBindings.h +1 -1
  328. data/src/cxx_supportlib/WrapperRegistry/Entry.h +1 -1
  329. data/src/cxx_supportlib/WrapperRegistry/Registry.h +1 -1
  330. data/src/cxx_supportlib/oxt/backtrace.hpp +1 -1
  331. data/src/cxx_supportlib/oxt/detail/backtrace_disabled.hpp +1 -1
  332. data/src/cxx_supportlib/oxt/detail/backtrace_enabled.hpp +1 -1
  333. data/src/cxx_supportlib/oxt/detail/context.hpp +1 -1
  334. data/src/cxx_supportlib/oxt/detail/tracable_exception_disabled.hpp +1 -1
  335. data/src/cxx_supportlib/oxt/detail/tracable_exception_enabled.hpp +1 -1
  336. data/src/cxx_supportlib/oxt/dynamic_thread_group.hpp +1 -1
  337. data/src/cxx_supportlib/oxt/implementation.cpp +1 -1
  338. data/src/cxx_supportlib/oxt/initialize.hpp +1 -1
  339. data/src/cxx_supportlib/oxt/macros.hpp +1 -1
  340. data/src/cxx_supportlib/oxt/spin_lock.hpp +1 -1
  341. data/src/cxx_supportlib/oxt/system_calls.cpp +1 -1
  342. data/src/cxx_supportlib/oxt/system_calls.hpp +1 -1
  343. data/src/cxx_supportlib/oxt/thread.hpp +1 -1
  344. data/src/cxx_supportlib/oxt/tracable_exception.hpp +1 -1
  345. data/src/cxx_supportlib/vendor-copy/adhoc_lve.h +1 -1
  346. data/src/cxx_supportlib/vendor-copy/libuv/AUTHORS +353 -3
  347. data/src/cxx_supportlib/vendor-copy/libuv/ChangeLog +3981 -2
  348. data/src/cxx_supportlib/vendor-copy/libuv/LICENSE +1 -28
  349. data/src/cxx_supportlib/vendor-copy/libuv/LICENSE-docs +396 -0
  350. data/src/cxx_supportlib/vendor-copy/libuv/LICENSE-extra +36 -0
  351. data/src/cxx_supportlib/vendor-copy/libuv/Makefile.am +275 -58
  352. data/src/cxx_supportlib/vendor-copy/libuv/Makefile.in +4380 -2125
  353. data/src/cxx_supportlib/vendor-copy/libuv/aclocal.m4 +425 -221
  354. data/src/cxx_supportlib/vendor-copy/libuv/ar-lib +30 -10
  355. data/src/cxx_supportlib/vendor-copy/libuv/compile +31 -14
  356. data/src/cxx_supportlib/vendor-copy/libuv/config.guess +1084 -690
  357. data/src/cxx_supportlib/vendor-copy/libuv/config.sub +1844 -1297
  358. data/src/cxx_supportlib/vendor-copy/libuv/configure +6935 -3664
  359. data/src/cxx_supportlib/vendor-copy/libuv/configure.ac +43 -19
  360. data/src/cxx_supportlib/vendor-copy/libuv/depcomp +12 -11
  361. data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-darwin.h → uv/darwin.h} +3 -3
  362. data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-errno.h → uv/errno.h} +119 -60
  363. data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-linux.h → uv/linux.h} +1 -1
  364. data/src/cxx_supportlib/vendor-copy/libuv/include/uv/os390.h +33 -0
  365. data/src/cxx_supportlib/vendor-copy/libuv/include/uv/posix.h +31 -0
  366. data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-threadpool.h → uv/threadpool.h} +1 -1
  367. data/src/cxx_supportlib/vendor-copy/libuv/include/{tree.h → uv/tree.h} +3 -250
  368. data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-unix.h → uv/unix.h} +186 -60
  369. data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-version.h → uv/version.h} +3 -3
  370. data/src/cxx_supportlib/vendor-copy/libuv/include/uv/win.h +703 -0
  371. data/src/cxx_supportlib/vendor-copy/libuv/include/uv.h +528 -40
  372. data/src/cxx_supportlib/vendor-copy/libuv/install-sh +110 -70
  373. data/src/cxx_supportlib/vendor-copy/libuv/libuv-static.pc.in +12 -0
  374. data/src/cxx_supportlib/vendor-copy/libuv/libuv.pc.in +4 -2
  375. data/src/cxx_supportlib/vendor-copy/libuv/ltmain.sh +995 -619
  376. data/src/cxx_supportlib/vendor-copy/libuv/m4/ax_pthread.m4 +485 -0
  377. data/src/cxx_supportlib/vendor-copy/libuv/m4/libtool.m4 +438 -289
  378. data/src/cxx_supportlib/vendor-copy/libuv/m4/libuv-check-flags.m4 +21 -4
  379. data/src/cxx_supportlib/vendor-copy/libuv/m4/libuv-check-versions.m4 +7 -0
  380. data/src/cxx_supportlib/vendor-copy/libuv/m4/ltoptions.m4 +69 -39
  381. data/src/cxx_supportlib/vendor-copy/libuv/m4/ltsugar.m4 +1 -1
  382. data/src/cxx_supportlib/vendor-copy/libuv/m4/ltversion.m4 +7 -6
  383. data/src/cxx_supportlib/vendor-copy/libuv/m4/lt~obsolete.m4 +2 -2
  384. data/src/cxx_supportlib/vendor-copy/libuv/missing +55 -34
  385. data/src/cxx_supportlib/vendor-copy/libuv/src/fs-poll.c +52 -20
  386. data/src/cxx_supportlib/vendor-copy/libuv/src/idna.c +560 -0
  387. data/src/cxx_supportlib/vendor-copy/libuv/src/idna.h +31 -0
  388. data/src/cxx_supportlib/vendor-copy/libuv/src/inet.c +5 -16
  389. data/src/cxx_supportlib/vendor-copy/libuv/src/queue.h +68 -86
  390. data/src/cxx_supportlib/vendor-copy/libuv/src/random.c +123 -0
  391. data/src/cxx_supportlib/vendor-copy/libuv/src/strscpy.c +38 -0
  392. data/src/cxx_supportlib/vendor-copy/libuv/src/strscpy.h +39 -0
  393. data/src/cxx_supportlib/vendor-copy/libuv/src/strtok.c +52 -0
  394. data/src/cxx_supportlib/vendor-copy/libuv/src/strtok.h +27 -0
  395. data/src/cxx_supportlib/vendor-copy/libuv/src/thread-common.c +175 -0
  396. data/src/cxx_supportlib/vendor-copy/libuv/src/threadpool.c +172 -57
  397. data/src/cxx_supportlib/vendor-copy/libuv/src/{unix/timer.c → timer.c} +57 -29
  398. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/aix-common.c +89 -0
  399. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/aix.c +418 -256
  400. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/async.c +168 -129
  401. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/bsd-ifaddrs.c +163 -0
  402. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/bsd-proctitle.c +99 -0
  403. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/core.c +1312 -378
  404. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/cygwin.c +93 -0
  405. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin-proctitle.c +18 -32
  406. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin-stub.h +97 -0
  407. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin-syscalls.h +17 -0
  408. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin.c +41 -139
  409. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/dl.c +1 -1
  410. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/freebsd.c +75 -235
  411. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/fs.c +1308 -299
  412. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/fsevents.c +150 -148
  413. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/getaddrinfo.c +58 -8
  414. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/getnameinfo.c +3 -2
  415. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/haiku.c +172 -0
  416. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/hurd.c +172 -0
  417. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/ibmi.c +542 -0
  418. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/internal.h +297 -106
  419. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/kqueue.c +325 -94
  420. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux.c +2708 -0
  421. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/loop-watcher.c +11 -11
  422. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/loop.c +105 -24
  423. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/netbsd.c +51 -157
  424. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/no-fsevents.c +42 -0
  425. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/no-proctitle.c +45 -0
  426. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/openbsd.c +42 -183
  427. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390-proctitle.c +136 -0
  428. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390-syscalls.c +536 -0
  429. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390-syscalls.h +75 -0
  430. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390.c +1070 -0
  431. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/pipe.c +324 -55
  432. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/poll.c +58 -11
  433. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/posix-hrtime.c +36 -0
  434. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/posix-poll.c +385 -0
  435. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/process.c +795 -248
  436. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/procfs-exepath.c +45 -0
  437. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/proctitle.c +77 -22
  438. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/qnx.c +142 -0
  439. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-devurandom.c +93 -0
  440. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-getentropy.c +57 -0
  441. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-getrandom.c +86 -0
  442. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-sysctl-linux.c +99 -0
  443. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/signal.c +147 -39
  444. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/stream.c +426 -474
  445. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sunos.c +240 -98
  446. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sysinfo-loadavg.c +36 -0
  447. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sysinfo-memory.c +42 -0
  448. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/tcp.c +402 -91
  449. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/thread.c +497 -145
  450. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/tty.c +269 -45
  451. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/udp.c +695 -165
  452. data/src/cxx_supportlib/vendor-copy/libuv/src/uv-common.c +463 -61
  453. data/src/cxx_supportlib/vendor-copy/libuv/src/uv-common.h +248 -44
  454. data/src/cxx_supportlib/vendor-copy/libuv/src/uv-data-getter-setters.c +119 -0
  455. data/src/cxx_supportlib/vendor-copy/libuv/tsansupp.txt +2 -0
  456. data/src/cxx_supportlib/vendor-modified/libev/Changes +109 -0
  457. data/src/cxx_supportlib/vendor-modified/libev/Makefile.am +2 -1
  458. data/src/cxx_supportlib/vendor-modified/libev/Makefile.in +47 -33
  459. data/src/cxx_supportlib/vendor-modified/libev/README +2 -1
  460. data/src/cxx_supportlib/vendor-modified/libev/aclocal.m4 +1653 -1224
  461. data/src/cxx_supportlib/vendor-modified/libev/config.guess +376 -316
  462. data/src/cxx_supportlib/vendor-modified/libev/config.h.in +13 -2
  463. data/src/cxx_supportlib/vendor-modified/libev/config.sub +156 -154
  464. data/src/cxx_supportlib/vendor-modified/libev/configure +1431 -940
  465. data/src/cxx_supportlib/vendor-modified/libev/configure.ac +3 -3
  466. data/src/cxx_supportlib/vendor-modified/libev/depcomp +5 -5
  467. data/src/cxx_supportlib/vendor-modified/libev/ev++.h +109 -107
  468. data/src/cxx_supportlib/vendor-modified/libev/ev.c +807 -319
  469. data/src/cxx_supportlib/vendor-modified/libev/ev.h +111 -105
  470. data/src/cxx_supportlib/vendor-modified/libev/ev_epoll.c +42 -29
  471. data/src/cxx_supportlib/vendor-modified/libev/ev_iouring.c +694 -0
  472. data/src/cxx_supportlib/vendor-modified/libev/ev_kqueue.c +15 -9
  473. data/src/cxx_supportlib/vendor-modified/libev/ev_linuxaio.c +620 -0
  474. data/src/cxx_supportlib/vendor-modified/libev/ev_poll.c +19 -14
  475. data/src/cxx_supportlib/vendor-modified/libev/ev_port.c +8 -5
  476. data/src/cxx_supportlib/vendor-modified/libev/ev_select.c +6 -6
  477. data/src/cxx_supportlib/vendor-modified/libev/ev_vars.h +48 -3
  478. data/src/cxx_supportlib/vendor-modified/libev/ev_win32.c +2 -2
  479. data/src/cxx_supportlib/vendor-modified/libev/ev_wrap.h +72 -0
  480. data/src/cxx_supportlib/vendor-modified/libev/install-sh +23 -13
  481. data/src/cxx_supportlib/vendor-modified/libev/libev.m4 +6 -1
  482. data/src/cxx_supportlib/vendor-modified/libev/ltmain.sh +3581 -1993
  483. data/src/cxx_supportlib/vendor-modified/libev/missing +8 -8
  484. data/src/cxx_supportlib/vendor-modified/libev/mkinstalldirs +3 -3
  485. data/src/cxx_supportlib/vendor-modified/modp_b64_strict_aliasing.cpp +1 -1
  486. data/src/helper-scripts/backtrace-sanitizer.rb +1 -1
  487. data/src/helper-scripts/crash-watch.rb +1 -1
  488. data/src/helper-scripts/download_binaries/extconf.rb +1 -1
  489. data/src/helper-scripts/meteor-loader.rb +1 -1
  490. data/src/helper-scripts/node-loader.js +1 -1
  491. data/src/helper-scripts/prespawn +1 -1
  492. data/src/helper-scripts/rack-loader.rb +1 -1
  493. data/src/helper-scripts/rack-preloader.rb +1 -1
  494. data/src/helper-scripts/wsgi-loader.py +1 -1
  495. data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +1 -1
  496. data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c.cxxcodebuilder +1 -1
  497. data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +1 -1
  498. data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c.cxxcodebuilder +1 -1
  499. data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +1 -1
  500. data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c.cxxcodebuilder +1 -1
  501. data/src/nginx_module/Configuration.c +1 -1
  502. data/src/nginx_module/Configuration.h +1 -1
  503. data/src/nginx_module/ContentHandler.c +1 -1
  504. data/src/nginx_module/ContentHandler.h +1 -1
  505. data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +1 -1
  506. data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c.cxxcodebuilder +1 -1
  507. data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c +1 -1
  508. data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c.cxxcodebuilder +1 -1
  509. data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +1 -1
  510. data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c.cxxcodebuilder +1 -1
  511. data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +1 -1
  512. data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c.cxxcodebuilder +1 -1
  513. data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +1 -1
  514. data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
  515. data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +1 -1
  516. data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c.cxxcodebuilder +1 -1
  517. data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +1 -1
  518. data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c.cxxcodebuilder +1 -1
  519. data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +1 -1
  520. data/src/nginx_module/MainConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
  521. data/src/nginx_module/StaticContentHandler.c +1 -1
  522. data/src/nginx_module/StaticContentHandler.h +1 -1
  523. data/src/nginx_module/ngx_http_passenger_module.c +1 -1
  524. data/src/nginx_module/ngx_http_passenger_module.h +1 -1
  525. data/src/nodejs_supportlib/phusion_passenger/line_reader.js +1 -1
  526. data/src/ruby_native_extension/extconf.rb +1 -1
  527. data/src/ruby_native_extension/passenger_native_support.c +1 -1
  528. data/src/ruby_supportlib/phusion_passenger/abstract_installer.rb +1 -1
  529. data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +1 -1
  530. data/src/ruby_supportlib/phusion_passenger/admin_tools/instance_registry.rb +1 -1
  531. data/src/ruby_supportlib/phusion_passenger/admin_tools/memory_stats.rb +2 -12
  532. data/src/ruby_supportlib/phusion_passenger/admin_tools.rb +1 -1
  533. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +1 -1
  534. data/src/ruby_supportlib/phusion_passenger/apache2/config_utils.rb +1 -1
  535. data/src/ruby_supportlib/phusion_passenger/common_library.rb +8 -10
  536. data/src/ruby_supportlib/phusion_passenger/config/about_command.rb +1 -1
  537. data/src/ruby_supportlib/phusion_passenger/config/agent_compiler.rb +1 -1
  538. data/src/ruby_supportlib/phusion_passenger/config/api_call_command.rb +1 -1
  539. data/src/ruby_supportlib/phusion_passenger/config/build_native_support_command.rb +1 -1
  540. data/src/ruby_supportlib/phusion_passenger/config/command.rb +1 -1
  541. data/src/ruby_supportlib/phusion_passenger/config/compile_agent_command.rb +1 -1
  542. data/src/ruby_supportlib/phusion_passenger/config/compile_nginx_engine_command.rb +1 -1
  543. data/src/ruby_supportlib/phusion_passenger/config/detach_process_command.rb +1 -1
  544. data/src/ruby_supportlib/phusion_passenger/config/download_agent_command.rb +1 -1
  545. data/src/ruby_supportlib/phusion_passenger/config/download_nginx_engine_command.rb +1 -1
  546. data/src/ruby_supportlib/phusion_passenger/config/install_agent_command.rb +1 -1
  547. data/src/ruby_supportlib/phusion_passenger/config/install_standalone_runtime_command.rb +1 -1
  548. data/src/ruby_supportlib/phusion_passenger/config/installation_utils.rb +1 -1
  549. data/src/ruby_supportlib/phusion_passenger/config/list_instances_command.rb +1 -1
  550. data/src/ruby_supportlib/phusion_passenger/config/main.rb +1 -1
  551. data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +3 -2
  552. data/src/ruby_supportlib/phusion_passenger/config/reopen_logs_command.rb +6 -1
  553. data/src/ruby_supportlib/phusion_passenger/config/restart_app_command.rb +1 -1
  554. data/src/ruby_supportlib/phusion_passenger/config/system_metrics_command.rb +1 -1
  555. data/src/ruby_supportlib/phusion_passenger/config/system_properties_command.rb +1 -1
  556. data/src/ruby_supportlib/phusion_passenger/config/utils.rb +1 -1
  557. data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +1 -1
  558. data/src/ruby_supportlib/phusion_passenger/console_text_template.rb +1 -1
  559. data/src/ruby_supportlib/phusion_passenger/constants.rb +1 -1
  560. data/src/ruby_supportlib/phusion_passenger/debug_logging.rb +1 -1
  561. data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +1 -1
  562. data/src/ruby_supportlib/phusion_passenger/message_channel.rb +1 -1
  563. data/src/ruby_supportlib/phusion_passenger/message_client.rb +1 -1
  564. data/src/ruby_supportlib/phusion_passenger/native_support.rb +1 -1
  565. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +1 -1
  566. data/src/ruby_supportlib/phusion_passenger/packaging.rb +4 -3
  567. data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +1 -1
  568. data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +1 -1
  569. data/src/ruby_supportlib/phusion_passenger/platform_info/binary_compatibility.rb +1 -1
  570. data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +195 -11
  571. data/src/ruby_supportlib/phusion_passenger/platform_info/crypto.rb +1 -1
  572. data/src/ruby_supportlib/phusion_passenger/platform_info/curl.rb +1 -1
  573. data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +1 -1
  574. data/src/ruby_supportlib/phusion_passenger/platform_info/linux.rb +1 -1
  575. data/src/ruby_supportlib/phusion_passenger/platform_info/networking.rb +1 -1
  576. data/src/ruby_supportlib/phusion_passenger/platform_info/openssl.rb +1 -1
  577. data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +1 -1
  578. data/src/ruby_supportlib/phusion_passenger/platform_info/pcre.rb +1 -1
  579. data/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb +1 -1
  580. data/src/ruby_supportlib/phusion_passenger/platform_info/zlib.rb +1 -1
  581. data/src/ruby_supportlib/phusion_passenger/platform_info.rb +1 -1
  582. data/src/ruby_supportlib/phusion_passenger/plugin.rb +1 -1
  583. data/src/ruby_supportlib/phusion_passenger/preloader_shared_helpers.rb +1 -1
  584. data/src/ruby_supportlib/phusion_passenger/public_api.rb +1 -1
  585. data/src/ruby_supportlib/phusion_passenger/rack/handler.rb +1 -1
  586. data/src/ruby_supportlib/phusion_passenger/rack/out_of_band_gc.rb +1 -1
  587. data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
  588. data/src/ruby_supportlib/phusion_passenger/rack_handler.rb +1 -1
  589. data/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb +2 -7
  590. data/src/ruby_supportlib/phusion_passenger/request_handler.rb +1 -1
  591. data/src/ruby_supportlib/phusion_passenger/ruby_core_enhancements.rb +1 -1
  592. data/src/ruby_supportlib/phusion_passenger/ruby_core_io_enhancements.rb +1 -1
  593. data/src/ruby_supportlib/phusion_passenger/simple_benchmarking.rb +1 -1
  594. data/src/ruby_supportlib/phusion_passenger/standalone/app_finder.rb +1 -1
  595. data/src/ruby_supportlib/phusion_passenger/standalone/command.rb +1 -1
  596. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +1 -1
  597. data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +1 -1
  598. data/src/ruby_supportlib/phusion_passenger/standalone/control_utils.rb +1 -1
  599. data/src/ruby_supportlib/phusion_passenger/standalone/main.rb +1 -1
  600. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +2 -2
  601. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +4 -8
  602. data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +1 -1
  603. data/src/ruby_supportlib/phusion_passenger/standalone/status_command.rb +1 -1
  604. data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +1 -1
  605. data/src/ruby_supportlib/phusion_passenger/standalone/version_command.rb +1 -1
  606. data/src/ruby_supportlib/phusion_passenger/utils/ansi_colors.rb +1 -1
  607. data/src/ruby_supportlib/phusion_passenger/utils/download.rb +1 -1
  608. data/src/ruby_supportlib/phusion_passenger/utils/file_system_watcher.rb +1 -1
  609. data/src/ruby_supportlib/phusion_passenger/utils/hosts_file_parser.rb +1 -1
  610. data/src/ruby_supportlib/phusion_passenger/utils/lock.rb +1 -1
  611. data/src/ruby_supportlib/phusion_passenger/utils/native_support_utils.rb +1 -1
  612. data/src/ruby_supportlib/phusion_passenger/utils/progress_bar.rb +1 -1
  613. data/src/ruby_supportlib/phusion_passenger/utils/strscan.rb +1 -1
  614. data/src/ruby_supportlib/phusion_passenger/utils/terminal_choice_menu.rb +1 -1
  615. data/src/ruby_supportlib/phusion_passenger/utils/unseekable_socket.rb +3 -13
  616. data/src/ruby_supportlib/phusion_passenger/utils.rb +1 -1
  617. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/app.rb +1 -1
  618. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/base.rb +1 -1
  619. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/gdb_controller.rb +1 -1
  620. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/lldb_controller.rb +1 -1
  621. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/utils.rb +1 -1
  622. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/version.rb +1 -1
  623. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/lock_file.rb +8 -6
  624. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/spawn.rb +4 -3
  625. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/version.rb +6 -4
  626. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb +395 -579
  627. data/src/ruby_supportlib/phusion_passenger.rb +8 -8
  628. data/src/schema_printer/SchemaPrinterMain.cpp +1 -1
  629. data/src/schema_printer/SchemaPrinterMain.cpp.cxxcodebuilder +1 -1
  630. metadata +69 -32
  631. data/doc/DeveloperQuickstart.md +0 -70
  632. data/src/README.md +0 -7
  633. data/src/cxx_supportlib/vendor-copy/libuv/README.md +0 -245
  634. data/src/cxx_supportlib/vendor-copy/libuv/checksparse.sh +0 -234
  635. data/src/cxx_supportlib/vendor-copy/libuv/common.gypi +0 -210
  636. data/src/cxx_supportlib/vendor-copy/libuv/gyp_uv.py +0 -93
  637. data/src/cxx_supportlib/vendor-copy/libuv/include/android-ifaddrs.h +0 -54
  638. data/src/cxx_supportlib/vendor-copy/libuv/include/pthread-fixes.h +0 -72
  639. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/android-ifaddrs.c +0 -703
  640. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/atomic-ops.h +0 -77
  641. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-core.c +0 -899
  642. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-inotify.c +0 -285
  643. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-syscalls.c +0 -471
  644. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-syscalls.h +0 -158
  645. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/pthread-fixes.c +0 -104
  646. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/spinlock.h +0 -53
  647. data/src/cxx_supportlib/vendor-copy/libuv/uv.gyp +0 -508
  648. /data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-aix.h → uv/aix.h} +0 -0
  649. /data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-bsd.h → uv/bsd.h} +0 -0
  650. /data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-sunos.h → uv/sunos.h} +0 -0
@@ -30,17 +30,31 @@
30
30
  #include <sys/types.h>
31
31
  #include <sys/event.h>
32
32
  #include <sys/time.h>
33
+ #if defined(__FreeBSD__)
34
+ #include <sys/user.h>
35
+ #endif
33
36
  #include <unistd.h>
34
37
  #include <fcntl.h>
35
38
  #include <time.h>
36
39
 
40
+ /*
41
+ * Required on
42
+ * - Until at least FreeBSD 11.0
43
+ * - Older versions of Mac OS X
44
+ *
45
+ * http://www.boost.org/doc/libs/1_61_0/boost/asio/detail/kqueue_reactor.hpp
46
+ */
47
+ #ifndef EV_OOBAND
48
+ #define EV_OOBAND EV_FLAG1
49
+ #endif
50
+
37
51
  static void uv__fs_event(uv_loop_t* loop, uv__io_t* w, unsigned int fflags);
38
52
 
39
53
 
40
54
  int uv__kqueue_init(uv_loop_t* loop) {
41
55
  loop->backend_fd = kqueue();
42
56
  if (loop->backend_fd == -1)
43
- return -errno;
57
+ return UV__ERR(errno);
44
58
 
45
59
  uv__cloexec(loop->backend_fd, 1);
46
60
 
@@ -48,18 +62,121 @@ int uv__kqueue_init(uv_loop_t* loop) {
48
62
  }
49
63
 
50
64
 
65
+ #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
66
+ static _Atomic int uv__has_forked_with_cfrunloop;
67
+ #endif
68
+
69
+ int uv__io_fork(uv_loop_t* loop) {
70
+ int err;
71
+ loop->backend_fd = -1;
72
+ err = uv__kqueue_init(loop);
73
+ if (err)
74
+ return err;
75
+
76
+ #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
77
+ if (loop->cf_state != NULL) {
78
+ /* We cannot start another CFRunloop and/or thread in the child
79
+ process; CF aborts if you try or if you try to touch the thread
80
+ at all to kill it. So the best we can do is ignore it from now
81
+ on. This means we can't watch directories in the same way
82
+ anymore (like other BSDs). It also means we cannot properly
83
+ clean up the allocated resources; calling
84
+ uv__fsevents_loop_delete from uv_loop_close will crash the
85
+ process. So we sidestep the issue by pretending like we never
86
+ started it in the first place.
87
+ */
88
+ atomic_store_explicit(&uv__has_forked_with_cfrunloop,
89
+ 1,
90
+ memory_order_relaxed);
91
+ uv__free(loop->cf_state);
92
+ loop->cf_state = NULL;
93
+ }
94
+ #endif /* #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 */
95
+ return err;
96
+ }
97
+
98
+
99
+ int uv__io_check_fd(uv_loop_t* loop, int fd) {
100
+ struct kevent ev;
101
+ int rc;
102
+ struct stat sb;
103
+ #ifdef __APPLE__
104
+ char path[MAXPATHLEN];
105
+ #endif
106
+
107
+ if (uv__fstat(fd, &sb))
108
+ return UV__ERR(errno);
109
+
110
+ /* On FreeBSD, kqueue only supports EVFILT_READ notification for regular files
111
+ * and always reports ready events for writing, resulting in busy-looping.
112
+ *
113
+ * On Darwin, DragonFlyBSD, NetBSD and OpenBSD, kqueue reports ready events for
114
+ * regular files as readable and writable only once, acting like an EV_ONESHOT.
115
+ *
116
+ * Neither of the above cases should be added to the kqueue.
117
+ */
118
+ if (S_ISREG(sb.st_mode) || S_ISDIR(sb.st_mode))
119
+ return UV_EINVAL;
120
+
121
+ #ifdef __APPLE__
122
+ /* On Darwin (both macOS and iOS), in addition to regular files, FIFOs also don't
123
+ * work properly with kqueue: the disconnection from the last writer won't trigger
124
+ * an event for kqueue in spite of what the man pages say. Thus, we also disallow
125
+ * the case of S_IFIFO. */
126
+ if (S_ISFIFO(sb.st_mode)) {
127
+ /* File descriptors of FIFO, pipe and kqueue share the same type of file,
128
+ * therefore there is no way to tell them apart via stat.st_mode&S_IFMT.
129
+ * Fortunately, FIFO is the only one that has a persisted file on filesystem,
130
+ * from which we're able to make the distinction for it. */
131
+ if (!fcntl(fd, F_GETPATH, path))
132
+ return UV_EINVAL;
133
+ }
134
+ #endif
135
+
136
+ rc = 0;
137
+ EV_SET(&ev, fd, EVFILT_READ, EV_ADD, 0, 0, 0);
138
+ if (kevent(loop->backend_fd, &ev, 1, NULL, 0, NULL))
139
+ rc = UV__ERR(errno);
140
+
141
+ EV_SET(&ev, fd, EVFILT_READ, EV_DELETE, 0, 0, 0);
142
+ if (rc == 0)
143
+ if (kevent(loop->backend_fd, &ev, 1, NULL, 0, NULL))
144
+ abort();
145
+
146
+ return rc;
147
+ }
148
+
149
+
150
+ static void uv__kqueue_delete(int kqfd, const struct kevent *ev) {
151
+ struct kevent change;
152
+
153
+ EV_SET(&change, ev->ident, ev->filter, EV_DELETE, 0, 0, 0);
154
+
155
+ if (0 == kevent(kqfd, &change, 1, NULL, 0, NULL))
156
+ return;
157
+
158
+ if (errno == EBADF || errno == ENOENT)
159
+ return;
160
+
161
+ abort();
162
+ }
163
+
164
+
51
165
  void uv__io_poll(uv_loop_t* loop, int timeout) {
166
+ uv__loop_internal_fields_t* lfields;
52
167
  struct kevent events[1024];
53
168
  struct kevent* ev;
54
169
  struct timespec spec;
55
170
  unsigned int nevents;
56
171
  unsigned int revents;
57
- QUEUE* q;
172
+ struct uv__queue* q;
58
173
  uv__io_t* w;
174
+ uv_process_t* process;
59
175
  sigset_t* pset;
60
176
  sigset_t set;
61
177
  uint64_t base;
62
178
  uint64_t diff;
179
+ int have_signals;
63
180
  int filter;
64
181
  int fflags;
65
182
  int count;
@@ -67,25 +184,28 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
67
184
  int fd;
68
185
  int op;
69
186
  int i;
187
+ int user_timeout;
188
+ int reset_timeout;
70
189
 
71
190
  if (loop->nfds == 0) {
72
- assert(QUEUE_EMPTY(&loop->watcher_queue));
191
+ assert(uv__queue_empty(&loop->watcher_queue));
73
192
  return;
74
193
  }
75
194
 
195
+ lfields = uv__get_internal_fields(loop);
76
196
  nevents = 0;
77
197
 
78
- while (!QUEUE_EMPTY(&loop->watcher_queue)) {
79
- q = QUEUE_HEAD(&loop->watcher_queue);
80
- QUEUE_REMOVE(q);
81
- QUEUE_INIT(q);
198
+ while (!uv__queue_empty(&loop->watcher_queue)) {
199
+ q = uv__queue_head(&loop->watcher_queue);
200
+ uv__queue_remove(q);
201
+ uv__queue_init(q);
82
202
 
83
- w = QUEUE_DATA(q, uv__io_t, watcher_queue);
203
+ w = uv__queue_data(q, uv__io_t, watcher_queue);
84
204
  assert(w->pevents != 0);
85
205
  assert(w->fd >= 0);
86
206
  assert(w->fd < (int) loop->nwatchers);
87
207
 
88
- if ((w->events & UV__POLLIN) == 0 && (w->pevents & UV__POLLIN) != 0) {
208
+ if ((w->events & POLLIN) == 0 && (w->pevents & POLLIN) != 0) {
89
209
  filter = EVFILT_READ;
90
210
  fflags = 0;
91
211
  op = EV_ADD;
@@ -106,7 +226,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
106
226
  }
107
227
  }
108
228
 
109
- if ((w->events & UV__POLLOUT) == 0 && (w->pevents & UV__POLLOUT) != 0) {
229
+ if ((w->events & POLLOUT) == 0 && (w->pevents & POLLOUT) != 0) {
110
230
  EV_SET(events + nevents, w->fd, EVFILT_WRITE, EV_ADD, 0, 0, 0);
111
231
 
112
232
  if (++nevents == ARRAY_SIZE(events)) {
@@ -116,6 +236,16 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
116
236
  }
117
237
  }
118
238
 
239
+ if ((w->events & UV__POLLPRI) == 0 && (w->pevents & UV__POLLPRI) != 0) {
240
+ EV_SET(events + nevents, w->fd, EV_OOBAND, EV_ADD, 0, 0, 0);
241
+
242
+ if (++nevents == ARRAY_SIZE(events)) {
243
+ if (kevent(loop->backend_fd, events, nevents, NULL, 0, NULL))
244
+ abort();
245
+ nevents = 0;
246
+ }
247
+ }
248
+
119
249
  w->events = w->pevents;
120
250
  }
121
251
 
@@ -130,7 +260,21 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
130
260
  base = loop->time;
131
261
  count = 48; /* Benchmarks suggest this gives the best throughput. */
132
262
 
263
+ if (lfields->flags & UV_METRICS_IDLE_TIME) {
264
+ reset_timeout = 1;
265
+ user_timeout = timeout;
266
+ timeout = 0;
267
+ } else {
268
+ reset_timeout = 0;
269
+ }
270
+
133
271
  for (;; nevents = 0) {
272
+ /* Only need to set the provider_entry_time if timeout != 0. The function
273
+ * will return early if the loop isn't configured with UV_METRICS_IDLE_TIME.
274
+ */
275
+ if (timeout != 0)
276
+ uv__metrics_set_provider_entry_time(loop);
277
+
134
278
  if (timeout != -1) {
135
279
  spec.tv_sec = timeout / 1000;
136
280
  spec.tv_nsec = (timeout % 1000) * 1000000;
@@ -139,6 +283,12 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
139
283
  if (pset != NULL)
140
284
  pthread_sigmask(SIG_BLOCK, pset, NULL);
141
285
 
286
+ /* Store the current timeout in a location that's globally accessible so
287
+ * other locations like uv__work_done() can determine whether the queue
288
+ * of events in the callback were waiting when poll was called.
289
+ */
290
+ lfields->current_timeout = timeout;
291
+
142
292
  nfds = kevent(loop->backend_fd,
143
293
  events,
144
294
  nevents,
@@ -146,6 +296,12 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
146
296
  ARRAY_SIZE(events),
147
297
  timeout == -1 ? NULL : &spec);
148
298
 
299
+ if (nfds == -1)
300
+ assert(errno == EINTR);
301
+ else if (nfds == 0)
302
+ /* Unlimited timeout should only return with events or signal. */
303
+ assert(timeout != -1);
304
+
149
305
  if (pset != NULL)
150
306
  pthread_sigmask(SIG_UNBLOCK, pset, NULL);
151
307
 
@@ -153,27 +309,30 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
153
309
  * timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the
154
310
  * operating system didn't reschedule our process while in the syscall.
155
311
  */
156
- SAVE_ERRNO(uv__update_time(loop));
157
-
158
- if (nfds == 0) {
159
- assert(timeout != -1);
160
- return;
161
- }
162
-
163
- if (nfds == -1) {
164
- if (errno != EINTR)
165
- abort();
312
+ uv__update_time(loop);
313
+
314
+ if (nfds == 0 || nfds == -1) {
315
+ /* If kqueue is empty or interrupted, we might still have children ready
316
+ * to reap immediately. */
317
+ if (loop->flags & UV_LOOP_REAP_CHILDREN) {
318
+ loop->flags &= ~UV_LOOP_REAP_CHILDREN;
319
+ uv__wait_children(loop);
320
+ assert((reset_timeout == 0 ? timeout : user_timeout) == 0);
321
+ return; /* Equivalent to fall-through behavior. */
322
+ }
166
323
 
167
- if (timeout == 0)
324
+ if (reset_timeout != 0) {
325
+ timeout = user_timeout;
326
+ reset_timeout = 0;
327
+ } else if (nfds == 0) {
168
328
  return;
169
-
170
- if (timeout == -1)
171
- continue;
329
+ }
172
330
 
173
331
  /* Interrupted by a signal. Update timeout and poll again. */
174
332
  goto update_timeout;
175
333
  }
176
334
 
335
+ have_signals = 0;
177
336
  nevents = 0;
178
337
 
179
338
  assert(loop->watchers != NULL);
@@ -182,6 +341,21 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
182
341
  for (i = 0; i < nfds; i++) {
183
342
  ev = events + i;
184
343
  fd = ev->ident;
344
+
345
+ /* Handle kevent NOTE_EXIT results */
346
+ if (ev->filter == EVFILT_PROC) {
347
+ uv__queue_foreach(q, &loop->process_handles) {
348
+ process = uv__queue_data(q, uv_process_t, queue);
349
+ if (process->pid == fd) {
350
+ process->flags |= UV_HANDLE_REAP;
351
+ loop->flags |= UV_LOOP_REAP_CHILDREN;
352
+ break;
353
+ }
354
+ }
355
+ nevents++;
356
+ continue;
357
+ }
358
+
185
359
  /* Skip invalidated events, see uv__platform_invalidate_fd */
186
360
  if (fd == -1)
187
361
  continue;
@@ -189,20 +363,14 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
189
363
 
190
364
  if (w == NULL) {
191
365
  /* File descriptor that we've stopped watching, disarm it. */
192
- /* TODO batch up */
193
- struct kevent events[1];
194
-
195
- EV_SET(events + 0, fd, ev->filter, EV_DELETE, 0, 0, 0);
196
- if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL))
197
- if (errno != EBADF && errno != ENOENT)
198
- abort();
199
-
366
+ uv__kqueue_delete(loop->backend_fd, ev);
200
367
  continue;
201
368
  }
202
369
 
203
370
  if (ev->filter == EVFILT_VNODE) {
204
- assert(w->events == UV__POLLIN);
205
- assert(w->pevents == UV__POLLIN);
371
+ assert(w->events == POLLIN);
372
+ assert(w->pevents == POLLIN);
373
+ uv__metrics_update_idle_time(loop);
206
374
  w->cb(loop, w, ev->fflags); /* XXX always uv__fs_event() */
207
375
  nevents++;
208
376
  continue;
@@ -211,45 +379,71 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
211
379
  revents = 0;
212
380
 
213
381
  if (ev->filter == EVFILT_READ) {
214
- if (w->pevents & UV__POLLIN) {
215
- revents |= UV__POLLIN;
216
- w->rcount = ev->data;
217
- } else {
218
- /* TODO batch up */
219
- struct kevent events[1];
220
- EV_SET(events + 0, fd, ev->filter, EV_DELETE, 0, 0, 0);
221
- if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL))
222
- if (errno != ENOENT)
223
- abort();
224
- }
382
+ if (w->pevents & POLLIN)
383
+ revents |= POLLIN;
384
+ else
385
+ uv__kqueue_delete(loop->backend_fd, ev);
386
+
387
+ if ((ev->flags & EV_EOF) && (w->pevents & UV__POLLRDHUP))
388
+ revents |= UV__POLLRDHUP;
389
+ }
390
+
391
+ if (ev->filter == EV_OOBAND) {
392
+ if (w->pevents & UV__POLLPRI)
393
+ revents |= UV__POLLPRI;
394
+ else
395
+ uv__kqueue_delete(loop->backend_fd, ev);
225
396
  }
226
397
 
227
398
  if (ev->filter == EVFILT_WRITE) {
228
- if (w->pevents & UV__POLLOUT) {
229
- revents |= UV__POLLOUT;
230
- w->wcount = ev->data;
231
- } else {
232
- /* TODO batch up */
233
- struct kevent events[1];
234
- EV_SET(events + 0, fd, ev->filter, EV_DELETE, 0, 0, 0);
235
- if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL))
236
- if (errno != ENOENT)
237
- abort();
238
- }
399
+ if (w->pevents & POLLOUT)
400
+ revents |= POLLOUT;
401
+ else
402
+ uv__kqueue_delete(loop->backend_fd, ev);
239
403
  }
240
404
 
241
405
  if (ev->flags & EV_ERROR)
242
- revents |= UV__POLLERR;
406
+ revents |= POLLERR;
243
407
 
244
408
  if (revents == 0)
245
409
  continue;
246
410
 
247
- w->cb(loop, w, revents);
411
+ /* Run signal watchers last. This also affects child process watchers
412
+ * because those are implemented in terms of signal watchers.
413
+ */
414
+ if (w == &loop->signal_io_watcher) {
415
+ have_signals = 1;
416
+ } else {
417
+ uv__metrics_update_idle_time(loop);
418
+ w->cb(loop, w, revents);
419
+ }
420
+
248
421
  nevents++;
249
422
  }
423
+
424
+ if (loop->flags & UV_LOOP_REAP_CHILDREN) {
425
+ loop->flags &= ~UV_LOOP_REAP_CHILDREN;
426
+ uv__wait_children(loop);
427
+ }
428
+
429
+ uv__metrics_inc_events(loop, nevents);
430
+ if (reset_timeout != 0) {
431
+ timeout = user_timeout;
432
+ reset_timeout = 0;
433
+ uv__metrics_inc_events_waiting(loop, nevents);
434
+ }
435
+
436
+ if (have_signals != 0) {
437
+ uv__metrics_update_idle_time(loop);
438
+ loop->signal_io_watcher.cb(loop, &loop->signal_io_watcher, POLLIN);
439
+ }
440
+
250
441
  loop->watchers[loop->nwatchers] = NULL;
251
442
  loop->watchers[loop->nwatchers + 1] = NULL;
252
443
 
444
+ if (have_signals != 0)
445
+ return; /* Event loop should cycle now so don't poll again. */
446
+
253
447
  if (nevents != 0) {
254
448
  if (nfds == ARRAY_SIZE(events) && --count != 0) {
255
449
  /* Poll for more events but don't block this time. */
@@ -259,13 +453,13 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
259
453
  return;
260
454
  }
261
455
 
456
+ update_timeout:
262
457
  if (timeout == 0)
263
458
  return;
264
459
 
265
460
  if (timeout == -1)
266
461
  continue;
267
462
 
268
- update_timeout:
269
463
  assert(timeout > 0);
270
464
 
271
465
  diff = loop->time - base;
@@ -283,6 +477,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
283
477
  uintptr_t nfds;
284
478
 
285
479
  assert(loop->watchers != NULL);
480
+ assert(fd >= 0);
286
481
 
287
482
  events = (struct kevent*) loop->watchers[loop->nwatchers];
288
483
  nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1];
@@ -291,7 +486,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
291
486
 
292
487
  /* Invalidate events with same file descriptor */
293
488
  for (i = 0; i < nfds; i++)
294
- if ((int) events[i].ident == fd)
489
+ if ((int) events[i].ident == fd && events[i].filter != EVFILT_PROC)
295
490
  events[i].ident = -1;
296
491
  }
297
492
 
@@ -321,6 +516,26 @@ static void uv__fs_event(uv_loop_t* loop, uv__io_t* w, unsigned int fflags) {
321
516
  */
322
517
  if (fcntl(handle->event_watcher.fd, F_GETPATH, pathbuf) == 0)
323
518
  path = uv__basename_r(pathbuf);
519
+ #elif defined(F_KINFO)
520
+ /* We try to get the file info reference from the file descriptor.
521
+ * the struct's kf_structsize must be initialised beforehand
522
+ * whether with the KINFO_FILE_SIZE constant or this way.
523
+ */
524
+ struct stat statbuf;
525
+ struct kinfo_file kf;
526
+
527
+ if (handle->event_watcher.fd != -1 &&
528
+ (!uv__fstat(handle->event_watcher.fd, &statbuf) && !(statbuf.st_mode & S_IFDIR))) {
529
+ /* we are purposely not using KINFO_FILE_SIZE here
530
+ * as it is not available on non intl archs
531
+ * and here it gives 1392 too on intel.
532
+ * anyway, the man page also mentions we can proceed
533
+ * this way.
534
+ */
535
+ kf.kf_structsize = sizeof(kf);
536
+ if (fcntl(handle->event_watcher.fd, F_KINFO, &kf) == 0)
537
+ path = uv__basename_r(kf.kf_path);
538
+ }
324
539
  #endif
325
540
  handle->cb(handle, path, events, 0);
326
541
 
@@ -348,76 +563,92 @@ int uv_fs_event_start(uv_fs_event_t* handle,
348
563
  uv_fs_event_cb cb,
349
564
  const char* path,
350
565
  unsigned int flags) {
351
- #if defined(__APPLE__)
352
- struct stat statbuf;
353
- #endif /* defined(__APPLE__) */
354
566
  int fd;
567
+ #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
568
+ struct stat statbuf;
569
+ #endif
355
570
 
356
571
  if (uv__is_active(handle))
357
- return -EINVAL;
358
-
359
- /* TODO open asynchronously - but how do we report back errors? */
360
- fd = open(path, O_RDONLY);
361
- if (fd == -1)
362
- return -errno;
572
+ return UV_EINVAL;
363
573
 
364
- uv__handle_start(handle);
365
- uv__io_init(&handle->event_watcher, uv__fs_event, fd);
366
- handle->path = uv__strdup(path);
367
574
  handle->cb = cb;
575
+ handle->path = uv__strdup(path);
576
+ if (handle->path == NULL)
577
+ return UV_ENOMEM;
368
578
 
369
- #if defined(__APPLE__)
579
+ /* TODO open asynchronously - but how do we report back errors? */
580
+ fd = open(handle->path, O_RDONLY);
581
+ if (fd == -1) {
582
+ uv__free(handle->path);
583
+ handle->path = NULL;
584
+ return UV__ERR(errno);
585
+ }
586
+
587
+ #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
370
588
  /* Nullify field to perform checks later */
371
589
  handle->cf_cb = NULL;
372
590
  handle->realpath = NULL;
373
591
  handle->realpath_len = 0;
374
592
  handle->cf_flags = flags;
375
593
 
376
- if (fstat(fd, &statbuf))
594
+ if (uv__fstat(fd, &statbuf))
377
595
  goto fallback;
378
596
  /* FSEvents works only with directories */
379
597
  if (!(statbuf.st_mode & S_IFDIR))
380
598
  goto fallback;
381
599
 
382
- /* The fallback fd is no longer needed */
383
- uv__close(fd);
384
- handle->event_watcher.fd = -1;
385
-
386
- return uv__fsevents_init(handle);
387
-
600
+ if (0 == atomic_load_explicit(&uv__has_forked_with_cfrunloop,
601
+ memory_order_relaxed)) {
602
+ int r;
603
+ /* The fallback fd is no longer needed */
604
+ uv__close_nocheckstdio(fd);
605
+ handle->event_watcher.fd = -1;
606
+ r = uv__fsevents_init(handle);
607
+ if (r == 0) {
608
+ uv__handle_start(handle);
609
+ } else {
610
+ uv__free(handle->path);
611
+ handle->path = NULL;
612
+ }
613
+ return r;
614
+ }
388
615
  fallback:
389
- #endif /* defined(__APPLE__) */
616
+ #endif /* #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 */
390
617
 
391
- uv__io_start(handle->loop, &handle->event_watcher, UV__POLLIN);
618
+ uv__handle_start(handle);
619
+ uv__io_init(&handle->event_watcher, uv__fs_event, fd);
620
+ uv__io_start(handle->loop, &handle->event_watcher, POLLIN);
392
621
 
393
622
  return 0;
394
623
  }
395
624
 
396
625
 
397
626
  int uv_fs_event_stop(uv_fs_event_t* handle) {
627
+ int r;
628
+ r = 0;
629
+
398
630
  if (!uv__is_active(handle))
399
631
  return 0;
400
632
 
401
633
  uv__handle_stop(handle);
402
634
 
403
- #if defined(__APPLE__)
404
- if (uv__fsevents_close(handle))
405
- #endif /* defined(__APPLE__) */
406
- {
407
- uv__io_close(handle->loop, &handle->event_watcher);
408
- }
409
-
410
- uv__free(handle->path);
411
- handle->path = NULL;
635
+ #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
636
+ if (0 == atomic_load_explicit(&uv__has_forked_with_cfrunloop,
637
+ memory_order_relaxed))
638
+ if (handle->cf_cb != NULL)
639
+ r = uv__fsevents_close(handle);
640
+ #endif
412
641
 
413
642
  if (handle->event_watcher.fd != -1) {
414
- /* When FSEvents is used, we don't use the event_watcher's fd under certain
415
- * confitions. (see uv_fs_event_start) */
643
+ uv__io_close(handle->loop, &handle->event_watcher);
416
644
  uv__close(handle->event_watcher.fd);
417
645
  handle->event_watcher.fd = -1;
418
646
  }
419
647
 
420
- return 0;
648
+ uv__free(handle->path);
649
+ handle->path = NULL;
650
+
651
+ return r;
421
652
  }
422
653
 
423
654