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
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libev event processing core, watcher management
3
3
  *
4
- * Copyright (c) 2007,2008,2009,2010,2011,2012,2013 Marc Alexander Lehmann <libev@schmorp.de>
4
+ * Copyright (c) 2007-2019 Marc Alexander Lehmann <libev@schmorp.de>
5
5
  * All rights reserved.
6
6
  *
7
7
  * Redistribution and use in source and binary forms, with or without modifica-
@@ -117,6 +117,24 @@
117
117
  # define EV_USE_EPOLL 0
118
118
  # endif
119
119
 
120
+ # if HAVE_LINUX_AIO_ABI_H
121
+ # ifndef EV_USE_LINUXAIO
122
+ # define EV_USE_LINUXAIO 0 /* was: EV_FEATURE_BACKENDS, always off by default */
123
+ # endif
124
+ # else
125
+ # undef EV_USE_LINUXAIO
126
+ # define EV_USE_LINUXAIO 0
127
+ # endif
128
+
129
+ # if HAVE_LINUX_FS_H && HAVE_SYS_TIMERFD_H && HAVE_KERNEL_RWF_T
130
+ # ifndef EV_USE_IOURING
131
+ # define EV_USE_IOURING EV_FEATURE_BACKENDS
132
+ # endif
133
+ # else
134
+ # undef EV_USE_IOURING
135
+ # define EV_USE_IOURING 0
136
+ # endif
137
+
120
138
  # if HAVE_KQUEUE && HAVE_SYS_EVENT_H
121
139
  # ifndef EV_USE_KQUEUE
122
140
  # define EV_USE_KQUEUE EV_FEATURE_BACKENDS
@@ -161,9 +179,28 @@
161
179
  # undef EV_USE_EVENTFD
162
180
  # define EV_USE_EVENTFD 0
163
181
  # endif
164
-
182
+
183
+ # if HAVE_SYS_TIMERFD_H
184
+ # ifndef EV_USE_TIMERFD
185
+ # define EV_USE_TIMERFD EV_FEATURE_OS
186
+ # endif
187
+ # else
188
+ # undef EV_USE_TIMERFD
189
+ # define EV_USE_TIMERFD 0
190
+ # endif
191
+
165
192
  #endif
166
193
 
194
+ /* OS X, in its infinite idiocy, actually HARDCODES
195
+ * a limit of 1024 into their select. Where people have brains,
196
+ * OS X engineers apparently have a vacuum. Or maybe they were
197
+ * ordered to have a vacuum, or they do anything for money.
198
+ * This might help. Or not.
199
+ * Note that this must be defined early, as other include files
200
+ * will rely on this define as well.
201
+ */
202
+ #define _DARWIN_UNLIMITED_SELECT 1
203
+
167
204
  #include <stdlib.h>
168
205
  #include <string.h>
169
206
  #include <fcntl.h>
@@ -211,14 +248,6 @@
211
248
  # undef EV_AVOID_STDIO
212
249
  #endif
213
250
 
214
- /* OS X, in its infinite idiocy, actually HARDCODES
215
- * a limit of 1024 into their select. Where people have brains,
216
- * OS X engineers apparently have a vacuum. Or maybe they were
217
- * ordered to have a vacuum, or they do anything for money.
218
- * This might help. Or not.
219
- */
220
- #define _DARWIN_UNLIMITED_SELECT 1
221
-
222
251
  /* this block tries to deduce configuration from header-defined symbols and defaults */
223
252
 
224
253
  /* try to deduce the maximum number of signals on this platform */
@@ -315,6 +344,22 @@
315
344
  # define EV_USE_PORT 0
316
345
  #endif
317
346
 
347
+ #ifndef EV_USE_LINUXAIO
348
+ # if __linux /* libev currently assumes linux/aio_abi.h is always available on linux */
349
+ # define EV_USE_LINUXAIO 0 /* was: 1, always off by default */
350
+ # else
351
+ # define EV_USE_LINUXAIO 0
352
+ # endif
353
+ #endif
354
+
355
+ #ifndef EV_USE_IOURING
356
+ # if __linux /* later checks might disable again */
357
+ # define EV_USE_IOURING 1
358
+ # else
359
+ # define EV_USE_IOURING 0
360
+ # endif
361
+ #endif
362
+
318
363
  #ifndef EV_USE_INOTIFY
319
364
  # if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 4))
320
365
  # define EV_USE_INOTIFY EV_FEATURE_OS
@@ -347,6 +392,14 @@
347
392
  # endif
348
393
  #endif
349
394
 
395
+ #ifndef EV_USE_TIMERFD
396
+ # if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8))
397
+ # define EV_USE_TIMERFD EV_FEATURE_OS
398
+ # else
399
+ # define EV_USE_TIMERFD 0
400
+ # endif
401
+ #endif
402
+
350
403
  #if 0 /* debugging */
351
404
  # define EV_VERIFY 3
352
405
  # define EV_USE_4HEAP 1
@@ -365,7 +418,7 @@
365
418
  # define EV_HEAP_CACHE_AT EV_FEATURE_DATA
366
419
  #endif
367
420
 
368
- #ifdef ANDROID
421
+ #ifdef __ANDROID__
369
422
  /* supposedly, android doesn't typedef fd_mask */
370
423
  # undef EV_USE_SELECT
371
424
  # define EV_USE_SELECT 0
@@ -389,6 +442,7 @@
389
442
  # define clock_gettime(id, ts) syscall (SYS_clock_gettime, (id), (ts))
390
443
  # undef EV_USE_MONOTONIC
391
444
  # define EV_USE_MONOTONIC 1
445
+ # define EV_NEED_SYSCALL 1
392
446
  # else
393
447
  # undef EV_USE_CLOCK_SYSCALL
394
448
  # define EV_USE_CLOCK_SYSCALL 0
@@ -412,6 +466,14 @@
412
466
  # define EV_USE_INOTIFY 0
413
467
  #endif
414
468
 
469
+ #if __linux && EV_USE_IOURING
470
+ # include <linux/version.h>
471
+ # if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
472
+ # undef EV_USE_IOURING
473
+ # define EV_USE_IOURING 0
474
+ # endif
475
+ #endif
476
+
415
477
  #if !EV_USE_NANOSLEEP
416
478
  /* hp-ux has it in sys/time.h, which we unconditionally include above */
417
479
  # if !defined _WIN32 && !defined __hpux
@@ -419,8 +481,37 @@
419
481
  # endif
420
482
  #endif
421
483
 
484
+ #if EV_USE_LINUXAIO
485
+ # include <sys/syscall.h>
486
+ # if SYS_io_getevents && EV_USE_EPOLL /* linuxaio backend requires epoll backend */
487
+ # define EV_NEED_SYSCALL 1
488
+ # else
489
+ # undef EV_USE_LINUXAIO
490
+ # define EV_USE_LINUXAIO 0
491
+ # endif
492
+ #endif
493
+
494
+ #if EV_USE_IOURING
495
+ # include <sys/syscall.h>
496
+ # if !SYS_io_uring_setup && __linux && !__alpha
497
+ # define SYS_io_uring_setup 425
498
+ # define SYS_io_uring_enter 426
499
+ # define SYS_io_uring_wregister 427
500
+ # endif
501
+ # if SYS_io_uring_setup && EV_USE_EPOLL /* iouring backend requires epoll backend */
502
+ # define EV_NEED_SYSCALL 1
503
+ # else
504
+ # undef EV_USE_IOURING
505
+ # define EV_USE_IOURING 0
506
+ # endif
507
+ #endif
508
+
422
509
  #if EV_USE_INOTIFY
423
- # include <sys/statfs.h>
510
+ # ifdef __FreeBSD__
511
+ # include <sys/mount.h>
512
+ # else
513
+ # include <sys/statfs.h>
514
+ # endif
424
515
  # include <sys/inotify.h>
425
516
  /* some very old inotify.h headers don't have IN_DONT_FOLLOW */
426
517
  # ifndef IN_DONT_FOLLOW
@@ -430,7 +521,7 @@
430
521
  #endif
431
522
 
432
523
  #if EV_USE_EVENTFD
433
- /* our minimum requirement is glibc 2.7 which has the stub, but not the header */
524
+ /* our minimum requirement is glibc 2.7 which has the stub, but not the full header */
434
525
  # include <stdint.h>
435
526
  # ifndef EFD_NONBLOCK
436
527
  # define EFD_NONBLOCK O_NONBLOCK
@@ -446,7 +537,7 @@ EV_CPP(extern "C") int (eventfd) (unsigned int initval, int flags);
446
537
  #endif
447
538
 
448
539
  #if EV_USE_SIGNALFD
449
- /* our minimum requirement is glibc 2.7 which has the stub, but not the header */
540
+ /* our minimum requirement is glibc 2.7 which has the stub, but not the full header */
450
541
  # include <stdint.h>
451
542
  # ifndef SFD_NONBLOCK
452
543
  # define SFD_NONBLOCK O_NONBLOCK
@@ -458,7 +549,7 @@ EV_CPP(extern "C") int (eventfd) (unsigned int initval, int flags);
458
549
  # define SFD_CLOEXEC 02000000
459
550
  # endif
460
551
  # endif
461
- EV_CPP (extern "C") int signalfd (int fd, const sigset_t *mask, int flags);
552
+ EV_CPP (extern "C") int (signalfd) (int fd, const sigset_t *mask, int flags);
462
553
 
463
554
  struct signalfd_siginfo
464
555
  {
@@ -467,7 +558,17 @@ struct signalfd_siginfo
467
558
  };
468
559
  #endif
469
560
 
470
- /**/
561
+ /* for timerfd, libev core requires TFD_TIMER_CANCEL_ON_SET &c */
562
+ #if EV_USE_TIMERFD
563
+ # include <sys/timerfd.h>
564
+ /* timerfd is only used for periodics */
565
+ # if !(defined (TFD_TIMER_CANCEL_ON_SET) && defined (TFD_CLOEXEC) && defined (TFD_NONBLOCK)) || !EV_PERIODIC_ENABLE
566
+ # undef EV_USE_TIMERFD
567
+ # define EV_USE_TIMERFD 0
568
+ # endif
569
+ #endif
570
+
571
+ /*****************************************************************************/
471
572
 
472
573
  #if EV_VERIFY >= 3
473
574
  # define EV_FREQUENT_CHECK ev_verify (EV_A)
@@ -482,18 +583,34 @@ struct signalfd_siginfo
482
583
  #define MIN_INTERVAL 0.0001220703125 /* 1/2**13, good till 4000 */
483
584
  /*#define MIN_INTERVAL 0.00000095367431640625 /* 1/2**20, good till 2200 */
484
585
 
485
- #define MIN_TIMEJUMP 1. /* minimum timejump that gets detected (if monotonic clock available) */
486
- #define MAX_BLOCKTIME 59.743 /* never wait longer than this time (to detect time jumps) */
586
+ #define MIN_TIMEJUMP 1. /* minimum timejump that gets detected (if monotonic clock available) */
587
+ #define MAX_BLOCKTIME 59.743 /* never wait longer than this time (to detect time jumps) */
588
+ #define MAX_BLOCKTIME2 1500001.07 /* same, but when timerfd is used to detect jumps, also safe delay to not overflow */
589
+
590
+ /* find a portable timestamp that is "always" in the future but fits into time_t.
591
+ * this is quite hard, and we are mostly guessing - we handle 32 bit signed/unsigned time_t,
592
+ * and sizes larger than 32 bit, and maybe the unlikely floating point time_t */
593
+ #define EV_TSTAMP_HUGE \
594
+ (sizeof (time_t) >= 8 ? 10000000000000. \
595
+ : 0 < (time_t)4294967295 ? 4294967295. \
596
+ : 2147483647.) \
487
597
 
488
- #define EV_TV_SET(tv,t) do { tv.tv_sec = (long)t; tv.tv_usec = (long)((t - tv.tv_sec) * 1e6); } while (0)
489
- #define EV_TS_SET(ts,t) do { ts.tv_sec = (long)t; ts.tv_nsec = (long)((t - ts.tv_sec) * 1e9); } while (0)
598
+ #ifndef EV_TS_CONST
599
+ # define EV_TS_CONST(nv) nv
600
+ # define EV_TS_TO_MSEC(a) a * 1e3 + 0.9999
601
+ # define EV_TS_FROM_USEC(us) us * 1e-6
602
+ # define EV_TV_SET(tv,t) do { tv.tv_sec = (long)t; tv.tv_usec = (long)((t - tv.tv_sec) * 1e6); } while (0)
603
+ # define EV_TS_SET(ts,t) do { ts.tv_sec = (long)t; ts.tv_nsec = (long)((t - ts.tv_sec) * 1e9); } while (0)
604
+ # define EV_TV_GET(tv) ((tv).tv_sec + (tv).tv_usec * 1e-6)
605
+ # define EV_TS_GET(ts) ((ts).tv_sec + (ts).tv_nsec * 1e-9)
606
+ #endif
490
607
 
491
608
  /* the following is ecb.h embedded into libev - use update_ev_c to update from an external copy */
492
609
  /* ECB.H BEGIN */
493
610
  /*
494
611
  * libecb - http://software.schmorp.de/pkg/libecb
495
612
  *
496
- * Copyright (©) 2009-2015 Marc Alexander Lehmann <libecb@schmorp.de>
613
+ * Copyright (©) 2009-2015,2018-2020 Marc Alexander Lehmann <libecb@schmorp.de>
497
614
  * Copyright (©) 2011 Emanuele Giaquinta
498
615
  * All rights reserved.
499
616
  *
@@ -534,15 +651,23 @@ struct signalfd_siginfo
534
651
  #define ECB_H
535
652
 
536
653
  /* 16 bits major, 16 bits minor */
537
- #define ECB_VERSION 0x00010005
654
+ #define ECB_VERSION 0x00010008
538
655
 
539
- #ifdef _WIN32
656
+ #include <string.h> /* for memcpy */
657
+
658
+ #if defined (_WIN32) && !defined (__MINGW32__)
540
659
  typedef signed char int8_t;
541
660
  typedef unsigned char uint8_t;
661
+ typedef signed char int_fast8_t;
662
+ typedef unsigned char uint_fast8_t;
542
663
  typedef signed short int16_t;
543
664
  typedef unsigned short uint16_t;
665
+ typedef signed int int_fast16_t;
666
+ typedef unsigned int uint_fast16_t;
544
667
  typedef signed int int32_t;
545
668
  typedef unsigned int uint32_t;
669
+ typedef signed int int_fast32_t;
670
+ typedef unsigned int uint_fast32_t;
546
671
  #if __GNUC__
547
672
  typedef signed long long int64_t;
548
673
  typedef unsigned long long uint64_t;
@@ -550,6 +675,8 @@ struct signalfd_siginfo
550
675
  typedef signed __int64 int64_t;
551
676
  typedef unsigned __int64 uint64_t;
552
677
  #endif
678
+ typedef int64_t int_fast64_t;
679
+ typedef uint64_t uint_fast64_t;
553
680
  #ifdef _WIN64
554
681
  #define ECB_PTRSIZE 8
555
682
  typedef uint64_t uintptr_t;
@@ -571,6 +698,14 @@ struct signalfd_siginfo
571
698
  #define ECB_GCC_AMD64 (__amd64 || __amd64__ || __x86_64 || __x86_64__)
572
699
  #define ECB_MSVC_AMD64 (_M_AMD64 || _M_X64)
573
700
 
701
+ #ifndef ECB_OPTIMIZE_SIZE
702
+ #if __OPTIMIZE_SIZE__
703
+ #define ECB_OPTIMIZE_SIZE 1
704
+ #else
705
+ #define ECB_OPTIMIZE_SIZE 0
706
+ #endif
707
+ #endif
708
+
574
709
  /* work around x32 idiocy by defining proper macros */
575
710
  #if ECB_GCC_AMD64 || ECB_MSVC_AMD64
576
711
  #if _ILP32
@@ -609,6 +744,8 @@ struct signalfd_siginfo
609
744
 
610
745
  #define ECB_CPP (__cplusplus+0)
611
746
  #define ECB_CPP11 (__cplusplus >= 201103L)
747
+ #define ECB_CPP14 (__cplusplus >= 201402L)
748
+ #define ECB_CPP17 (__cplusplus >= 201703L)
612
749
 
613
750
  #if ECB_CPP
614
751
  #define ECB_C 0
@@ -620,6 +757,7 @@ struct signalfd_siginfo
620
757
 
621
758
  #define ECB_C99 (ECB_STDC_VERSION >= 199901L)
622
759
  #define ECB_C11 (ECB_STDC_VERSION >= 201112L)
760
+ #define ECB_C17 (ECB_STDC_VERSION >= 201710L)
623
761
 
624
762
  #if ECB_CPP
625
763
  #define ECB_EXTERN_C extern "C"
@@ -655,14 +793,15 @@ struct signalfd_siginfo
655
793
 
656
794
  #ifndef ECB_MEMORY_FENCE
657
795
  #if ECB_GCC_VERSION(2,5) || defined __INTEL_COMPILER || (__llvm__ && __GNUC__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110
796
+ #define ECB_MEMORY_FENCE_RELAXED __asm__ __volatile__ ("" : : : "memory")
658
797
  #if __i386 || __i386__
659
798
  #define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory")
660
799
  #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory")
661
- #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("")
800
+ #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("" : : : "memory")
662
801
  #elif ECB_GCC_AMD64
663
802
  #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory")
664
803
  #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory")
665
- #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("")
804
+ #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("" : : : "memory")
666
805
  #elif __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__
667
806
  #define ECB_MEMORY_FENCE __asm__ __volatile__ ("sync" : : : "memory")
668
807
  #elif defined __ARM_ARCH_2__ \
@@ -714,12 +853,14 @@ struct signalfd_siginfo
714
853
  #define ECB_MEMORY_FENCE __atomic_thread_fence (__ATOMIC_SEQ_CST)
715
854
  #define ECB_MEMORY_FENCE_ACQUIRE __atomic_thread_fence (__ATOMIC_ACQUIRE)
716
855
  #define ECB_MEMORY_FENCE_RELEASE __atomic_thread_fence (__ATOMIC_RELEASE)
856
+ #define ECB_MEMORY_FENCE_RELAXED __atomic_thread_fence (__ATOMIC_RELAXED)
717
857
 
718
858
  #elif ECB_CLANG_EXTENSION(c_atomic)
719
859
  /* see comment below (stdatomic.h) about the C11 memory model. */
720
860
  #define ECB_MEMORY_FENCE __c11_atomic_thread_fence (__ATOMIC_SEQ_CST)
721
861
  #define ECB_MEMORY_FENCE_ACQUIRE __c11_atomic_thread_fence (__ATOMIC_ACQUIRE)
722
862
  #define ECB_MEMORY_FENCE_RELEASE __c11_atomic_thread_fence (__ATOMIC_RELEASE)
863
+ #define ECB_MEMORY_FENCE_RELAXED __c11_atomic_thread_fence (__ATOMIC_RELAXED)
723
864
 
724
865
  #elif ECB_GCC_VERSION(4,4) || defined __INTEL_COMPILER || defined __clang__
725
866
  #define ECB_MEMORY_FENCE __sync_synchronize ()
@@ -739,9 +880,10 @@ struct signalfd_siginfo
739
880
  #define ECB_MEMORY_FENCE MemoryBarrier () /* actually just xchg on x86... scary */
740
881
  #elif __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110
741
882
  #include <mbarrier.h>
742
- #define ECB_MEMORY_FENCE __machine_rw_barrier ()
743
- #define ECB_MEMORY_FENCE_ACQUIRE __machine_r_barrier ()
744
- #define ECB_MEMORY_FENCE_RELEASE __machine_w_barrier ()
883
+ #define ECB_MEMORY_FENCE __machine_rw_barrier ()
884
+ #define ECB_MEMORY_FENCE_ACQUIRE __machine_acq_barrier ()
885
+ #define ECB_MEMORY_FENCE_RELEASE __machine_rel_barrier ()
886
+ #define ECB_MEMORY_FENCE_RELAXED __compiler_barrier ()
745
887
  #elif __xlC__
746
888
  #define ECB_MEMORY_FENCE __sync ()
747
889
  #endif
@@ -752,15 +894,9 @@ struct signalfd_siginfo
752
894
  /* we assume that these memory fences work on all variables/all memory accesses, */
753
895
  /* not just C11 atomics and atomic accesses */
754
896
  #include <stdatomic.h>
755
- /* Unfortunately, neither gcc 4.7 nor clang 3.1 generate any instructions for */
756
- /* any fence other than seq_cst, which isn't very efficient for us. */
757
- /* Why that is, we don't know - either the C11 memory model is quite useless */
758
- /* for most usages, or gcc and clang have a bug */
759
- /* I *currently* lean towards the latter, and inefficiently implement */
760
- /* all three of ecb's fences as a seq_cst fence */
761
- /* Update, gcc-4.8 generates mfence for all c++ fences, but nothing */
762
- /* for all __atomic_thread_fence's except seq_cst */
763
897
  #define ECB_MEMORY_FENCE atomic_thread_fence (memory_order_seq_cst)
898
+ #define ECB_MEMORY_FENCE_ACQUIRE atomic_thread_fence (memory_order_acquire)
899
+ #define ECB_MEMORY_FENCE_RELEASE atomic_thread_fence (memory_order_release)
764
900
  #endif
765
901
  #endif
766
902
 
@@ -790,6 +926,10 @@ struct signalfd_siginfo
790
926
  #define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE
791
927
  #endif
792
928
 
929
+ #if !defined ECB_MEMORY_FENCE_RELAXED && defined ECB_MEMORY_FENCE
930
+ #define ECB_MEMORY_FENCE_RELAXED ECB_MEMORY_FENCE /* very heavy-handed */
931
+ #endif
932
+
793
933
  /*****************************************************************************/
794
934
 
795
935
  #if ECB_CPP
@@ -1081,6 +1221,44 @@ ecb_inline ecb_const uint32_t ecb_rotr32 (uint32_t x, unsigned int count) { retu
1081
1221
  ecb_inline ecb_const uint64_t ecb_rotl64 (uint64_t x, unsigned int count) { return (x >> (64 - count)) | (x << count); }
1082
1222
  ecb_inline ecb_const uint64_t ecb_rotr64 (uint64_t x, unsigned int count) { return (x << (64 - count)) | (x >> count); }
1083
1223
 
1224
+ #if ECB_CPP
1225
+
1226
+ inline uint8_t ecb_ctz (uint8_t v) { return ecb_ctz32 (v); }
1227
+ inline uint16_t ecb_ctz (uint16_t v) { return ecb_ctz32 (v); }
1228
+ inline uint32_t ecb_ctz (uint32_t v) { return ecb_ctz32 (v); }
1229
+ inline uint64_t ecb_ctz (uint64_t v) { return ecb_ctz64 (v); }
1230
+
1231
+ inline bool ecb_is_pot (uint8_t v) { return ecb_is_pot32 (v); }
1232
+ inline bool ecb_is_pot (uint16_t v) { return ecb_is_pot32 (v); }
1233
+ inline bool ecb_is_pot (uint32_t v) { return ecb_is_pot32 (v); }
1234
+ inline bool ecb_is_pot (uint64_t v) { return ecb_is_pot64 (v); }
1235
+
1236
+ inline int ecb_ld (uint8_t v) { return ecb_ld32 (v); }
1237
+ inline int ecb_ld (uint16_t v) { return ecb_ld32 (v); }
1238
+ inline int ecb_ld (uint32_t v) { return ecb_ld32 (v); }
1239
+ inline int ecb_ld (uint64_t v) { return ecb_ld64 (v); }
1240
+
1241
+ inline int ecb_popcount (uint8_t v) { return ecb_popcount32 (v); }
1242
+ inline int ecb_popcount (uint16_t v) { return ecb_popcount32 (v); }
1243
+ inline int ecb_popcount (uint32_t v) { return ecb_popcount32 (v); }
1244
+ inline int ecb_popcount (uint64_t v) { return ecb_popcount64 (v); }
1245
+
1246
+ inline uint8_t ecb_bitrev (uint8_t v) { return ecb_bitrev8 (v); }
1247
+ inline uint16_t ecb_bitrev (uint16_t v) { return ecb_bitrev16 (v); }
1248
+ inline uint32_t ecb_bitrev (uint32_t v) { return ecb_bitrev32 (v); }
1249
+
1250
+ inline uint8_t ecb_rotl (uint8_t v, unsigned int count) { return ecb_rotl8 (v, count); }
1251
+ inline uint16_t ecb_rotl (uint16_t v, unsigned int count) { return ecb_rotl16 (v, count); }
1252
+ inline uint32_t ecb_rotl (uint32_t v, unsigned int count) { return ecb_rotl32 (v, count); }
1253
+ inline uint64_t ecb_rotl (uint64_t v, unsigned int count) { return ecb_rotl64 (v, count); }
1254
+
1255
+ inline uint8_t ecb_rotr (uint8_t v, unsigned int count) { return ecb_rotr8 (v, count); }
1256
+ inline uint16_t ecb_rotr (uint16_t v, unsigned int count) { return ecb_rotr16 (v, count); }
1257
+ inline uint32_t ecb_rotr (uint32_t v, unsigned int count) { return ecb_rotr32 (v, count); }
1258
+ inline uint64_t ecb_rotr (uint64_t v, unsigned int count) { return ecb_rotr64 (v, count); }
1259
+
1260
+ #endif
1261
+
1084
1262
  #if ECB_GCC_VERSION(4,3) || (ECB_CLANG_BUILTIN(__builtin_bswap32) && ECB_CLANG_BUILTIN(__builtin_bswap64))
1085
1263
  #if ECB_GCC_VERSION(4,8) || ECB_CLANG_BUILTIN(__builtin_bswap16)
1086
1264
  #define ecb_bswap16(x) __builtin_bswap16 (x)
@@ -1161,6 +1339,78 @@ ecb_inline ecb_const ecb_bool ecb_big_endian (void) { return ecb_byteorder_he
1161
1339
  ecb_inline ecb_const ecb_bool ecb_little_endian (void);
1162
1340
  ecb_inline ecb_const ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44332211; }
1163
1341
 
1342
+ /*****************************************************************************/
1343
+ /* unaligned load/store */
1344
+
1345
+ ecb_inline uint_fast16_t ecb_be_u16_to_host (uint_fast16_t v) { return ecb_little_endian () ? ecb_bswap16 (v) : v; }
1346
+ ecb_inline uint_fast32_t ecb_be_u32_to_host (uint_fast32_t v) { return ecb_little_endian () ? ecb_bswap32 (v) : v; }
1347
+ ecb_inline uint_fast64_t ecb_be_u64_to_host (uint_fast64_t v) { return ecb_little_endian () ? ecb_bswap64 (v) : v; }
1348
+
1349
+ ecb_inline uint_fast16_t ecb_le_u16_to_host (uint_fast16_t v) { return ecb_big_endian () ? ecb_bswap16 (v) : v; }
1350
+ ecb_inline uint_fast32_t ecb_le_u32_to_host (uint_fast32_t v) { return ecb_big_endian () ? ecb_bswap32 (v) : v; }
1351
+ ecb_inline uint_fast64_t ecb_le_u64_to_host (uint_fast64_t v) { return ecb_big_endian () ? ecb_bswap64 (v) : v; }
1352
+
1353
+ ecb_inline uint_fast16_t ecb_peek_u16_u (const void *ptr) { uint16_t v; memcpy (&v, ptr, sizeof (v)); return v; }
1354
+ ecb_inline uint_fast32_t ecb_peek_u32_u (const void *ptr) { uint32_t v; memcpy (&v, ptr, sizeof (v)); return v; }
1355
+ ecb_inline uint_fast64_t ecb_peek_u64_u (const void *ptr) { uint64_t v; memcpy (&v, ptr, sizeof (v)); return v; }
1356
+
1357
+ ecb_inline uint_fast16_t ecb_peek_be_u16_u (const void *ptr) { return ecb_be_u16_to_host (ecb_peek_u16_u (ptr)); }
1358
+ ecb_inline uint_fast32_t ecb_peek_be_u32_u (const void *ptr) { return ecb_be_u32_to_host (ecb_peek_u32_u (ptr)); }
1359
+ ecb_inline uint_fast64_t ecb_peek_be_u64_u (const void *ptr) { return ecb_be_u64_to_host (ecb_peek_u64_u (ptr)); }
1360
+
1361
+ ecb_inline uint_fast16_t ecb_peek_le_u16_u (const void *ptr) { return ecb_le_u16_to_host (ecb_peek_u16_u (ptr)); }
1362
+ ecb_inline uint_fast32_t ecb_peek_le_u32_u (const void *ptr) { return ecb_le_u32_to_host (ecb_peek_u32_u (ptr)); }
1363
+ ecb_inline uint_fast64_t ecb_peek_le_u64_u (const void *ptr) { return ecb_le_u64_to_host (ecb_peek_u64_u (ptr)); }
1364
+
1365
+ ecb_inline uint_fast16_t ecb_host_to_be_u16 (uint_fast16_t v) { return ecb_little_endian () ? ecb_bswap16 (v) : v; }
1366
+ ecb_inline uint_fast32_t ecb_host_to_be_u32 (uint_fast32_t v) { return ecb_little_endian () ? ecb_bswap32 (v) : v; }
1367
+ ecb_inline uint_fast64_t ecb_host_to_be_u64 (uint_fast64_t v) { return ecb_little_endian () ? ecb_bswap64 (v) : v; }
1368
+
1369
+ ecb_inline uint_fast16_t ecb_host_to_le_u16 (uint_fast16_t v) { return ecb_big_endian () ? ecb_bswap16 (v) : v; }
1370
+ ecb_inline uint_fast32_t ecb_host_to_le_u32 (uint_fast32_t v) { return ecb_big_endian () ? ecb_bswap32 (v) : v; }
1371
+ ecb_inline uint_fast64_t ecb_host_to_le_u64 (uint_fast64_t v) { return ecb_big_endian () ? ecb_bswap64 (v) : v; }
1372
+
1373
+ ecb_inline void ecb_poke_u16_u (void *ptr, uint16_t v) { memcpy (ptr, &v, sizeof (v)); }
1374
+ ecb_inline void ecb_poke_u32_u (void *ptr, uint32_t v) { memcpy (ptr, &v, sizeof (v)); }
1375
+ ecb_inline void ecb_poke_u64_u (void *ptr, uint64_t v) { memcpy (ptr, &v, sizeof (v)); }
1376
+
1377
+ ecb_inline void ecb_poke_be_u16_u (void *ptr, uint_fast16_t v) { ecb_poke_u16_u (ptr, ecb_host_to_be_u16 (v)); }
1378
+ ecb_inline void ecb_poke_be_u32_u (void *ptr, uint_fast32_t v) { ecb_poke_u32_u (ptr, ecb_host_to_be_u32 (v)); }
1379
+ ecb_inline void ecb_poke_be_u64_u (void *ptr, uint_fast64_t v) { ecb_poke_u64_u (ptr, ecb_host_to_be_u64 (v)); }
1380
+
1381
+ ecb_inline void ecb_poke_le_u16_u (void *ptr, uint_fast16_t v) { ecb_poke_u16_u (ptr, ecb_host_to_le_u16 (v)); }
1382
+ ecb_inline void ecb_poke_le_u32_u (void *ptr, uint_fast32_t v) { ecb_poke_u32_u (ptr, ecb_host_to_le_u32 (v)); }
1383
+ ecb_inline void ecb_poke_le_u64_u (void *ptr, uint_fast64_t v) { ecb_poke_u64_u (ptr, ecb_host_to_le_u64 (v)); }
1384
+
1385
+ #if ECB_CPP
1386
+
1387
+ inline uint8_t ecb_bswap (uint8_t v) { return v; }
1388
+ inline uint16_t ecb_bswap (uint16_t v) { return ecb_bswap16 (v); }
1389
+ inline uint32_t ecb_bswap (uint32_t v) { return ecb_bswap32 (v); }
1390
+ inline uint64_t ecb_bswap (uint64_t v) { return ecb_bswap64 (v); }
1391
+
1392
+ template<typename T> inline T ecb_be_to_host (T v) { return ecb_little_endian () ? ecb_bswap (v) : v; }
1393
+ template<typename T> inline T ecb_le_to_host (T v) { return ecb_big_endian () ? ecb_bswap (v) : v; }
1394
+ template<typename T> inline T ecb_peek (const void *ptr) { return *(const T *)ptr; }
1395
+ template<typename T> inline T ecb_peek_be (const void *ptr) { return ecb_be_to_host (ecb_peek <T> (ptr)); }
1396
+ template<typename T> inline T ecb_peek_le (const void *ptr) { return ecb_le_to_host (ecb_peek <T> (ptr)); }
1397
+ template<typename T> inline T ecb_peek_u (const void *ptr) { T v; memcpy (&v, ptr, sizeof (v)); return v; }
1398
+ template<typename T> inline T ecb_peek_be_u (const void *ptr) { return ecb_be_to_host (ecb_peek_u<T> (ptr)); }
1399
+ template<typename T> inline T ecb_peek_le_u (const void *ptr) { return ecb_le_to_host (ecb_peek_u<T> (ptr)); }
1400
+
1401
+ template<typename T> inline T ecb_host_to_be (T v) { return ecb_little_endian () ? ecb_bswap (v) : v; }
1402
+ template<typename T> inline T ecb_host_to_le (T v) { return ecb_big_endian () ? ecb_bswap (v) : v; }
1403
+ template<typename T> inline void ecb_poke (void *ptr, T v) { *(T *)ptr = v; }
1404
+ template<typename T> inline void ecb_poke_be (void *ptr, T v) { return ecb_poke <T> (ptr, ecb_host_to_be (v)); }
1405
+ template<typename T> inline void ecb_poke_le (void *ptr, T v) { return ecb_poke <T> (ptr, ecb_host_to_le (v)); }
1406
+ template<typename T> inline void ecb_poke_u (void *ptr, T v) { memcpy (ptr, &v, sizeof (v)); }
1407
+ template<typename T> inline void ecb_poke_be_u (void *ptr, T v) { return ecb_poke_u<T> (ptr, ecb_host_to_be (v)); }
1408
+ template<typename T> inline void ecb_poke_le_u (void *ptr, T v) { return ecb_poke_u<T> (ptr, ecb_host_to_le (v)); }
1409
+
1410
+ #endif
1411
+
1412
+ /*****************************************************************************/
1413
+
1164
1414
  #if ECB_GCC_VERSION(3,0) || ECB_C99
1165
1415
  #define ecb_mod(m,n) ((m) % (n) + ((m) % (n) < 0 ? (n) : 0))
1166
1416
  #else
@@ -1194,6 +1444,8 @@ ecb_inline ecb_const ecb_bool ecb_little_endian (void) { return ecb_byteorder_he
1194
1444
  #define ecb_array_length(name) (sizeof (name) / sizeof (name [0]))
1195
1445
  #endif
1196
1446
 
1447
+ /*****************************************************************************/
1448
+
1197
1449
  ecb_function_ ecb_const uint32_t ecb_binary16_to_binary32 (uint32_t x);
1198
1450
  ecb_function_ ecb_const uint32_t
1199
1451
  ecb_binary16_to_binary32 (uint32_t x)
@@ -1311,7 +1563,6 @@ ecb_binary32_to_binary16 (uint32_t x)
1311
1563
  || (defined __arm__ && (defined __ARM_EABI__ || defined __EABI__ || defined __VFP_FP__ || defined _WIN32_WCE || defined __ANDROID__)) \
1312
1564
  || defined __aarch64__
1313
1565
  #define ECB_STDFP 1
1314
- #include <string.h> /* for memcpy */
1315
1566
  #else
1316
1567
  #define ECB_STDFP 0
1317
1568
  #endif
@@ -1506,7 +1757,7 @@ ecb_binary32_to_binary16 (uint32_t x)
1506
1757
  #if ECB_MEMORY_FENCE_NEEDS_PTHREADS
1507
1758
  /* if your architecture doesn't need memory fences, e.g. because it is
1508
1759
  * single-cpu/core, or if you use libev in a project that doesn't use libev
1509
- * from multiple threads, then you can define ECB_AVOID_PTHREADS when compiling
1760
+ * from multiple threads, then you can define ECB_NO_THREADS when compiling
1510
1761
  * libev, in which cases the memory fences become nops.
1511
1762
  * alternatively, you can remove this #error and link against libpthread,
1512
1763
  * which will then provide the memory fences.
@@ -1520,18 +1771,80 @@ ecb_binary32_to_binary16 (uint32_t x)
1520
1771
  # define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE
1521
1772
  #endif
1522
1773
 
1523
- #define expect_false(cond) ecb_expect_false (cond)
1524
- #define expect_true(cond) ecb_expect_true (cond)
1525
- #define noinline ecb_noinline
1526
-
1527
1774
  #define inline_size ecb_inline
1528
1775
 
1529
1776
  #if EV_FEATURE_CODE
1530
1777
  # define inline_speed ecb_inline
1531
1778
  #else
1532
- # define inline_speed noinline static
1779
+ # define inline_speed ecb_noinline static
1780
+ #endif
1781
+
1782
+ /*****************************************************************************/
1783
+ /* raw syscall wrappers */
1784
+
1785
+ #if EV_NEED_SYSCALL
1786
+
1787
+ #include <sys/syscall.h>
1788
+
1789
+ /*
1790
+ * define some syscall wrappers for common architectures
1791
+ * this is mostly for nice looks during debugging, not performance.
1792
+ * our syscalls return < 0, not == -1, on error. which is good
1793
+ * enough for linux aio.
1794
+ * TODO: arm is also common nowadays, maybe even mips and x86
1795
+ * TODO: after implementing this, it suddenly looks like overkill, but its hard to remove...
1796
+ */
1797
+ #if __GNUC__ && __linux && ECB_AMD64 && !EV_FEATURE_CODE
1798
+ /* the costly errno access probably kills this for size optimisation */
1799
+
1800
+ #define ev_syscall(nr,narg,arg1,arg2,arg3,arg4,arg5,arg6) \
1801
+ ({ \
1802
+ long res; \
1803
+ register unsigned long r6 __asm__ ("r9" ); \
1804
+ register unsigned long r5 __asm__ ("r8" ); \
1805
+ register unsigned long r4 __asm__ ("r10"); \
1806
+ register unsigned long r3 __asm__ ("rdx"); \
1807
+ register unsigned long r2 __asm__ ("rsi"); \
1808
+ register unsigned long r1 __asm__ ("rdi"); \
1809
+ if (narg >= 6) r6 = (unsigned long)(arg6); \
1810
+ if (narg >= 5) r5 = (unsigned long)(arg5); \
1811
+ if (narg >= 4) r4 = (unsigned long)(arg4); \
1812
+ if (narg >= 3) r3 = (unsigned long)(arg3); \
1813
+ if (narg >= 2) r2 = (unsigned long)(arg2); \
1814
+ if (narg >= 1) r1 = (unsigned long)(arg1); \
1815
+ __asm__ __volatile__ ( \
1816
+ "syscall\n\t" \
1817
+ : "=a" (res) \
1818
+ : "0" (nr), "r" (r1), "r" (r2), "r" (r3), "r" (r4), "r" (r5) \
1819
+ : "cc", "r11", "cx", "memory"); \
1820
+ errno = -res; \
1821
+ res; \
1822
+ })
1823
+
1824
+ #endif
1825
+
1826
+ #ifdef ev_syscall
1827
+ #define ev_syscall0(nr) ev_syscall (nr, 0, 0, 0, 0, 0, 0, 0)
1828
+ #define ev_syscall1(nr,arg1) ev_syscall (nr, 1, arg1, 0, 0, 0, 0, 0)
1829
+ #define ev_syscall2(nr,arg1,arg2) ev_syscall (nr, 2, arg1, arg2, 0, 0, 0, 0)
1830
+ #define ev_syscall3(nr,arg1,arg2,arg3) ev_syscall (nr, 3, arg1, arg2, arg3, 0, 0, 0)
1831
+ #define ev_syscall4(nr,arg1,arg2,arg3,arg4) ev_syscall (nr, 3, arg1, arg2, arg3, arg4, 0, 0)
1832
+ #define ev_syscall5(nr,arg1,arg2,arg3,arg4,arg5) ev_syscall (nr, 5, arg1, arg2, arg3, arg4, arg5, 0)
1833
+ #define ev_syscall6(nr,arg1,arg2,arg3,arg4,arg5,arg6) ev_syscall (nr, 6, arg1, arg2, arg3, arg4, arg5,arg6)
1834
+ #else
1835
+ #define ev_syscall0(nr) syscall (nr)
1836
+ #define ev_syscall1(nr,arg1) syscall (nr, arg1)
1837
+ #define ev_syscall2(nr,arg1,arg2) syscall (nr, arg1, arg2)
1838
+ #define ev_syscall3(nr,arg1,arg2,arg3) syscall (nr, arg1, arg2, arg3)
1839
+ #define ev_syscall4(nr,arg1,arg2,arg3,arg4) syscall (nr, arg1, arg2, arg3, arg4)
1840
+ #define ev_syscall5(nr,arg1,arg2,arg3,arg4,arg5) syscall (nr, arg1, arg2, arg3, arg4, arg5)
1841
+ #define ev_syscall6(nr,arg1,arg2,arg3,arg4,arg5,arg6) syscall (nr, arg1, arg2, arg3, arg4, arg5,arg6)
1533
1842
  #endif
1534
1843
 
1844
+ #endif
1845
+
1846
+ /*****************************************************************************/
1847
+
1535
1848
  #define NUMPRI (EV_MAXPRI - EV_MINPRI + 1)
1536
1849
 
1537
1850
  #if EV_MINPRI == EV_MAXPRI
@@ -1540,8 +1853,7 @@ ecb_binary32_to_binary16 (uint32_t x)
1540
1853
  # define ABSPRI(w) (((W)w)->priority - EV_MINPRI)
1541
1854
  #endif
1542
1855
 
1543
- #define EMPTY /* required for microsofts broken pseudo-c compiler */
1544
- #define EMPTY2(a,b) /* used to suppress some warnings */
1856
+ #define EMPTY /* required for microsofts broken pseudo-c compiler */
1545
1857
 
1546
1858
  typedef ev_watcher *W;
1547
1859
  typedef ev_watcher_list *WL;
@@ -1576,6 +1888,10 @@ static EV_ATOMIC_T have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work?
1576
1888
 
1577
1889
  /*****************************************************************************/
1578
1890
 
1891
+ #if EV_USE_LINUXAIO
1892
+ # include <linux/aio_abi.h> /* probably only needed for aio_context_t */
1893
+ #endif
1894
+
1579
1895
  /* define a suitable floor function (only used by periodics atm) */
1580
1896
 
1581
1897
  #if EV_USE_FLOOR
@@ -1586,7 +1902,7 @@ static EV_ATOMIC_T have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work?
1586
1902
  #include <float.h>
1587
1903
 
1588
1904
  /* a floor() replacement function, should be independent of ev_tstamp type */
1589
- noinline
1905
+ ecb_noinline
1590
1906
  static ev_tstamp
1591
1907
  ev_floor (ev_tstamp v)
1592
1908
  {
@@ -1597,26 +1913,26 @@ ev_floor (ev_tstamp v)
1597
1913
  const ev_tstamp shift = sizeof (unsigned long) >= 8 ? 18446744073709551616. : 4294967296.;
1598
1914
  #endif
1599
1915
 
1600
- /* argument too large for an unsigned long? */
1601
- if (expect_false (v >= shift))
1916
+ /* special treatment for negative arguments */
1917
+ if (ecb_expect_false (v < 0.))
1918
+ {
1919
+ ev_tstamp f = -ev_floor (-v);
1920
+
1921
+ return f - (f == v ? 0 : 1);
1922
+ }
1923
+
1924
+ /* argument too large for an unsigned long? then reduce it */
1925
+ if (ecb_expect_false (v >= shift))
1602
1926
  {
1603
1927
  ev_tstamp f;
1604
1928
 
1605
1929
  if (v == v - 1.)
1606
- return v; /* very large number */
1930
+ return v; /* very large numbers are assumed to be integer */
1607
1931
 
1608
1932
  f = shift * ev_floor (v * (1. / shift));
1609
1933
  return f + ev_floor (v - f);
1610
1934
  }
1611
1935
 
1612
- /* special treatment for negative args? */
1613
- if (expect_false (v < 0.))
1614
- {
1615
- ev_tstamp f = -ev_floor (-v);
1616
-
1617
- return f - (f == v ? 0 : 1);
1618
- }
1619
-
1620
1936
  /* fits into an unsigned long */
1621
1937
  return (unsigned long)v;
1622
1938
  }
@@ -1629,7 +1945,7 @@ ev_floor (ev_tstamp v)
1629
1945
  # include <sys/utsname.h>
1630
1946
  #endif
1631
1947
 
1632
- noinline ecb_cold
1948
+ ecb_noinline ecb_cold
1633
1949
  static unsigned int
1634
1950
  ev_linux_version (void)
1635
1951
  {
@@ -1669,7 +1985,7 @@ ev_linux_version (void)
1669
1985
  /*****************************************************************************/
1670
1986
 
1671
1987
  #if EV_AVOID_STDIO
1672
- noinline ecb_cold
1988
+ ecb_noinline ecb_cold
1673
1989
  static void
1674
1990
  ev_printerr (const char *msg)
1675
1991
  {
@@ -1677,16 +1993,16 @@ ev_printerr (const char *msg)
1677
1993
  }
1678
1994
  #endif
1679
1995
 
1680
- static void (*syserr_cb)(const char *msg) EV_THROW;
1996
+ static void (*syserr_cb)(const char *msg) EV_NOEXCEPT;
1681
1997
 
1682
1998
  ecb_cold
1683
1999
  void
1684
- ev_set_syserr_cb (void (*cb)(const char *msg) EV_THROW) EV_THROW
2000
+ ev_set_syserr_cb (void (*cb)(const char *msg) EV_NOEXCEPT) EV_NOEXCEPT
1685
2001
  {
1686
2002
  syserr_cb = cb;
1687
2003
  }
1688
2004
 
1689
- noinline ecb_cold
2005
+ ecb_noinline ecb_cold
1690
2006
  static void
1691
2007
  ev_syserr (const char *msg)
1692
2008
  {
@@ -1710,7 +2026,7 @@ ev_syserr (const char *msg)
1710
2026
  }
1711
2027
 
1712
2028
  static void *
1713
- ev_realloc_emul (void *ptr, long size) EV_THROW
2029
+ ev_realloc_emul (void *ptr, long size) EV_NOEXCEPT
1714
2030
  {
1715
2031
  /* some systems, notably openbsd and darwin, fail to properly
1716
2032
  * implement realloc (x, 0) (as required by both ansi c-89 and
@@ -1726,11 +2042,11 @@ ev_realloc_emul (void *ptr, long size) EV_THROW
1726
2042
  return 0;
1727
2043
  }
1728
2044
 
1729
- static void *(*alloc)(void *ptr, long size) EV_THROW = ev_realloc_emul;
2045
+ static void *(*alloc)(void *ptr, long size) EV_NOEXCEPT = ev_realloc_emul;
1730
2046
 
1731
2047
  ecb_cold
1732
2048
  void
1733
- ev_set_allocator (void *(*cb)(void *ptr, long size) EV_THROW) EV_THROW
2049
+ ev_set_allocator (void *(*cb)(void *ptr, long size) EV_NOEXCEPT) EV_NOEXCEPT
1734
2050
  {
1735
2051
  alloc = cb;
1736
2052
  }
@@ -1767,8 +2083,8 @@ typedef struct
1767
2083
  WL head;
1768
2084
  unsigned char events; /* the events watched for */
1769
2085
  unsigned char reify; /* flag set when this ANFD needs reification (EV_ANFD_REIFY, EV__IOFDSET) */
1770
- unsigned char emask; /* the epoll backend stores the actual kernel mask in here */
1771
- unsigned char unused;
2086
+ unsigned char emask; /* some backends store the actual kernel mask in here */
2087
+ unsigned char eflags; /* flags field for use by backends */
1772
2088
  #if EV_USE_EPOLL
1773
2089
  unsigned int egen; /* generation counter to counter epoll bugs */
1774
2090
  #endif
@@ -1832,7 +2148,7 @@ typedef struct
1832
2148
 
1833
2149
  #else
1834
2150
 
1835
- EV_API_DECL ev_tstamp ev_rt_now = 0; /* needs to be initialised to make it a definition despite extern */
2151
+ EV_API_DECL ev_tstamp ev_rt_now = EV_TS_CONST (0.); /* needs to be initialised to make it a definition despite extern */
1836
2152
  #define VAR(name,decl) static decl;
1837
2153
  #include "ev_vars.h"
1838
2154
  #undef VAR
@@ -1842,8 +2158,8 @@ typedef struct
1842
2158
  #endif
1843
2159
 
1844
2160
  #if EV_FEATURE_API
1845
- # define EV_RELEASE_CB if (expect_false (release_cb)) release_cb (EV_A)
1846
- # define EV_ACQUIRE_CB if (expect_false (acquire_cb)) acquire_cb (EV_A)
2161
+ # define EV_RELEASE_CB if (ecb_expect_false (release_cb)) release_cb (EV_A)
2162
+ # define EV_ACQUIRE_CB if (ecb_expect_false (acquire_cb)) acquire_cb (EV_A)
1847
2163
  # define EV_INVOKE_PENDING invoke_cb (EV_A)
1848
2164
  #else
1849
2165
  # define EV_RELEASE_CB (void)0
@@ -1857,20 +2173,22 @@ typedef struct
1857
2173
 
1858
2174
  #ifndef EV_HAVE_EV_TIME
1859
2175
  ev_tstamp
1860
- ev_time (void) EV_THROW
2176
+ ev_time (void) EV_NOEXCEPT
1861
2177
  {
1862
2178
  #if EV_USE_REALTIME
1863
- if (expect_true (have_realtime))
2179
+ if (ecb_expect_true (have_realtime))
1864
2180
  {
1865
2181
  struct timespec ts;
1866
2182
  clock_gettime (CLOCK_REALTIME, &ts);
1867
- return ts.tv_sec + ts.tv_nsec * 1e-9;
2183
+ return EV_TS_GET (ts);
1868
2184
  }
1869
2185
  #endif
1870
2186
 
1871
- struct timeval tv;
1872
- gettimeofday (&tv, 0);
1873
- return tv.tv_sec + tv.tv_usec * 1e-6;
2187
+ {
2188
+ struct timeval tv;
2189
+ gettimeofday (&tv, 0);
2190
+ return EV_TV_GET (tv);
2191
+ }
1874
2192
  }
1875
2193
  #endif
1876
2194
 
@@ -1878,11 +2196,11 @@ inline_size ev_tstamp
1878
2196
  get_clock (void)
1879
2197
  {
1880
2198
  #if EV_USE_MONOTONIC
1881
- if (expect_true (have_monotonic))
2199
+ if (ecb_expect_true (have_monotonic))
1882
2200
  {
1883
2201
  struct timespec ts;
1884
2202
  clock_gettime (CLOCK_MONOTONIC, &ts);
1885
- return ts.tv_sec + ts.tv_nsec * 1e-9;
2203
+ return EV_TS_GET (ts);
1886
2204
  }
1887
2205
  #endif
1888
2206
 
@@ -1891,16 +2209,16 @@ get_clock (void)
1891
2209
 
1892
2210
  #if EV_MULTIPLICITY
1893
2211
  ev_tstamp
1894
- ev_now (EV_P) EV_THROW
2212
+ ev_now (EV_P) EV_NOEXCEPT
1895
2213
  {
1896
2214
  return ev_rt_now;
1897
2215
  }
1898
2216
  #endif
1899
2217
 
1900
2218
  void
1901
- ev_sleep (ev_tstamp delay) EV_THROW
2219
+ ev_sleep (ev_tstamp delay) EV_NOEXCEPT
1902
2220
  {
1903
- if (delay > 0.)
2221
+ if (delay > EV_TS_CONST (0.))
1904
2222
  {
1905
2223
  #if EV_USE_NANOSLEEP
1906
2224
  struct timespec ts;
@@ -1908,7 +2226,9 @@ ev_sleep (ev_tstamp delay) EV_THROW
1908
2226
  EV_TS_SET (ts, delay);
1909
2227
  nanosleep (&ts, 0);
1910
2228
  #elif defined _WIN32
1911
- Sleep ((unsigned long)(delay * 1e3));
2229
+ /* maybe this should round up, as ms is very low resolution */
2230
+ /* compared to select (µs) or nanosleep (ns) */
2231
+ Sleep ((unsigned long)(EV_TS_TO_MSEC (delay)));
1912
2232
  #else
1913
2233
  struct timeval tv;
1914
2234
 
@@ -1948,7 +2268,7 @@ array_nextsize (int elem, int cur, int cnt)
1948
2268
  return ncur;
1949
2269
  }
1950
2270
 
1951
- noinline ecb_cold
2271
+ ecb_noinline ecb_cold
1952
2272
  static void *
1953
2273
  array_realloc (int elem, void *base, int *cur, int cnt)
1954
2274
  {
@@ -1956,16 +2276,18 @@ array_realloc (int elem, void *base, int *cur, int cnt)
1956
2276
  return ev_realloc (base, elem * *cur);
1957
2277
  }
1958
2278
 
1959
- #define array_init_zero(base,count) \
1960
- memset ((void *)(base), 0, sizeof (*(base)) * (count))
2279
+ #define array_needsize_noinit(base,offset,count)
2280
+
2281
+ #define array_needsize_zerofill(base,offset,count) \
2282
+ memset ((void *)(base + offset), 0, sizeof (*(base)) * (count))
1961
2283
 
1962
2284
  #define array_needsize(type,base,cur,cnt,init) \
1963
- if (expect_false ((cnt) > (cur))) \
2285
+ if (ecb_expect_false ((cnt) > (cur))) \
1964
2286
  { \
1965
2287
  ecb_unused int ocur_ = (cur); \
1966
2288
  (base) = (type *)array_realloc \
1967
2289
  (sizeof (type), (base), &(cur), (cnt)); \
1968
- init ((base) + (ocur_), (cur) - ocur_); \
2290
+ init ((base), ocur_, ((cur) - ocur_)); \
1969
2291
  }
1970
2292
 
1971
2293
  #if 0
@@ -1984,25 +2306,25 @@ array_realloc (int elem, void *base, int *cur, int cnt)
1984
2306
  /*****************************************************************************/
1985
2307
 
1986
2308
  /* dummy callback for pending events */
1987
- noinline
2309
+ ecb_noinline
1988
2310
  static void
1989
2311
  pendingcb (EV_P_ ev_prepare *w, int revents)
1990
2312
  {
1991
2313
  }
1992
2314
 
1993
- noinline
2315
+ ecb_noinline
1994
2316
  void
1995
- ev_feed_event (EV_P_ void *w, int revents) EV_THROW
2317
+ ev_feed_event (EV_P_ void *w, int revents) EV_NOEXCEPT
1996
2318
  {
1997
2319
  W w_ = (W)w;
1998
2320
  int pri = ABSPRI (w_);
1999
2321
 
2000
- if (expect_false (w_->pending))
2322
+ if (ecb_expect_false (w_->pending))
2001
2323
  pendings [pri][w_->pending - 1].events |= revents;
2002
2324
  else
2003
2325
  {
2004
2326
  w_->pending = ++pendingcnt [pri];
2005
- array_needsize (ANPENDING, pendings [pri], pendingmax [pri], w_->pending, EMPTY2);
2327
+ array_needsize (ANPENDING, pendings [pri], pendingmax [pri], w_->pending, array_needsize_noinit);
2006
2328
  pendings [pri][w_->pending - 1].w = w_;
2007
2329
  pendings [pri][w_->pending - 1].events = revents;
2008
2330
  }
@@ -2013,7 +2335,7 @@ ev_feed_event (EV_P_ void *w, int revents) EV_THROW
2013
2335
  inline_speed void
2014
2336
  feed_reverse (EV_P_ W w)
2015
2337
  {
2016
- array_needsize (W, rfeeds, rfeedmax, rfeedcnt + 1, EMPTY2);
2338
+ array_needsize (W, rfeeds, rfeedmax, rfeedcnt + 1, array_needsize_noinit);
2017
2339
  rfeeds [rfeedcnt++] = w;
2018
2340
  }
2019
2341
 
@@ -2058,12 +2380,12 @@ fd_event (EV_P_ int fd, int revents)
2058
2380
  {
2059
2381
  ANFD *anfd = anfds + fd;
2060
2382
 
2061
- if (expect_true (!anfd->reify))
2383
+ if (ecb_expect_true (!anfd->reify))
2062
2384
  fd_event_nocheck (EV_A_ fd, revents);
2063
2385
  }
2064
2386
 
2065
2387
  void
2066
- ev_feed_fd_event (EV_P_ int fd, int revents) EV_THROW
2388
+ ev_feed_fd_event (EV_P_ int fd, int revents) EV_NOEXCEPT
2067
2389
  {
2068
2390
  if (fd >= 0 && fd < anfdmax)
2069
2391
  fd_event_nocheck (EV_A_ fd, revents);
@@ -2076,8 +2398,20 @@ fd_reify (EV_P)
2076
2398
  {
2077
2399
  int i;
2078
2400
 
2401
+ /* most backends do not modify the fdchanges list in backend_modfiy.
2402
+ * except io_uring, which has fixed-size buffers which might force us
2403
+ * to handle events in backend_modify, causing fdchanges to be amended,
2404
+ * which could result in an endless loop.
2405
+ * to avoid this, we do not dynamically handle fds that were added
2406
+ * during fd_reify. that means that for those backends, fdchangecnt
2407
+ * might be non-zero during poll, which must cause them to not block.
2408
+ * to not put too much of a burden on other backends, this detail
2409
+ * needs to be handled in the backend.
2410
+ */
2411
+ int changecnt = fdchangecnt;
2412
+
2079
2413
  #if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP
2080
- for (i = 0; i < fdchangecnt; ++i)
2414
+ for (i = 0; i < changecnt; ++i)
2081
2415
  {
2082
2416
  int fd = fdchanges [i];
2083
2417
  ANFD *anfd = anfds + fd;
@@ -2101,7 +2435,7 @@ fd_reify (EV_P)
2101
2435
  }
2102
2436
  #endif
2103
2437
 
2104
- for (i = 0; i < fdchangecnt; ++i)
2438
+ for (i = 0; i < changecnt; ++i)
2105
2439
  {
2106
2440
  int fd = fdchanges [i];
2107
2441
  ANFD *anfd = anfds + fd;
@@ -2110,9 +2444,9 @@ fd_reify (EV_P)
2110
2444
  unsigned char o_events = anfd->events;
2111
2445
  unsigned char o_reify = anfd->reify;
2112
2446
 
2113
- anfd->reify = 0;
2447
+ anfd->reify = 0;
2114
2448
 
2115
- /*if (expect_true (o_reify & EV_ANFD_REIFY)) probably a deoptimisation */
2449
+ /*if (ecb_expect_true (o_reify & EV_ANFD_REIFY)) probably a deoptimisation */
2116
2450
  {
2117
2451
  anfd->events = 0;
2118
2452
 
@@ -2127,7 +2461,14 @@ fd_reify (EV_P)
2127
2461
  backend_modify (EV_A_ fd, o_events, anfd->events);
2128
2462
  }
2129
2463
 
2130
- fdchangecnt = 0;
2464
+ /* normally, fdchangecnt hasn't changed. if it has, then new fds have been added.
2465
+ * this is a rare case (see beginning comment in this function), so we copy them to the
2466
+ * front and hope the backend handles this case.
2467
+ */
2468
+ if (ecb_expect_false (fdchangecnt != changecnt))
2469
+ memmove (fdchanges, fdchanges + changecnt, (fdchangecnt - changecnt) * sizeof (*fdchanges));
2470
+
2471
+ fdchangecnt -= changecnt;
2131
2472
  }
2132
2473
 
2133
2474
  /* something about the given fd changed */
@@ -2136,12 +2477,12 @@ void
2136
2477
  fd_change (EV_P_ int fd, int flags)
2137
2478
  {
2138
2479
  unsigned char reify = anfds [fd].reify;
2139
- anfds [fd].reify |= flags;
2480
+ anfds [fd].reify = reify | flags;
2140
2481
 
2141
- if (expect_true (!reify))
2482
+ if (ecb_expect_true (!reify))
2142
2483
  {
2143
2484
  ++fdchangecnt;
2144
- array_needsize (int, fdchanges, fdchangemax, fdchangecnt, EMPTY2);
2485
+ array_needsize (int, fdchanges, fdchangemax, fdchangecnt, array_needsize_noinit);
2145
2486
  fdchanges [fdchangecnt - 1] = fd;
2146
2487
  }
2147
2488
  }
@@ -2171,7 +2512,7 @@ fd_valid (int fd)
2171
2512
  }
2172
2513
 
2173
2514
  /* called on EBADF to verify fds */
2174
- noinline ecb_cold
2515
+ ecb_noinline ecb_cold
2175
2516
  static void
2176
2517
  fd_ebadf (EV_P)
2177
2518
  {
@@ -2184,7 +2525,7 @@ fd_ebadf (EV_P)
2184
2525
  }
2185
2526
 
2186
2527
  /* called on ENOMEM in select/poll to kill some fds and retry */
2187
- noinline ecb_cold
2528
+ ecb_noinline ecb_cold
2188
2529
  static void
2189
2530
  fd_enomem (EV_P)
2190
2531
  {
@@ -2199,7 +2540,7 @@ fd_enomem (EV_P)
2199
2540
  }
2200
2541
 
2201
2542
  /* usually called after fork if backend needs to re-arm all fds from scratch */
2202
- noinline
2543
+ ecb_noinline
2203
2544
  static void
2204
2545
  fd_rearm_all (EV_P)
2205
2546
  {
@@ -2263,19 +2604,19 @@ downheap (ANHE *heap, int N, int k)
2263
2604
  ANHE *pos = heap + DHEAP * (k - HEAP0) + HEAP0 + 1;
2264
2605
 
2265
2606
  /* find minimum child */
2266
- if (expect_true (pos + DHEAP - 1 < E))
2607
+ if (ecb_expect_true (pos + DHEAP - 1 < E))
2267
2608
  {
2268
2609
  /* fast path */ (minpos = pos + 0), (minat = ANHE_at (*minpos));
2269
- if ( ANHE_at (pos [1]) < minat) (minpos = pos + 1), (minat = ANHE_at (*minpos));
2270
- if ( ANHE_at (pos [2]) < minat) (minpos = pos + 2), (minat = ANHE_at (*minpos));
2271
- if ( ANHE_at (pos [3]) < minat) (minpos = pos + 3), (minat = ANHE_at (*minpos));
2610
+ if ( minat > ANHE_at (pos [1])) (minpos = pos + 1), (minat = ANHE_at (*minpos));
2611
+ if ( minat > ANHE_at (pos [2])) (minpos = pos + 2), (minat = ANHE_at (*minpos));
2612
+ if ( minat > ANHE_at (pos [3])) (minpos = pos + 3), (minat = ANHE_at (*minpos));
2272
2613
  }
2273
2614
  else if (pos < E)
2274
2615
  {
2275
2616
  /* slow path */ (minpos = pos + 0), (minat = ANHE_at (*minpos));
2276
- if (pos + 1 < E && ANHE_at (pos [1]) < minat) (minpos = pos + 1), (minat = ANHE_at (*minpos));
2277
- if (pos + 2 < E && ANHE_at (pos [2]) < minat) (minpos = pos + 2), (minat = ANHE_at (*minpos));
2278
- if (pos + 3 < E && ANHE_at (pos [3]) < minat) (minpos = pos + 3), (minat = ANHE_at (*minpos));
2617
+ if (pos + 1 < E && minat > ANHE_at (pos [1])) (minpos = pos + 1), (minat = ANHE_at (*minpos));
2618
+ if (pos + 2 < E && minat > ANHE_at (pos [2])) (minpos = pos + 2), (minat = ANHE_at (*minpos));
2619
+ if (pos + 3 < E && minat > ANHE_at (pos [3])) (minpos = pos + 3), (minat = ANHE_at (*minpos));
2279
2620
  }
2280
2621
  else
2281
2622
  break;
@@ -2293,7 +2634,7 @@ downheap (ANHE *heap, int N, int k)
2293
2634
  ev_active (ANHE_w (he)) = k;
2294
2635
  }
2295
2636
 
2296
- #else /* 4HEAP */
2637
+ #else /* not 4HEAP */
2297
2638
 
2298
2639
  #define HEAP0 1
2299
2640
  #define HPARENT(k) ((k) >> 1)
@@ -2375,7 +2716,7 @@ reheap (ANHE *heap, int N)
2375
2716
 
2376
2717
  /*****************************************************************************/
2377
2718
 
2378
- /* associate signal watchers to a signal signal */
2719
+ /* associate signal watchers to a signal */
2379
2720
  typedef struct
2380
2721
  {
2381
2722
  EV_ATOMIC_T pending;
@@ -2391,7 +2732,7 @@ static ANSIG signals [EV_NSIG - 1];
2391
2732
 
2392
2733
  #if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE
2393
2734
 
2394
- noinline ecb_cold
2735
+ ecb_noinline ecb_cold
2395
2736
  static void
2396
2737
  evpipe_init (EV_P)
2397
2738
  {
@@ -2442,7 +2783,7 @@ evpipe_write (EV_P_ EV_ATOMIC_T *flag)
2442
2783
  {
2443
2784
  ECB_MEMORY_FENCE; /* push out the write before this function was called, acquire flag */
2444
2785
 
2445
- if (expect_true (*flag))
2786
+ if (ecb_expect_true (*flag))
2446
2787
  return;
2447
2788
 
2448
2789
  *flag = 1;
@@ -2473,7 +2814,7 @@ evpipe_write (EV_P_ EV_ATOMIC_T *flag)
2473
2814
  #ifdef _WIN32
2474
2815
  WSABUF buf;
2475
2816
  DWORD sent;
2476
- buf.buf = &buf;
2817
+ buf.buf = (char *)&buf;
2477
2818
  buf.len = 1;
2478
2819
  WSASend (EV_FD_TO_WIN32_HANDLE (evpipe [1]), &buf, 1, &sent, 0, 0, 0);
2479
2820
  #else
@@ -2529,7 +2870,7 @@ pipecb (EV_P_ ev_io *iow, int revents)
2529
2870
  ECB_MEMORY_FENCE;
2530
2871
 
2531
2872
  for (i = EV_NSIG - 1; i--; )
2532
- if (expect_false (signals [i].pending))
2873
+ if (ecb_expect_false (signals [i].pending))
2533
2874
  ev_feed_signal_event (EV_A_ i + 1);
2534
2875
  }
2535
2876
  #endif
@@ -2555,7 +2896,7 @@ pipecb (EV_P_ ev_io *iow, int revents)
2555
2896
  /*****************************************************************************/
2556
2897
 
2557
2898
  void
2558
- ev_feed_signal (int signum) EV_THROW
2899
+ ev_feed_signal (int signum) EV_NOEXCEPT
2559
2900
  {
2560
2901
  #if EV_MULTIPLICITY
2561
2902
  EV_P;
@@ -2580,13 +2921,13 @@ ev_sighandler (int signum)
2580
2921
  ev_feed_signal (signum);
2581
2922
  }
2582
2923
 
2583
- noinline
2924
+ ecb_noinline
2584
2925
  void
2585
- ev_feed_signal_event (EV_P_ int signum) EV_THROW
2926
+ ev_feed_signal_event (EV_P_ int signum) EV_NOEXCEPT
2586
2927
  {
2587
2928
  WL w;
2588
2929
 
2589
- if (expect_false (signum <= 0 || signum >= EV_NSIG))
2930
+ if (ecb_expect_false (signum <= 0 || signum >= EV_NSIG))
2590
2931
  return;
2591
2932
 
2592
2933
  --signum;
@@ -2595,7 +2936,7 @@ ev_feed_signal_event (EV_P_ int signum) EV_THROW
2595
2936
  /* it is permissible to try to feed a signal to the wrong loop */
2596
2937
  /* or, likely more useful, feeding a signal nobody is waiting for */
2597
2938
 
2598
- if (expect_false (signals [signum].loop != EV_A))
2939
+ if (ecb_expect_false (signals [signum].loop != EV_A))
2599
2940
  return;
2600
2941
  #endif
2601
2942
 
@@ -2689,6 +3030,57 @@ childcb (EV_P_ ev_signal *sw, int revents)
2689
3030
 
2690
3031
  /*****************************************************************************/
2691
3032
 
3033
+ #if EV_USE_TIMERFD
3034
+
3035
+ static void periodics_reschedule (EV_P);
3036
+
3037
+ static void
3038
+ timerfdcb (EV_P_ ev_io *iow, int revents)
3039
+ {
3040
+ struct itimerspec its = { 0 };
3041
+
3042
+ its.it_value.tv_sec = ev_rt_now + (int)MAX_BLOCKTIME2;
3043
+ timerfd_settime (timerfd, TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET, &its, 0);
3044
+
3045
+ ev_rt_now = ev_time ();
3046
+ /* periodics_reschedule only needs ev_rt_now */
3047
+ /* but maybe in the future we want the full treatment. */
3048
+ /*
3049
+ now_floor = EV_TS_CONST (0.);
3050
+ time_update (EV_A_ EV_TSTAMP_HUGE);
3051
+ */
3052
+ #if EV_PERIODIC_ENABLE
3053
+ periodics_reschedule (EV_A);
3054
+ #endif
3055
+ }
3056
+
3057
+ ecb_noinline ecb_cold
3058
+ static void
3059
+ evtimerfd_init (EV_P)
3060
+ {
3061
+ if (!ev_is_active (&timerfd_w))
3062
+ {
3063
+ timerfd = timerfd_create (CLOCK_REALTIME, TFD_NONBLOCK | TFD_CLOEXEC);
3064
+
3065
+ if (timerfd >= 0)
3066
+ {
3067
+ fd_intern (timerfd); /* just to be sure */
3068
+
3069
+ ev_io_init (&timerfd_w, timerfdcb, timerfd, EV_READ);
3070
+ ev_set_priority (&timerfd_w, EV_MINPRI);
3071
+ ev_io_start (EV_A_ &timerfd_w);
3072
+ ev_unref (EV_A); /* watcher should not keep loop alive */
3073
+
3074
+ /* (re-) arm timer */
3075
+ timerfdcb (EV_A_ 0, 0);
3076
+ }
3077
+ }
3078
+ }
3079
+
3080
+ #endif
3081
+
3082
+ /*****************************************************************************/
3083
+
2692
3084
  #if EV_USE_IOCP
2693
3085
  # include "ev_iocp.c"
2694
3086
  #endif
@@ -2701,6 +3093,12 @@ childcb (EV_P_ ev_signal *sw, int revents)
2701
3093
  #if EV_USE_EPOLL
2702
3094
  # include "ev_epoll.c"
2703
3095
  #endif
3096
+ #if EV_USE_LINUXAIO
3097
+ # include "ev_linuxaio.c"
3098
+ #endif
3099
+ #if EV_USE_IOURING
3100
+ # include "ev_iouring.c"
3101
+ #endif
2704
3102
  #if EV_USE_POLL
2705
3103
  # include "ev_poll.c"
2706
3104
  #endif
@@ -2709,13 +3107,13 @@ childcb (EV_P_ ev_signal *sw, int revents)
2709
3107
  #endif
2710
3108
 
2711
3109
  ecb_cold int
2712
- ev_version_major (void) EV_THROW
3110
+ ev_version_major (void) EV_NOEXCEPT
2713
3111
  {
2714
3112
  return EV_VERSION_MAJOR;
2715
3113
  }
2716
3114
 
2717
3115
  ecb_cold int
2718
- ev_version_minor (void) EV_THROW
3116
+ ev_version_minor (void) EV_NOEXCEPT
2719
3117
  {
2720
3118
  return EV_VERSION_MINOR;
2721
3119
  }
@@ -2734,22 +3132,24 @@ enable_secure (void)
2734
3132
 
2735
3133
  ecb_cold
2736
3134
  unsigned int
2737
- ev_supported_backends (void) EV_THROW
3135
+ ev_supported_backends (void) EV_NOEXCEPT
2738
3136
  {
2739
3137
  unsigned int flags = 0;
2740
3138
 
2741
- if (EV_USE_PORT ) flags |= EVBACKEND_PORT;
2742
- if (EV_USE_KQUEUE) flags |= EVBACKEND_KQUEUE;
2743
- if (EV_USE_EPOLL ) flags |= EVBACKEND_EPOLL;
2744
- if (EV_USE_POLL ) flags |= EVBACKEND_POLL;
2745
- if (EV_USE_SELECT) flags |= EVBACKEND_SELECT;
2746
-
3139
+ if (EV_USE_PORT ) flags |= EVBACKEND_PORT;
3140
+ if (EV_USE_KQUEUE ) flags |= EVBACKEND_KQUEUE;
3141
+ if (EV_USE_EPOLL ) flags |= EVBACKEND_EPOLL;
3142
+ if (EV_USE_LINUXAIO ) flags |= EVBACKEND_LINUXAIO;
3143
+ if (EV_USE_IOURING && ev_linux_version () >= 0x050601) flags |= EVBACKEND_IOURING; /* 5.6.1+ */
3144
+ if (EV_USE_POLL ) flags |= EVBACKEND_POLL;
3145
+ if (EV_USE_SELECT ) flags |= EVBACKEND_SELECT;
3146
+
2747
3147
  return flags;
2748
3148
  }
2749
3149
 
2750
3150
  ecb_cold
2751
3151
  unsigned int
2752
- ev_recommended_backends (void) EV_THROW
3152
+ ev_recommended_backends (void) EV_NOEXCEPT
2753
3153
  {
2754
3154
  unsigned int flags = ev_supported_backends ();
2755
3155
 
@@ -2767,24 +3167,35 @@ ev_recommended_backends (void) EV_THROW
2767
3167
  flags &= ~EVBACKEND_POLL; /* poll return value is unusable (http://forums.freebsd.org/archive/index.php/t-10270.html) */
2768
3168
  #endif
2769
3169
 
3170
+ /* TODO: linuxaio is very experimental */
3171
+ #if !EV_RECOMMEND_LINUXAIO
3172
+ flags &= ~EVBACKEND_LINUXAIO;
3173
+ #endif
3174
+ /* TODO: linuxaio is super experimental */
3175
+ #if !EV_RECOMMEND_IOURING
3176
+ flags &= ~EVBACKEND_IOURING;
3177
+ #endif
3178
+
2770
3179
  return flags;
2771
3180
  }
2772
3181
 
2773
3182
  ecb_cold
2774
3183
  unsigned int
2775
- ev_embeddable_backends (void) EV_THROW
3184
+ ev_embeddable_backends (void) EV_NOEXCEPT
2776
3185
  {
2777
- int flags = EVBACKEND_EPOLL | EVBACKEND_KQUEUE | EVBACKEND_PORT;
3186
+ int flags = EVBACKEND_EPOLL | EVBACKEND_KQUEUE | EVBACKEND_PORT | EVBACKEND_IOURING;
2778
3187
 
2779
3188
  /* epoll embeddability broken on all linux versions up to at least 2.6.23 */
2780
3189
  if (ev_linux_version () < 0x020620) /* disable it on linux < 2.6.32 */
2781
3190
  flags &= ~EVBACKEND_EPOLL;
2782
3191
 
3192
+ /* EVBACKEND_LINUXAIO is theoretically embeddable, but suffers from a performance overhead */
3193
+
2783
3194
  return flags;
2784
3195
  }
2785
3196
 
2786
3197
  unsigned int
2787
- ev_backend (EV_P) EV_THROW
3198
+ ev_backend (EV_P) EV_NOEXCEPT
2788
3199
  {
2789
3200
  return backend;
2790
3201
  }
@@ -2803,49 +3214,49 @@ ev_loop_get_pipe (EV_P_ unsigned int index) EV_THROW
2803
3214
 
2804
3215
  #if EV_FEATURE_API
2805
3216
  unsigned int
2806
- ev_iteration (EV_P) EV_THROW
3217
+ ev_iteration (EV_P) EV_NOEXCEPT
2807
3218
  {
2808
3219
  return loop_count;
2809
3220
  }
2810
3221
 
2811
3222
  unsigned int
2812
- ev_depth (EV_P) EV_THROW
3223
+ ev_depth (EV_P) EV_NOEXCEPT
2813
3224
  {
2814
3225
  return loop_depth;
2815
3226
  }
2816
3227
 
2817
3228
  void
2818
- ev_set_io_collect_interval (EV_P_ ev_tstamp interval) EV_THROW
3229
+ ev_set_io_collect_interval (EV_P_ ev_tstamp interval) EV_NOEXCEPT
2819
3230
  {
2820
3231
  io_blocktime = interval;
2821
3232
  }
2822
3233
 
2823
3234
  void
2824
- ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval) EV_THROW
3235
+ ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval) EV_NOEXCEPT
2825
3236
  {
2826
3237
  timeout_blocktime = interval;
2827
3238
  }
2828
3239
 
2829
3240
  void
2830
- ev_set_userdata (EV_P_ void *data) EV_THROW
3241
+ ev_set_userdata (EV_P_ void *data) EV_NOEXCEPT
2831
3242
  {
2832
3243
  userdata = data;
2833
3244
  }
2834
3245
 
2835
3246
  void *
2836
- ev_userdata (EV_P) EV_THROW
3247
+ ev_userdata (EV_P) EV_NOEXCEPT
2837
3248
  {
2838
3249
  return userdata;
2839
3250
  }
2840
3251
 
2841
3252
  void
2842
- ev_set_invoke_pending_cb (EV_P_ ev_loop_callback invoke_pending_cb) EV_THROW
3253
+ ev_set_invoke_pending_cb (EV_P_ ev_loop_callback invoke_pending_cb) EV_NOEXCEPT
2843
3254
  {
2844
3255
  invoke_cb = invoke_pending_cb;
2845
3256
  }
2846
3257
 
2847
3258
  void
2848
- ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_THROW, void (*acquire)(EV_P) EV_THROW) EV_THROW
3259
+ ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_NOEXCEPT, void (*acquire)(EV_P) EV_NOEXCEPT) EV_NOEXCEPT
2849
3260
  {
2850
3261
  release_cb = release;
2851
3262
  acquire_cb = acquire;
@@ -2853,9 +3264,9 @@ ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_THROW, void (*acquire)(EV
2853
3264
  #endif
2854
3265
 
2855
3266
  /* initialise a loop structure, must be zero-initialised */
2856
- noinline ecb_cold
3267
+ ecb_noinline ecb_cold
2857
3268
  static void
2858
- loop_init (EV_P_ unsigned int flags) EV_THROW
3269
+ loop_init (EV_P_ unsigned int flags) EV_NOEXCEPT
2859
3270
  {
2860
3271
  if (!backend)
2861
3272
  {
@@ -2918,27 +3329,36 @@ loop_init (EV_P_ unsigned int flags) EV_THROW
2918
3329
  #if EV_USE_SIGNALFD
2919
3330
  sigfd = flags & EVFLAG_SIGNALFD ? -2 : -1;
2920
3331
  #endif
3332
+ #if EV_USE_TIMERFD
3333
+ timerfd = flags & EVFLAG_NOTIMERFD ? -1 : -2;
3334
+ #endif
2921
3335
 
2922
3336
  if (!(flags & EVBACKEND_MASK))
2923
3337
  flags |= ev_recommended_backends ();
2924
3338
 
2925
3339
  #if EV_USE_IOCP
2926
- if (!backend && (flags & EVBACKEND_IOCP )) backend = iocp_init (EV_A_ flags);
3340
+ if (!backend && (flags & EVBACKEND_IOCP )) backend = iocp_init (EV_A_ flags);
2927
3341
  #endif
2928
3342
  #if EV_USE_PORT
2929
- if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags);
3343
+ if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags);
2930
3344
  #endif
2931
3345
  #if EV_USE_KQUEUE
2932
- if (!backend && (flags & EVBACKEND_KQUEUE)) backend = kqueue_init (EV_A_ flags);
3346
+ if (!backend && (flags & EVBACKEND_KQUEUE )) backend = kqueue_init (EV_A_ flags);
3347
+ #endif
3348
+ #if EV_USE_IOURING
3349
+ if (!backend && (flags & EVBACKEND_IOURING )) backend = iouring_init (EV_A_ flags);
3350
+ #endif
3351
+ #if EV_USE_LINUXAIO
3352
+ if (!backend && (flags & EVBACKEND_LINUXAIO)) backend = linuxaio_init (EV_A_ flags);
2933
3353
  #endif
2934
3354
  #if EV_USE_EPOLL
2935
- if (!backend && (flags & EVBACKEND_EPOLL )) backend = epoll_init (EV_A_ flags);
3355
+ if (!backend && (flags & EVBACKEND_EPOLL )) backend = epoll_init (EV_A_ flags);
2936
3356
  #endif
2937
3357
  #if EV_USE_POLL
2938
- if (!backend && (flags & EVBACKEND_POLL )) backend = poll_init (EV_A_ flags);
3358
+ if (!backend && (flags & EVBACKEND_POLL )) backend = poll_init (EV_A_ flags);
2939
3359
  #endif
2940
3360
  #if EV_USE_SELECT
2941
- if (!backend && (flags & EVBACKEND_SELECT)) backend = select_init (EV_A_ flags);
3361
+ if (!backend && (flags & EVBACKEND_SELECT )) backend = select_init (EV_A_ flags);
2942
3362
  #endif
2943
3363
 
2944
3364
  ev_prepare_init (&pending_w, pendingcb);
@@ -2965,7 +3385,7 @@ ev_loop_destroy (EV_P)
2965
3385
 
2966
3386
  #if EV_CLEANUP_ENABLE
2967
3387
  /* queue cleanup watchers (and execute them) */
2968
- if (expect_false (cleanupcnt))
3388
+ if (ecb_expect_false (cleanupcnt))
2969
3389
  {
2970
3390
  queue_events (EV_A_ (W *)cleanups, cleanupcnt, EV_CLEANUP);
2971
3391
  EV_INVOKE_PENDING;
@@ -2994,6 +3414,11 @@ ev_loop_destroy (EV_P)
2994
3414
  close (sigfd);
2995
3415
  #endif
2996
3416
 
3417
+ #if EV_USE_TIMERFD
3418
+ if (ev_is_active (&timerfd_w))
3419
+ close (timerfd);
3420
+ #endif
3421
+
2997
3422
  #if EV_USE_INOTIFY
2998
3423
  if (fs_fd >= 0)
2999
3424
  close (fs_fd);
@@ -3003,22 +3428,28 @@ ev_loop_destroy (EV_P)
3003
3428
  close (backend_fd);
3004
3429
 
3005
3430
  #if EV_USE_IOCP
3006
- if (backend == EVBACKEND_IOCP ) iocp_destroy (EV_A);
3431
+ if (backend == EVBACKEND_IOCP ) iocp_destroy (EV_A);
3007
3432
  #endif
3008
3433
  #if EV_USE_PORT
3009
- if (backend == EVBACKEND_PORT ) port_destroy (EV_A);
3434
+ if (backend == EVBACKEND_PORT ) port_destroy (EV_A);
3010
3435
  #endif
3011
3436
  #if EV_USE_KQUEUE
3012
- if (backend == EVBACKEND_KQUEUE) kqueue_destroy (EV_A);
3437
+ if (backend == EVBACKEND_KQUEUE ) kqueue_destroy (EV_A);
3438
+ #endif
3439
+ #if EV_USE_IOURING
3440
+ if (backend == EVBACKEND_IOURING ) iouring_destroy (EV_A);
3441
+ #endif
3442
+ #if EV_USE_LINUXAIO
3443
+ if (backend == EVBACKEND_LINUXAIO) linuxaio_destroy (EV_A);
3013
3444
  #endif
3014
3445
  #if EV_USE_EPOLL
3015
- if (backend == EVBACKEND_EPOLL ) epoll_destroy (EV_A);
3446
+ if (backend == EVBACKEND_EPOLL ) epoll_destroy (EV_A);
3016
3447
  #endif
3017
3448
  #if EV_USE_POLL
3018
- if (backend == EVBACKEND_POLL ) poll_destroy (EV_A);
3449
+ if (backend == EVBACKEND_POLL ) poll_destroy (EV_A);
3019
3450
  #endif
3020
3451
  #if EV_USE_SELECT
3021
- if (backend == EVBACKEND_SELECT) select_destroy (EV_A);
3452
+ if (backend == EVBACKEND_SELECT ) select_destroy (EV_A);
3022
3453
  #endif
3023
3454
 
3024
3455
  for (i = NUMPRI; i--; )
@@ -3070,34 +3501,62 @@ inline_size void
3070
3501
  loop_fork (EV_P)
3071
3502
  {
3072
3503
  #if EV_USE_PORT
3073
- if (backend == EVBACKEND_PORT ) port_fork (EV_A);
3504
+ if (backend == EVBACKEND_PORT ) port_fork (EV_A);
3074
3505
  #endif
3075
3506
  #if EV_USE_KQUEUE
3076
- if (backend == EVBACKEND_KQUEUE) kqueue_fork (EV_A);
3507
+ if (backend == EVBACKEND_KQUEUE ) kqueue_fork (EV_A);
3508
+ #endif
3509
+ #if EV_USE_IOURING
3510
+ if (backend == EVBACKEND_IOURING ) iouring_fork (EV_A);
3511
+ #endif
3512
+ #if EV_USE_LINUXAIO
3513
+ if (backend == EVBACKEND_LINUXAIO) linuxaio_fork (EV_A);
3077
3514
  #endif
3078
3515
  #if EV_USE_EPOLL
3079
- if (backend == EVBACKEND_EPOLL ) epoll_fork (EV_A);
3516
+ if (backend == EVBACKEND_EPOLL ) epoll_fork (EV_A);
3080
3517
  #endif
3081
3518
  #if EV_USE_INOTIFY
3082
3519
  infy_fork (EV_A);
3083
3520
  #endif
3084
3521
 
3085
- #if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE
3086
- if (ev_is_active (&pipe_w) && postfork != 2)
3522
+ if (postfork != 2)
3087
3523
  {
3088
- /* pipe_write_wanted must be false now, so modifying fd vars should be safe */
3089
-
3090
- ev_ref (EV_A);
3091
- ev_io_stop (EV_A_ &pipe_w);
3092
-
3093
- if (evpipe [0] >= 0)
3094
- EV_WIN32_CLOSE_FD (evpipe [0]);
3524
+ #if EV_USE_SIGNALFD
3525
+ /* surprisingly, nothing needs to be done for signalfd, accoridng to docs, it does the right thing on fork */
3526
+ #endif
3527
+
3528
+ #if EV_USE_TIMERFD
3529
+ if (ev_is_active (&timerfd_w))
3530
+ {
3531
+ ev_ref (EV_A);
3532
+ ev_io_stop (EV_A_ &timerfd_w);
3095
3533
 
3096
- evpipe_init (EV_A);
3097
- /* iterate over everything, in case we missed something before */
3098
- ev_feed_event (EV_A_ &pipe_w, EV_CUSTOM);
3534
+ close (timerfd);
3535
+ timerfd = -2;
3536
+
3537
+ evtimerfd_init (EV_A);
3538
+ /* reschedule periodics, in case we missed something */
3539
+ ev_feed_event (EV_A_ &timerfd_w, EV_CUSTOM);
3540
+ }
3541
+ #endif
3542
+
3543
+ #if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE
3544
+ if (ev_is_active (&pipe_w))
3545
+ {
3546
+ /* pipe_write_wanted must be false now, so modifying fd vars should be safe */
3547
+
3548
+ ev_ref (EV_A);
3549
+ ev_io_stop (EV_A_ &pipe_w);
3550
+
3551
+ if (evpipe [0] >= 0)
3552
+ EV_WIN32_CLOSE_FD (evpipe [0]);
3553
+
3554
+ evpipe_init (EV_A);
3555
+ /* iterate over everything, in case we missed something before */
3556
+ ev_feed_event (EV_A_ &pipe_w, EV_CUSTOM);
3557
+ }
3558
+ #endif
3099
3559
  }
3100
- #endif
3101
3560
 
3102
3561
  postfork = 0;
3103
3562
  }
@@ -3106,7 +3565,7 @@ loop_fork (EV_P)
3106
3565
 
3107
3566
  ecb_cold
3108
3567
  struct ev_loop *
3109
- ev_loop_new (unsigned int flags) EV_THROW
3568
+ ev_loop_new (unsigned int flags) EV_NOEXCEPT
3110
3569
  {
3111
3570
  EV_P = (struct ev_loop *)ev_malloc (sizeof (struct ev_loop));
3112
3571
 
@@ -3123,7 +3582,7 @@ ev_loop_new (unsigned int flags) EV_THROW
3123
3582
  #endif /* multiplicity */
3124
3583
 
3125
3584
  #if EV_VERIFY
3126
- noinline ecb_cold
3585
+ ecb_noinline ecb_cold
3127
3586
  static void
3128
3587
  verify_watcher (EV_P_ W w)
3129
3588
  {
@@ -3133,7 +3592,7 @@ verify_watcher (EV_P_ W w)
3133
3592
  assert (("libev: pending watcher not on pending queue", pendings [ABSPRI (w)][w->pending - 1].w == w));
3134
3593
  }
3135
3594
 
3136
- noinline ecb_cold
3595
+ ecb_noinline ecb_cold
3137
3596
  static void
3138
3597
  verify_heap (EV_P_ ANHE *heap, int N)
3139
3598
  {
@@ -3149,7 +3608,7 @@ verify_heap (EV_P_ ANHE *heap, int N)
3149
3608
  }
3150
3609
  }
3151
3610
 
3152
- noinline ecb_cold
3611
+ ecb_noinline ecb_cold
3153
3612
  static void
3154
3613
  array_verify (EV_P_ W *ws, int cnt)
3155
3614
  {
@@ -3163,7 +3622,7 @@ array_verify (EV_P_ W *ws, int cnt)
3163
3622
 
3164
3623
  #if EV_FEATURE_API
3165
3624
  void ecb_cold
3166
- ev_verify (EV_P) EV_THROW
3625
+ ev_verify (EV_P) EV_NOEXCEPT
3167
3626
  {
3168
3627
  #if EV_VERIFY
3169
3628
  int i;
@@ -3254,7 +3713,7 @@ struct ev_loop *
3254
3713
  #else
3255
3714
  int
3256
3715
  #endif
3257
- ev_default_loop (unsigned int flags) EV_THROW
3716
+ ev_default_loop (unsigned int flags) EV_NOEXCEPT
3258
3717
  {
3259
3718
  if (!ev_default_loop_ptr)
3260
3719
  {
@@ -3283,7 +3742,7 @@ ev_default_loop (unsigned int flags) EV_THROW
3283
3742
  }
3284
3743
 
3285
3744
  void
3286
- ev_loop_fork (EV_P) EV_THROW
3745
+ ev_loop_fork (EV_P) EV_NOEXCEPT
3287
3746
  {
3288
3747
  postfork = 1;
3289
3748
  }
@@ -3297,7 +3756,7 @@ ev_invoke (EV_P_ void *w, int revents)
3297
3756
  }
3298
3757
 
3299
3758
  unsigned int
3300
- ev_pending_count (EV_P) EV_THROW
3759
+ ev_pending_count (EV_P) EV_NOEXCEPT
3301
3760
  {
3302
3761
  int pri;
3303
3762
  unsigned int count = 0;
@@ -3308,16 +3767,17 @@ ev_pending_count (EV_P) EV_THROW
3308
3767
  return count;
3309
3768
  }
3310
3769
 
3311
- noinline
3770
+ ecb_noinline
3312
3771
  void
3313
3772
  ev_invoke_pending (EV_P)
3314
3773
  {
3315
3774
  pendingpri = NUMPRI;
3316
3775
 
3317
- while (pendingpri) /* pendingpri possibly gets modified in the inner loop */
3776
+ do
3318
3777
  {
3319
3778
  --pendingpri;
3320
3779
 
3780
+ /* pendingpri possibly gets modified in the inner loop */
3321
3781
  while (pendingcnt [pendingpri])
3322
3782
  {
3323
3783
  ANPENDING *p = pendings [pendingpri] + --pendingcnt [pendingpri];
@@ -3327,6 +3787,7 @@ ev_invoke_pending (EV_P)
3327
3787
  EV_FREQUENT_CHECK;
3328
3788
  }
3329
3789
  }
3790
+ while (pendingpri);
3330
3791
  }
3331
3792
 
3332
3793
  #if EV_IDLE_ENABLE
@@ -3335,7 +3796,7 @@ ev_invoke_pending (EV_P)
3335
3796
  inline_size void
3336
3797
  idle_reify (EV_P)
3337
3798
  {
3338
- if (expect_false (idleall))
3799
+ if (ecb_expect_false (idleall))
3339
3800
  {
3340
3801
  int pri;
3341
3802
 
@@ -3375,7 +3836,7 @@ timers_reify (EV_P)
3375
3836
  if (ev_at (w) < mn_now)
3376
3837
  ev_at (w) = mn_now;
3377
3838
 
3378
- assert (("libev: negative ev_timer repeat value found while processing timers", w->repeat > 0.));
3839
+ assert (("libev: negative ev_timer repeat value found while processing timers", w->repeat > EV_TS_CONST (0.)));
3379
3840
 
3380
3841
  ANHE_at_cache (timers [HEAP0]);
3381
3842
  downheap (timers, timercnt, HEAP0);
@@ -3394,7 +3855,7 @@ timers_reify (EV_P)
3394
3855
 
3395
3856
  #if EV_PERIODIC_ENABLE
3396
3857
 
3397
- noinline
3858
+ ecb_noinline
3398
3859
  static void
3399
3860
  periodic_recalc (EV_P_ ev_periodic *w)
3400
3861
  {
@@ -3407,7 +3868,7 @@ periodic_recalc (EV_P_ ev_periodic *w)
3407
3868
  ev_tstamp nat = at + w->interval;
3408
3869
 
3409
3870
  /* when resolution fails us, we use ev_rt_now */
3410
- if (expect_false (nat == at))
3871
+ if (ecb_expect_false (nat == at))
3411
3872
  {
3412
3873
  at = ev_rt_now;
3413
3874
  break;
@@ -3463,7 +3924,7 @@ periodics_reify (EV_P)
3463
3924
 
3464
3925
  /* simply recalculate all periodics */
3465
3926
  /* TODO: maybe ensure that at least one event happens when jumping forward? */
3466
- noinline ecb_cold
3927
+ ecb_noinline ecb_cold
3467
3928
  static void
3468
3929
  periodics_reschedule (EV_P)
3469
3930
  {
@@ -3487,7 +3948,7 @@ periodics_reschedule (EV_P)
3487
3948
  #endif
3488
3949
 
3489
3950
  /* adjust all timers by a given offset */
3490
- noinline ecb_cold
3951
+ ecb_noinline ecb_cold
3491
3952
  static void
3492
3953
  timers_reschedule (EV_P_ ev_tstamp adjust)
3493
3954
  {
@@ -3507,7 +3968,7 @@ inline_speed void
3507
3968
  time_update (EV_P_ ev_tstamp max_block)
3508
3969
  {
3509
3970
  #if EV_USE_MONOTONIC
3510
- if (expect_true (have_monotonic))
3971
+ if (ecb_expect_true (have_monotonic))
3511
3972
  {
3512
3973
  int i;
3513
3974
  ev_tstamp odiff = rtmn_diff;
@@ -3516,7 +3977,7 @@ time_update (EV_P_ ev_tstamp max_block)
3516
3977
 
3517
3978
  /* only fetch the realtime clock every 0.5*MIN_TIMEJUMP seconds */
3518
3979
  /* interpolate in the meantime */
3519
- if (expect_true (mn_now - now_floor < MIN_TIMEJUMP * .5))
3980
+ if (ecb_expect_true (mn_now - now_floor < EV_TS_CONST (MIN_TIMEJUMP * .5)))
3520
3981
  {
3521
3982
  ev_rt_now = rtmn_diff + mn_now;
3522
3983
  return;
@@ -3540,7 +4001,7 @@ time_update (EV_P_ ev_tstamp max_block)
3540
4001
 
3541
4002
  diff = odiff - rtmn_diff;
3542
4003
 
3543
- if (expect_true ((diff < 0. ? -diff : diff) < MIN_TIMEJUMP))
4004
+ if (ecb_expect_true ((diff < EV_TS_CONST (0.) ? -diff : diff) < EV_TS_CONST (MIN_TIMEJUMP)))
3544
4005
  return; /* all is well */
3545
4006
 
3546
4007
  ev_rt_now = ev_time ();
@@ -3559,7 +4020,7 @@ time_update (EV_P_ ev_tstamp max_block)
3559
4020
  {
3560
4021
  ev_rt_now = ev_time ();
3561
4022
 
3562
- if (expect_false (mn_now > ev_rt_now || ev_rt_now > mn_now + max_block + MIN_TIMEJUMP))
4023
+ if (ecb_expect_false (mn_now > ev_rt_now || ev_rt_now > mn_now + max_block + EV_TS_CONST (MIN_TIMEJUMP)))
3563
4024
  {
3564
4025
  /* adjust timers. this is easy, as the offset is the same for all of them */
3565
4026
  timers_reschedule (EV_A_ ev_rt_now - mn_now);
@@ -3592,8 +4053,8 @@ ev_run (EV_P_ int flags)
3592
4053
  #endif
3593
4054
 
3594
4055
  #ifndef _WIN32
3595
- if (expect_false (curpid)) /* penalise the forking check even more */
3596
- if (expect_false (getpid () != curpid))
4056
+ if (ecb_expect_false (curpid)) /* penalise the forking check even more */
4057
+ if (ecb_expect_false (getpid () != curpid))
3597
4058
  {
3598
4059
  curpid = getpid ();
3599
4060
  postfork = 1;
@@ -3602,7 +4063,7 @@ ev_run (EV_P_ int flags)
3602
4063
 
3603
4064
  #if EV_FORK_ENABLE
3604
4065
  /* we might have forked, so queue fork handlers */
3605
- if (expect_false (postfork))
4066
+ if (ecb_expect_false (postfork))
3606
4067
  if (forkcnt)
3607
4068
  {
3608
4069
  queue_events (EV_A_ (W *)forks, forkcnt, EV_FORK);
@@ -3612,18 +4073,18 @@ ev_run (EV_P_ int flags)
3612
4073
 
3613
4074
  #if EV_PREPARE_ENABLE
3614
4075
  /* queue prepare watchers (and execute them) */
3615
- if (expect_false (preparecnt))
4076
+ if (ecb_expect_false (preparecnt))
3616
4077
  {
3617
4078
  queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE);
3618
4079
  EV_INVOKE_PENDING;
3619
4080
  }
3620
4081
  #endif
3621
4082
 
3622
- if (expect_false (loop_done))
4083
+ if (ecb_expect_false (loop_done))
3623
4084
  break;
3624
4085
 
3625
4086
  /* we might have forked, so reify kernel state if necessary */
3626
- if (expect_false (postfork))
4087
+ if (ecb_expect_false (postfork))
3627
4088
  loop_fork (EV_A);
3628
4089
 
3629
4090
  /* update fd-related kernel structures */
@@ -3638,16 +4099,28 @@ ev_run (EV_P_ int flags)
3638
4099
  ev_tstamp prev_mn_now = mn_now;
3639
4100
 
3640
4101
  /* update time to cancel out callback processing overhead */
3641
- time_update (EV_A_ 1e100);
4102
+ time_update (EV_A_ EV_TS_CONST (EV_TSTAMP_HUGE));
3642
4103
 
3643
4104
  /* from now on, we want a pipe-wake-up */
3644
4105
  pipe_write_wanted = 1;
3645
4106
 
3646
4107
  ECB_MEMORY_FENCE; /* make sure pipe_write_wanted is visible before we check for potential skips */
3647
4108
 
3648
- if (expect_true (!(flags & EVRUN_NOWAIT || idleall || !activecnt || pipe_write_skipped)))
4109
+ if (ecb_expect_true (!(flags & EVRUN_NOWAIT || idleall || !activecnt || pipe_write_skipped)))
3649
4110
  {
3650
- waittime = MAX_BLOCKTIME;
4111
+ waittime = EV_TS_CONST (MAX_BLOCKTIME);
4112
+
4113
+ #if EV_USE_TIMERFD
4114
+ /* sleep a lot longer when we can reliably detect timejumps */
4115
+ if (ecb_expect_true (timerfd >= 0))
4116
+ waittime = EV_TS_CONST (MAX_BLOCKTIME2);
4117
+ #endif
4118
+ #if !EV_PERIODIC_ENABLE
4119
+ /* without periodics but with monotonic clock there is no need */
4120
+ /* for any time jump detection, so sleep longer */
4121
+ if (ecb_expect_true (have_monotonic))
4122
+ waittime = EV_TS_CONST (MAX_BLOCKTIME2);
4123
+ #endif
3651
4124
 
3652
4125
  if (timercnt)
3653
4126
  {
@@ -3664,23 +4137,28 @@ ev_run (EV_P_ int flags)
3664
4137
  #endif
3665
4138
 
3666
4139
  /* don't let timeouts decrease the waittime below timeout_blocktime */
3667
- if (expect_false (waittime < timeout_blocktime))
4140
+ if (ecb_expect_false (waittime < timeout_blocktime))
3668
4141
  waittime = timeout_blocktime;
3669
4142
 
3670
- /* at this point, we NEED to wait, so we have to ensure */
3671
- /* to pass a minimum nonzero value to the backend */
3672
- if (expect_false (waittime < backend_mintime))
3673
- waittime = backend_mintime;
4143
+ /* now there are two more special cases left, either we have
4144
+ * already-expired timers, so we should not sleep, or we have timers
4145
+ * that expire very soon, in which case we need to wait for a minimum
4146
+ * amount of time for some event loop backends.
4147
+ */
4148
+ if (ecb_expect_false (waittime < backend_mintime))
4149
+ waittime = waittime <= EV_TS_CONST (0.)
4150
+ ? EV_TS_CONST (0.)
4151
+ : backend_mintime;
3674
4152
 
3675
4153
  /* extra check because io_blocktime is commonly 0 */
3676
- if (expect_false (io_blocktime))
4154
+ if (ecb_expect_false (io_blocktime))
3677
4155
  {
3678
4156
  sleeptime = io_blocktime - (mn_now - prev_mn_now);
3679
4157
 
3680
4158
  if (sleeptime > waittime - backend_mintime)
3681
4159
  sleeptime = waittime - backend_mintime;
3682
4160
 
3683
- if (expect_true (sleeptime > 0.))
4161
+ if (ecb_expect_true (sleeptime > EV_TS_CONST (0.)))
3684
4162
  {
3685
4163
  ev_sleep (sleeptime);
3686
4164
  waittime -= sleeptime;
@@ -3704,7 +4182,6 @@ ev_run (EV_P_ int flags)
3704
4182
  ev_feed_event (EV_A_ &pipe_w, EV_CUSTOM);
3705
4183
  }
3706
4184
 
3707
-
3708
4185
  /* update ev_rt_now, do magic */
3709
4186
  time_update (EV_A_ waittime + sleeptime);
3710
4187
  }
@@ -3722,13 +4199,13 @@ ev_run (EV_P_ int flags)
3722
4199
 
3723
4200
  #if EV_CHECK_ENABLE
3724
4201
  /* queue check watchers, to be executed first */
3725
- if (expect_false (checkcnt))
4202
+ if (ecb_expect_false (checkcnt))
3726
4203
  queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK);
3727
4204
  #endif
3728
4205
 
3729
4206
  EV_INVOKE_PENDING;
3730
4207
  }
3731
- while (expect_true (
4208
+ while (ecb_expect_true (
3732
4209
  activecnt
3733
4210
  && !loop_done
3734
4211
  && !(flags & (EVRUN_ONCE | EVRUN_NOWAIT))
@@ -3745,37 +4222,37 @@ ev_run (EV_P_ int flags)
3745
4222
  }
3746
4223
 
3747
4224
  void
3748
- ev_break (EV_P_ int how) EV_THROW
4225
+ ev_break (EV_P_ int how) EV_NOEXCEPT
3749
4226
  {
3750
4227
  loop_done = how;
3751
4228
  }
3752
4229
 
3753
4230
  void
3754
- ev_ref (EV_P) EV_THROW
4231
+ ev_ref (EV_P) EV_NOEXCEPT
3755
4232
  {
3756
4233
  ++activecnt;
3757
4234
  }
3758
4235
 
3759
4236
  void
3760
- ev_unref (EV_P) EV_THROW
4237
+ ev_unref (EV_P) EV_NOEXCEPT
3761
4238
  {
3762
4239
  --activecnt;
3763
4240
  }
3764
4241
 
3765
4242
  void
3766
- ev_now_update (EV_P) EV_THROW
4243
+ ev_now_update (EV_P) EV_NOEXCEPT
3767
4244
  {
3768
- time_update (EV_A_ 1e100);
4245
+ time_update (EV_A_ EV_TSTAMP_HUGE);
3769
4246
  }
3770
4247
 
3771
4248
  void
3772
- ev_suspend (EV_P) EV_THROW
4249
+ ev_suspend (EV_P) EV_NOEXCEPT
3773
4250
  {
3774
4251
  ev_now_update (EV_A);
3775
4252
  }
3776
4253
 
3777
4254
  void
3778
- ev_resume (EV_P) EV_THROW
4255
+ ev_resume (EV_P) EV_NOEXCEPT
3779
4256
  {
3780
4257
  ev_tstamp mn_prev = mn_now;
3781
4258
 
@@ -3802,7 +4279,7 @@ wlist_del (WL *head, WL elem)
3802
4279
  {
3803
4280
  while (*head)
3804
4281
  {
3805
- if (expect_true (*head == elem))
4282
+ if (ecb_expect_true (*head == elem))
3806
4283
  {
3807
4284
  *head = elem->next;
3808
4285
  break;
@@ -3824,12 +4301,12 @@ clear_pending (EV_P_ W w)
3824
4301
  }
3825
4302
 
3826
4303
  int
3827
- ev_clear_pending (EV_P_ void *w) EV_THROW
4304
+ ev_clear_pending (EV_P_ void *w) EV_NOEXCEPT
3828
4305
  {
3829
4306
  W w_ = (W)w;
3830
4307
  int pending = w_->pending;
3831
4308
 
3832
- if (expect_true (pending))
4309
+ if (ecb_expect_true (pending))
3833
4310
  {
3834
4311
  ANPENDING *p = pendings [ABSPRI (w_)] + pending - 1;
3835
4312
  p->w = (W)&pending_w;
@@ -3866,22 +4343,25 @@ ev_stop (EV_P_ W w)
3866
4343
 
3867
4344
  /*****************************************************************************/
3868
4345
 
3869
- noinline
4346
+ ecb_noinline
3870
4347
  void
3871
- ev_io_start (EV_P_ ev_io *w) EV_THROW
4348
+ ev_io_start (EV_P_ ev_io *w) EV_NOEXCEPT
3872
4349
  {
3873
4350
  int fd = w->fd;
3874
4351
 
3875
- if (expect_false (ev_is_active (w)))
4352
+ if (ecb_expect_false (ev_is_active (w)))
3876
4353
  return;
3877
4354
 
3878
4355
  assert (("libev: ev_io_start called with negative fd", fd >= 0));
3879
4356
  assert (("libev: ev_io_start called with illegal event mask", !(w->events & ~(EV__IOFDSET | EV_READ | EV_WRITE))));
3880
4357
 
4358
+ #if EV_VERIFY >= 2
4359
+ assert (("libev: ev_io_start called on watcher with invalid fd", fd_valid (fd)));
4360
+ #endif
3881
4361
  EV_FREQUENT_CHECK;
3882
4362
 
3883
4363
  ev_start (EV_A_ (W)w, 1);
3884
- array_needsize (ANFD, anfds, anfdmax, fd + 1, array_init_zero);
4364
+ array_needsize (ANFD, anfds, anfdmax, fd + 1, array_needsize_zerofill);
3885
4365
  wlist_add (&anfds[fd].head, (WL)w);
3886
4366
 
3887
4367
  /* common bug, apparently */
@@ -3893,16 +4373,19 @@ ev_io_start (EV_P_ ev_io *w) EV_THROW
3893
4373
  EV_FREQUENT_CHECK;
3894
4374
  }
3895
4375
 
3896
- noinline
4376
+ ecb_noinline
3897
4377
  void
3898
- ev_io_stop (EV_P_ ev_io *w) EV_THROW
4378
+ ev_io_stop (EV_P_ ev_io *w) EV_NOEXCEPT
3899
4379
  {
3900
4380
  clear_pending (EV_A_ (W)w);
3901
- if (expect_false (!ev_is_active (w)))
4381
+ if (ecb_expect_false (!ev_is_active (w)))
3902
4382
  return;
3903
4383
 
3904
4384
  assert (("libev: ev_io_stop called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax));
3905
4385
 
4386
+ #if EV_VERIFY >= 2
4387
+ assert (("libev: ev_io_stop called on watcher with invalid fd", fd_valid (w->fd)));
4388
+ #endif
3906
4389
  EV_FREQUENT_CHECK;
3907
4390
 
3908
4391
  wlist_del (&anfds[w->fd].head, (WL)w);
@@ -3913,11 +4396,11 @@ ev_io_stop (EV_P_ ev_io *w) EV_THROW
3913
4396
  EV_FREQUENT_CHECK;
3914
4397
  }
3915
4398
 
3916
- noinline
4399
+ ecb_noinline
3917
4400
  void
3918
- ev_timer_start (EV_P_ ev_timer *w) EV_THROW
4401
+ ev_timer_start (EV_P_ ev_timer *w) EV_NOEXCEPT
3919
4402
  {
3920
- if (expect_false (ev_is_active (w)))
4403
+ if (ecb_expect_false (ev_is_active (w)))
3921
4404
  return;
3922
4405
 
3923
4406
  ev_at (w) += mn_now;
@@ -3928,7 +4411,7 @@ ev_timer_start (EV_P_ ev_timer *w) EV_THROW
3928
4411
 
3929
4412
  ++timercnt;
3930
4413
  ev_start (EV_A_ (W)w, timercnt + HEAP0 - 1);
3931
- array_needsize (ANHE, timers, timermax, ev_active (w) + 1, EMPTY2);
4414
+ array_needsize (ANHE, timers, timermax, ev_active (w) + 1, array_needsize_noinit);
3932
4415
  ANHE_w (timers [ev_active (w)]) = (WT)w;
3933
4416
  ANHE_at_cache (timers [ev_active (w)]);
3934
4417
  upheap (timers, ev_active (w));
@@ -3938,12 +4421,12 @@ ev_timer_start (EV_P_ ev_timer *w) EV_THROW
3938
4421
  /*assert (("libev: internal timer heap corruption", timers [ev_active (w)] == (WT)w));*/
3939
4422
  }
3940
4423
 
3941
- noinline
4424
+ ecb_noinline
3942
4425
  void
3943
- ev_timer_stop (EV_P_ ev_timer *w) EV_THROW
4426
+ ev_timer_stop (EV_P_ ev_timer *w) EV_NOEXCEPT
3944
4427
  {
3945
4428
  clear_pending (EV_A_ (W)w);
3946
- if (expect_false (!ev_is_active (w)))
4429
+ if (ecb_expect_false (!ev_is_active (w)))
3947
4430
  return;
3948
4431
 
3949
4432
  EV_FREQUENT_CHECK;
@@ -3955,7 +4438,7 @@ ev_timer_stop (EV_P_ ev_timer *w) EV_THROW
3955
4438
 
3956
4439
  --timercnt;
3957
4440
 
3958
- if (expect_true (active < timercnt + HEAP0))
4441
+ if (ecb_expect_true (active < timercnt + HEAP0))
3959
4442
  {
3960
4443
  timers [active] = timers [timercnt + HEAP0];
3961
4444
  adjustheap (timers, timercnt, active);
@@ -3969,9 +4452,9 @@ ev_timer_stop (EV_P_ ev_timer *w) EV_THROW
3969
4452
  EV_FREQUENT_CHECK;
3970
4453
  }
3971
4454
 
3972
- noinline
4455
+ ecb_noinline
3973
4456
  void
3974
- ev_timer_again (EV_P_ ev_timer *w) EV_THROW
4457
+ ev_timer_again (EV_P_ ev_timer *w) EV_NOEXCEPT
3975
4458
  {
3976
4459
  EV_FREQUENT_CHECK;
3977
4460
 
@@ -3998,19 +4481,24 @@ ev_timer_again (EV_P_ ev_timer *w) EV_THROW
3998
4481
  }
3999
4482
 
4000
4483
  ev_tstamp
4001
- ev_timer_remaining (EV_P_ ev_timer *w) EV_THROW
4484
+ ev_timer_remaining (EV_P_ ev_timer *w) EV_NOEXCEPT
4002
4485
  {
4003
- return ev_at (w) - (ev_is_active (w) ? mn_now : 0.);
4486
+ return ev_at (w) - (ev_is_active (w) ? mn_now : EV_TS_CONST (0.));
4004
4487
  }
4005
4488
 
4006
4489
  #if EV_PERIODIC_ENABLE
4007
- noinline
4490
+ ecb_noinline
4008
4491
  void
4009
- ev_periodic_start (EV_P_ ev_periodic *w) EV_THROW
4492
+ ev_periodic_start (EV_P_ ev_periodic *w) EV_NOEXCEPT
4010
4493
  {
4011
- if (expect_false (ev_is_active (w)))
4494
+ if (ecb_expect_false (ev_is_active (w)))
4012
4495
  return;
4013
4496
 
4497
+ #if EV_USE_TIMERFD
4498
+ if (timerfd == -2)
4499
+ evtimerfd_init (EV_A);
4500
+ #endif
4501
+
4014
4502
  if (w->reschedule_cb)
4015
4503
  ev_at (w) = w->reschedule_cb (w, ev_rt_now);
4016
4504
  else if (w->interval)
@@ -4025,7 +4513,7 @@ ev_periodic_start (EV_P_ ev_periodic *w) EV_THROW
4025
4513
 
4026
4514
  ++periodiccnt;
4027
4515
  ev_start (EV_A_ (W)w, periodiccnt + HEAP0 - 1);
4028
- array_needsize (ANHE, periodics, periodicmax, ev_active (w) + 1, EMPTY2);
4516
+ array_needsize (ANHE, periodics, periodicmax, ev_active (w) + 1, array_needsize_noinit);
4029
4517
  ANHE_w (periodics [ev_active (w)]) = (WT)w;
4030
4518
  ANHE_at_cache (periodics [ev_active (w)]);
4031
4519
  upheap (periodics, ev_active (w));
@@ -4035,12 +4523,12 @@ ev_periodic_start (EV_P_ ev_periodic *w) EV_THROW
4035
4523
  /*assert (("libev: internal periodic heap corruption", ANHE_w (periodics [ev_active (w)]) == (WT)w));*/
4036
4524
  }
4037
4525
 
4038
- noinline
4526
+ ecb_noinline
4039
4527
  void
4040
- ev_periodic_stop (EV_P_ ev_periodic *w) EV_THROW
4528
+ ev_periodic_stop (EV_P_ ev_periodic *w) EV_NOEXCEPT
4041
4529
  {
4042
4530
  clear_pending (EV_A_ (W)w);
4043
- if (expect_false (!ev_is_active (w)))
4531
+ if (ecb_expect_false (!ev_is_active (w)))
4044
4532
  return;
4045
4533
 
4046
4534
  EV_FREQUENT_CHECK;
@@ -4052,7 +4540,7 @@ ev_periodic_stop (EV_P_ ev_periodic *w) EV_THROW
4052
4540
 
4053
4541
  --periodiccnt;
4054
4542
 
4055
- if (expect_true (active < periodiccnt + HEAP0))
4543
+ if (ecb_expect_true (active < periodiccnt + HEAP0))
4056
4544
  {
4057
4545
  periodics [active] = periodics [periodiccnt + HEAP0];
4058
4546
  adjustheap (periodics, periodiccnt, active);
@@ -4064,9 +4552,9 @@ ev_periodic_stop (EV_P_ ev_periodic *w) EV_THROW
4064
4552
  EV_FREQUENT_CHECK;
4065
4553
  }
4066
4554
 
4067
- noinline
4555
+ ecb_noinline
4068
4556
  void
4069
- ev_periodic_again (EV_P_ ev_periodic *w) EV_THROW
4557
+ ev_periodic_again (EV_P_ ev_periodic *w) EV_NOEXCEPT
4070
4558
  {
4071
4559
  /* TODO: use adjustheap and recalculation */
4072
4560
  ev_periodic_stop (EV_A_ w);
@@ -4080,11 +4568,11 @@ ev_periodic_again (EV_P_ ev_periodic *w) EV_THROW
4080
4568
 
4081
4569
  #if EV_SIGNAL_ENABLE
4082
4570
 
4083
- noinline
4571
+ ecb_noinline
4084
4572
  void
4085
- ev_signal_start (EV_P_ ev_signal *w) EV_THROW
4573
+ ev_signal_start (EV_P_ ev_signal *w) EV_NOEXCEPT
4086
4574
  {
4087
- if (expect_false (ev_is_active (w)))
4575
+ if (ecb_expect_false (ev_is_active (w)))
4088
4576
  return;
4089
4577
 
4090
4578
  assert (("libev: ev_signal_start called with illegal signal number", w->signum > 0 && w->signum < EV_NSIG));
@@ -4163,12 +4651,12 @@ ev_signal_start (EV_P_ ev_signal *w) EV_THROW
4163
4651
  EV_FREQUENT_CHECK;
4164
4652
  }
4165
4653
 
4166
- noinline
4654
+ ecb_noinline
4167
4655
  void
4168
- ev_signal_stop (EV_P_ ev_signal *w) EV_THROW
4656
+ ev_signal_stop (EV_P_ ev_signal *w) EV_NOEXCEPT
4169
4657
  {
4170
4658
  clear_pending (EV_A_ (W)w);
4171
- if (expect_false (!ev_is_active (w)))
4659
+ if (ecb_expect_false (!ev_is_active (w)))
4172
4660
  return;
4173
4661
 
4174
4662
  EV_FREQUENT_CHECK;
@@ -4206,12 +4694,12 @@ ev_signal_stop (EV_P_ ev_signal *w) EV_THROW
4206
4694
  #if EV_CHILD_ENABLE
4207
4695
 
4208
4696
  void
4209
- ev_child_start (EV_P_ ev_child *w) EV_THROW
4697
+ ev_child_start (EV_P_ ev_child *w) EV_NOEXCEPT
4210
4698
  {
4211
4699
  #if EV_MULTIPLICITY
4212
4700
  assert (("libev: child watchers are only supported in the default loop", loop == ev_default_loop_ptr));
4213
4701
  #endif
4214
- if (expect_false (ev_is_active (w)))
4702
+ if (ecb_expect_false (ev_is_active (w)))
4215
4703
  return;
4216
4704
 
4217
4705
  EV_FREQUENT_CHECK;
@@ -4223,10 +4711,10 @@ ev_child_start (EV_P_ ev_child *w) EV_THROW
4223
4711
  }
4224
4712
 
4225
4713
  void
4226
- ev_child_stop (EV_P_ ev_child *w) EV_THROW
4714
+ ev_child_stop (EV_P_ ev_child *w) EV_NOEXCEPT
4227
4715
  {
4228
4716
  clear_pending (EV_A_ (W)w);
4229
- if (expect_false (!ev_is_active (w)))
4717
+ if (ecb_expect_false (!ev_is_active (w)))
4230
4718
  return;
4231
4719
 
4232
4720
  EV_FREQUENT_CHECK;
@@ -4250,14 +4738,14 @@ ev_child_stop (EV_P_ ev_child *w) EV_THROW
4250
4738
  #define NFS_STAT_INTERVAL 30.1074891 /* for filesystems potentially failing inotify */
4251
4739
  #define MIN_STAT_INTERVAL 0.1074891
4252
4740
 
4253
- noinline static void stat_timer_cb (EV_P_ ev_timer *w_, int revents);
4741
+ ecb_noinline static void stat_timer_cb (EV_P_ ev_timer *w_, int revents);
4254
4742
 
4255
4743
  #if EV_USE_INOTIFY
4256
4744
 
4257
4745
  /* the * 2 is to allow for alignment padding, which for some reason is >> 8 */
4258
4746
  # define EV_INOTIFY_BUFSIZE (sizeof (struct inotify_event) * 2 + NAME_MAX)
4259
4747
 
4260
- noinline
4748
+ ecb_noinline
4261
4749
  static void
4262
4750
  infy_add (EV_P_ ev_stat *w)
4263
4751
  {
@@ -4332,7 +4820,7 @@ infy_add (EV_P_ ev_stat *w)
4332
4820
  if (ev_is_active (&w->timer)) ev_unref (EV_A);
4333
4821
  }
4334
4822
 
4335
- noinline
4823
+ ecb_noinline
4336
4824
  static void
4337
4825
  infy_del (EV_P_ ev_stat *w)
4338
4826
  {
@@ -4350,7 +4838,7 @@ infy_del (EV_P_ ev_stat *w)
4350
4838
  inotify_rm_watch (fs_fd, wd);
4351
4839
  }
4352
4840
 
4353
- noinline
4841
+ ecb_noinline
4354
4842
  static void
4355
4843
  infy_wd (EV_P_ int slot, int wd, struct inotify_event *ev)
4356
4844
  {
@@ -4498,7 +4986,7 @@ infy_fork (EV_P)
4498
4986
  #endif
4499
4987
 
4500
4988
  void
4501
- ev_stat_stat (EV_P_ ev_stat *w) EV_THROW
4989
+ ev_stat_stat (EV_P_ ev_stat *w) EV_NOEXCEPT
4502
4990
  {
4503
4991
  if (lstat (w->path, &w->attr) < 0)
4504
4992
  w->attr.st_nlink = 0;
@@ -4506,7 +4994,7 @@ ev_stat_stat (EV_P_ ev_stat *w) EV_THROW
4506
4994
  w->attr.st_nlink = 1;
4507
4995
  }
4508
4996
 
4509
- noinline
4997
+ ecb_noinline
4510
4998
  static void
4511
4999
  stat_timer_cb (EV_P_ ev_timer *w_, int revents)
4512
5000
  {
@@ -4548,9 +5036,9 @@ stat_timer_cb (EV_P_ ev_timer *w_, int revents)
4548
5036
  }
4549
5037
 
4550
5038
  void
4551
- ev_stat_start (EV_P_ ev_stat *w) EV_THROW
5039
+ ev_stat_start (EV_P_ ev_stat *w) EV_NOEXCEPT
4552
5040
  {
4553
- if (expect_false (ev_is_active (w)))
5041
+ if (ecb_expect_false (ev_is_active (w)))
4554
5042
  return;
4555
5043
 
4556
5044
  ev_stat_stat (EV_A_ w);
@@ -4579,10 +5067,10 @@ ev_stat_start (EV_P_ ev_stat *w) EV_THROW
4579
5067
  }
4580
5068
 
4581
5069
  void
4582
- ev_stat_stop (EV_P_ ev_stat *w) EV_THROW
5070
+ ev_stat_stop (EV_P_ ev_stat *w) EV_NOEXCEPT
4583
5071
  {
4584
5072
  clear_pending (EV_A_ (W)w);
4585
- if (expect_false (!ev_is_active (w)))
5073
+ if (ecb_expect_false (!ev_is_active (w)))
4586
5074
  return;
4587
5075
 
4588
5076
  EV_FREQUENT_CHECK;
@@ -4605,9 +5093,9 @@ ev_stat_stop (EV_P_ ev_stat *w) EV_THROW
4605
5093
 
4606
5094
  #if EV_IDLE_ENABLE
4607
5095
  void
4608
- ev_idle_start (EV_P_ ev_idle *w) EV_THROW
5096
+ ev_idle_start (EV_P_ ev_idle *w) EV_NOEXCEPT
4609
5097
  {
4610
- if (expect_false (ev_is_active (w)))
5098
+ if (ecb_expect_false (ev_is_active (w)))
4611
5099
  return;
4612
5100
 
4613
5101
  pri_adjust (EV_A_ (W)w);
@@ -4620,7 +5108,7 @@ ev_idle_start (EV_P_ ev_idle *w) EV_THROW
4620
5108
  ++idleall;
4621
5109
  ev_start (EV_A_ (W)w, active);
4622
5110
 
4623
- array_needsize (ev_idle *, idles [ABSPRI (w)], idlemax [ABSPRI (w)], active, EMPTY2);
5111
+ array_needsize (ev_idle *, idles [ABSPRI (w)], idlemax [ABSPRI (w)], active, array_needsize_noinit);
4624
5112
  idles [ABSPRI (w)][active - 1] = w;
4625
5113
  }
4626
5114
 
@@ -4628,10 +5116,10 @@ ev_idle_start (EV_P_ ev_idle *w) EV_THROW
4628
5116
  }
4629
5117
 
4630
5118
  void
4631
- ev_idle_stop (EV_P_ ev_idle *w) EV_THROW
5119
+ ev_idle_stop (EV_P_ ev_idle *w) EV_NOEXCEPT
4632
5120
  {
4633
5121
  clear_pending (EV_A_ (W)w);
4634
- if (expect_false (!ev_is_active (w)))
5122
+ if (ecb_expect_false (!ev_is_active (w)))
4635
5123
  return;
4636
5124
 
4637
5125
  EV_FREQUENT_CHECK;
@@ -4652,25 +5140,25 @@ ev_idle_stop (EV_P_ ev_idle *w) EV_THROW
4652
5140
 
4653
5141
  #if EV_PREPARE_ENABLE
4654
5142
  void
4655
- ev_prepare_start (EV_P_ ev_prepare *w) EV_THROW
5143
+ ev_prepare_start (EV_P_ ev_prepare *w) EV_NOEXCEPT
4656
5144
  {
4657
- if (expect_false (ev_is_active (w)))
5145
+ if (ecb_expect_false (ev_is_active (w)))
4658
5146
  return;
4659
5147
 
4660
5148
  EV_FREQUENT_CHECK;
4661
5149
 
4662
5150
  ev_start (EV_A_ (W)w, ++preparecnt);
4663
- array_needsize (ev_prepare *, prepares, preparemax, preparecnt, EMPTY2);
5151
+ array_needsize (ev_prepare *, prepares, preparemax, preparecnt, array_needsize_noinit);
4664
5152
  prepares [preparecnt - 1] = w;
4665
5153
 
4666
5154
  EV_FREQUENT_CHECK;
4667
5155
  }
4668
5156
 
4669
5157
  void
4670
- ev_prepare_stop (EV_P_ ev_prepare *w) EV_THROW
5158
+ ev_prepare_stop (EV_P_ ev_prepare *w) EV_NOEXCEPT
4671
5159
  {
4672
5160
  clear_pending (EV_A_ (W)w);
4673
- if (expect_false (!ev_is_active (w)))
5161
+ if (ecb_expect_false (!ev_is_active (w)))
4674
5162
  return;
4675
5163
 
4676
5164
  EV_FREQUENT_CHECK;
@@ -4690,25 +5178,25 @@ ev_prepare_stop (EV_P_ ev_prepare *w) EV_THROW
4690
5178
 
4691
5179
  #if EV_CHECK_ENABLE
4692
5180
  void
4693
- ev_check_start (EV_P_ ev_check *w) EV_THROW
5181
+ ev_check_start (EV_P_ ev_check *w) EV_NOEXCEPT
4694
5182
  {
4695
- if (expect_false (ev_is_active (w)))
5183
+ if (ecb_expect_false (ev_is_active (w)))
4696
5184
  return;
4697
5185
 
4698
5186
  EV_FREQUENT_CHECK;
4699
5187
 
4700
5188
  ev_start (EV_A_ (W)w, ++checkcnt);
4701
- array_needsize (ev_check *, checks, checkmax, checkcnt, EMPTY2);
5189
+ array_needsize (ev_check *, checks, checkmax, checkcnt, array_needsize_noinit);
4702
5190
  checks [checkcnt - 1] = w;
4703
5191
 
4704
5192
  EV_FREQUENT_CHECK;
4705
5193
  }
4706
5194
 
4707
5195
  void
4708
- ev_check_stop (EV_P_ ev_check *w) EV_THROW
5196
+ ev_check_stop (EV_P_ ev_check *w) EV_NOEXCEPT
4709
5197
  {
4710
5198
  clear_pending (EV_A_ (W)w);
4711
- if (expect_false (!ev_is_active (w)))
5199
+ if (ecb_expect_false (!ev_is_active (w)))
4712
5200
  return;
4713
5201
 
4714
5202
  EV_FREQUENT_CHECK;
@@ -4727,9 +5215,9 @@ ev_check_stop (EV_P_ ev_check *w) EV_THROW
4727
5215
  #endif
4728
5216
 
4729
5217
  #if EV_EMBED_ENABLE
4730
- noinline
5218
+ ecb_noinline
4731
5219
  void
4732
- ev_embed_sweep (EV_P_ ev_embed *w) EV_THROW
5220
+ ev_embed_sweep (EV_P_ ev_embed *w) EV_NOEXCEPT
4733
5221
  {
4734
5222
  ev_run (w->other, EVRUN_NOWAIT);
4735
5223
  }
@@ -4761,6 +5249,7 @@ embed_prepare_cb (EV_P_ ev_prepare *prepare, int revents)
4761
5249
  }
4762
5250
  }
4763
5251
 
5252
+ #if EV_FORK_ENABLE
4764
5253
  static void
4765
5254
  embed_fork_cb (EV_P_ ev_fork *fork_w, int revents)
4766
5255
  {
@@ -4777,6 +5266,7 @@ embed_fork_cb (EV_P_ ev_fork *fork_w, int revents)
4777
5266
 
4778
5267
  ev_embed_start (EV_A_ w);
4779
5268
  }
5269
+ #endif
4780
5270
 
4781
5271
  #if 0
4782
5272
  static void
@@ -4787,9 +5277,9 @@ embed_idle_cb (EV_P_ ev_idle *idle, int revents)
4787
5277
  #endif
4788
5278
 
4789
5279
  void
4790
- ev_embed_start (EV_P_ ev_embed *w) EV_THROW
5280
+ ev_embed_start (EV_P_ ev_embed *w) EV_NOEXCEPT
4791
5281
  {
4792
- if (expect_false (ev_is_active (w)))
5282
+ if (ecb_expect_false (ev_is_active (w)))
4793
5283
  return;
4794
5284
 
4795
5285
  {
@@ -4807,8 +5297,10 @@ ev_embed_start (EV_P_ ev_embed *w) EV_THROW
4807
5297
  ev_set_priority (&w->prepare, EV_MINPRI);
4808
5298
  ev_prepare_start (EV_A_ &w->prepare);
4809
5299
 
5300
+ #if EV_FORK_ENABLE
4810
5301
  ev_fork_init (&w->fork, embed_fork_cb);
4811
5302
  ev_fork_start (EV_A_ &w->fork);
5303
+ #endif
4812
5304
 
4813
5305
  /*ev_idle_init (&w->idle, e,bed_idle_cb);*/
4814
5306
 
@@ -4818,17 +5310,19 @@ ev_embed_start (EV_P_ ev_embed *w) EV_THROW
4818
5310
  }
4819
5311
 
4820
5312
  void
4821
- ev_embed_stop (EV_P_ ev_embed *w) EV_THROW
5313
+ ev_embed_stop (EV_P_ ev_embed *w) EV_NOEXCEPT
4822
5314
  {
4823
5315
  clear_pending (EV_A_ (W)w);
4824
- if (expect_false (!ev_is_active (w)))
5316
+ if (ecb_expect_false (!ev_is_active (w)))
4825
5317
  return;
4826
5318
 
4827
5319
  EV_FREQUENT_CHECK;
4828
5320
 
4829
5321
  ev_io_stop (EV_A_ &w->io);
4830
5322
  ev_prepare_stop (EV_A_ &w->prepare);
5323
+ #if EV_FORK_ENABLE
4831
5324
  ev_fork_stop (EV_A_ &w->fork);
5325
+ #endif
4832
5326
 
4833
5327
  ev_stop (EV_A_ (W)w);
4834
5328
 
@@ -4838,25 +5332,25 @@ ev_embed_stop (EV_P_ ev_embed *w) EV_THROW
4838
5332
 
4839
5333
  #if EV_FORK_ENABLE
4840
5334
  void
4841
- ev_fork_start (EV_P_ ev_fork *w) EV_THROW
5335
+ ev_fork_start (EV_P_ ev_fork *w) EV_NOEXCEPT
4842
5336
  {
4843
- if (expect_false (ev_is_active (w)))
5337
+ if (ecb_expect_false (ev_is_active (w)))
4844
5338
  return;
4845
5339
 
4846
5340
  EV_FREQUENT_CHECK;
4847
5341
 
4848
5342
  ev_start (EV_A_ (W)w, ++forkcnt);
4849
- array_needsize (ev_fork *, forks, forkmax, forkcnt, EMPTY2);
5343
+ array_needsize (ev_fork *, forks, forkmax, forkcnt, array_needsize_noinit);
4850
5344
  forks [forkcnt - 1] = w;
4851
5345
 
4852
5346
  EV_FREQUENT_CHECK;
4853
5347
  }
4854
5348
 
4855
5349
  void
4856
- ev_fork_stop (EV_P_ ev_fork *w) EV_THROW
5350
+ ev_fork_stop (EV_P_ ev_fork *w) EV_NOEXCEPT
4857
5351
  {
4858
5352
  clear_pending (EV_A_ (W)w);
4859
- if (expect_false (!ev_is_active (w)))
5353
+ if (ecb_expect_false (!ev_is_active (w)))
4860
5354
  return;
4861
5355
 
4862
5356
  EV_FREQUENT_CHECK;
@@ -4876,15 +5370,15 @@ ev_fork_stop (EV_P_ ev_fork *w) EV_THROW
4876
5370
 
4877
5371
  #if EV_CLEANUP_ENABLE
4878
5372
  void
4879
- ev_cleanup_start (EV_P_ ev_cleanup *w) EV_THROW
5373
+ ev_cleanup_start (EV_P_ ev_cleanup *w) EV_NOEXCEPT
4880
5374
  {
4881
- if (expect_false (ev_is_active (w)))
5375
+ if (ecb_expect_false (ev_is_active (w)))
4882
5376
  return;
4883
5377
 
4884
5378
  EV_FREQUENT_CHECK;
4885
5379
 
4886
5380
  ev_start (EV_A_ (W)w, ++cleanupcnt);
4887
- array_needsize (ev_cleanup *, cleanups, cleanupmax, cleanupcnt, EMPTY2);
5381
+ array_needsize (ev_cleanup *, cleanups, cleanupmax, cleanupcnt, array_needsize_noinit);
4888
5382
  cleanups [cleanupcnt - 1] = w;
4889
5383
 
4890
5384
  /* cleanup watchers should never keep a refcount on the loop */
@@ -4893,10 +5387,10 @@ ev_cleanup_start (EV_P_ ev_cleanup *w) EV_THROW
4893
5387
  }
4894
5388
 
4895
5389
  void
4896
- ev_cleanup_stop (EV_P_ ev_cleanup *w) EV_THROW
5390
+ ev_cleanup_stop (EV_P_ ev_cleanup *w) EV_NOEXCEPT
4897
5391
  {
4898
5392
  clear_pending (EV_A_ (W)w);
4899
- if (expect_false (!ev_is_active (w)))
5393
+ if (ecb_expect_false (!ev_is_active (w)))
4900
5394
  return;
4901
5395
 
4902
5396
  EV_FREQUENT_CHECK;
@@ -4917,9 +5411,9 @@ ev_cleanup_stop (EV_P_ ev_cleanup *w) EV_THROW
4917
5411
 
4918
5412
  #if EV_ASYNC_ENABLE
4919
5413
  void
4920
- ev_async_start (EV_P_ ev_async *w) EV_THROW
5414
+ ev_async_start (EV_P_ ev_async *w) EV_NOEXCEPT
4921
5415
  {
4922
- if (expect_false (ev_is_active (w)))
5416
+ if (ecb_expect_false (ev_is_active (w)))
4923
5417
  return;
4924
5418
 
4925
5419
  w->sent = 0;
@@ -4929,17 +5423,17 @@ ev_async_start (EV_P_ ev_async *w) EV_THROW
4929
5423
  EV_FREQUENT_CHECK;
4930
5424
 
4931
5425
  ev_start (EV_A_ (W)w, ++asynccnt);
4932
- array_needsize (ev_async *, asyncs, asyncmax, asynccnt, EMPTY2);
5426
+ array_needsize (ev_async *, asyncs, asyncmax, asynccnt, array_needsize_noinit);
4933
5427
  asyncs [asynccnt - 1] = w;
4934
5428
 
4935
5429
  EV_FREQUENT_CHECK;
4936
5430
  }
4937
5431
 
4938
5432
  void
4939
- ev_async_stop (EV_P_ ev_async *w) EV_THROW
5433
+ ev_async_stop (EV_P_ ev_async *w) EV_NOEXCEPT
4940
5434
  {
4941
5435
  clear_pending (EV_A_ (W)w);
4942
- if (expect_false (!ev_is_active (w)))
5436
+ if (ecb_expect_false (!ev_is_active (w)))
4943
5437
  return;
4944
5438
 
4945
5439
  EV_FREQUENT_CHECK;
@@ -4957,7 +5451,7 @@ ev_async_stop (EV_P_ ev_async *w) EV_THROW
4957
5451
  }
4958
5452
 
4959
5453
  void
4960
- ev_async_send (EV_P_ ev_async *w) EV_THROW
5454
+ ev_async_send (EV_P_ ev_async *w) EV_NOEXCEPT
4961
5455
  {
4962
5456
  w->sent = 1;
4963
5457
  evpipe_write (EV_A_ &async_pending);
@@ -5004,16 +5498,10 @@ once_cb_to (EV_P_ ev_timer *w, int revents)
5004
5498
  }
5005
5499
 
5006
5500
  void
5007
- ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) EV_THROW
5501
+ ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) EV_NOEXCEPT
5008
5502
  {
5009
5503
  struct ev_once *once = (struct ev_once *)ev_malloc (sizeof (struct ev_once));
5010
5504
 
5011
- if (expect_false (!once))
5012
- {
5013
- cb (EV_ERROR | EV_READ | EV_WRITE | EV_TIMER, arg);
5014
- return;
5015
- }
5016
-
5017
5505
  once->cb = cb;
5018
5506
  once->arg = arg;
5019
5507
 
@@ -5037,7 +5525,7 @@ ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, vo
5037
5525
  #if EV_WALK_ENABLE
5038
5526
  ecb_cold
5039
5527
  void
5040
- ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)) EV_THROW
5528
+ ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)) EV_NOEXCEPT
5041
5529
  {
5042
5530
  int i, j;
5043
5531
  ev_watcher_list *wl, *wn;