passenger 6.0.1 → 6.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (453) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +145 -18
  3. data/CONTRIBUTORS +6 -0
  4. data/bin/passenger-install-nginx-module +1 -1
  5. data/bin/passenger-status +15 -0
  6. data/build/misc.rb +3 -1
  7. data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/builder.rb +56 -3
  8. data/dev/copy_boost_headers +1 -0
  9. data/package.json +1 -1
  10. data/passenger.gemspec +9 -1
  11. data/resources/templates/error_renderer/with_details/src/bootstrap/bootstrap.css +0 -0
  12. data/resources/templates/error_renderer/with_details/src/bootstrap/bootstrap.js +0 -0
  13. data/resources/templates/error_renderer/with_details/src/bootstrap/config.json +0 -0
  14. data/resources/templates/standalone/http.erb +2 -0
  15. data/resources/templates/standalone/server.erb +1 -0
  16. data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +1 -1
  17. data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +1 -0
  18. data/src/agent/Core/ApplicationPool/Options.h +10 -0
  19. data/src/agent/Core/ApplicationPool/Pool/GarbageCollection.cpp +1 -1
  20. data/src/agent/Core/ApplicationPool/Pool/StateInspection.cpp +1 -1
  21. data/src/agent/Core/Config.h +14 -1
  22. data/src/agent/Core/Controller.h +1 -0
  23. data/src/agent/Core/Controller/Config.h +5 -1
  24. data/src/agent/Core/Controller/ForwardResponse.cpp +13 -0
  25. data/src/agent/Core/Controller/InitRequest.cpp +3 -0
  26. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +1 -0
  27. data/src/agent/Core/CoreMain.cpp +2 -1
  28. data/src/agent/Core/OptionParser.h +3 -0
  29. data/src/agent/Core/SpawningKit/Context.h +1 -0
  30. data/src/agent/Core/SpawningKit/Handshake/Prepare.h +1 -1
  31. data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +5 -2
  32. data/src/agent/TempDirToucher/TempDirToucherMain.cpp +2 -0
  33. data/src/agent/Watchdog/Config.h +15 -1
  34. data/src/agent/Watchdog/WatchdogMain.cpp +7 -0
  35. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +10 -0
  36. data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +10 -0
  37. data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +30 -0
  38. data/src/apache2_module/Hooks.cpp +6 -0
  39. data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +20 -0
  40. data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +24 -0
  41. data/src/cxx_supportlib/Constants.h +2 -1
  42. data/src/cxx_supportlib/LoggingKit/Config.h +2 -0
  43. data/src/cxx_supportlib/LoggingKit/Implementation.cpp +15 -9
  44. data/src/cxx_supportlib/ServerKit/HttpChunkedBodyParser.h +1 -1
  45. data/src/cxx_supportlib/SystemTools/ContainerHelpers.h +20 -19
  46. data/src/cxx_supportlib/WebSocketCommandReverseServer.h +11 -7
  47. data/src/cxx_supportlib/oxt/system_calls.cpp +10 -10
  48. data/src/cxx_supportlib/vendor-modified/boost/algorithm/string/finder.hpp +0 -4
  49. data/src/cxx_supportlib/vendor-modified/boost/asio/buffer.hpp +46 -37
  50. data/src/cxx_supportlib/vendor-modified/boost/asio/connect.hpp +16 -15
  51. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/config.hpp +45 -26
  52. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/future.hpp +33 -0
  53. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/socket_ops.ipp +1 -1
  54. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/is_buffer_sequence.hpp +38 -14
  55. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timer_queue.hpp +2 -0
  56. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/io_context.hpp +1 -1
  57. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read_until.hpp +3 -1
  58. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/use_future.hpp +0 -1
  59. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/bad_address_cast.hpp +6 -1
  60. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_resolver.hpp +6 -4
  61. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_resolver_results.hpp +4 -4
  62. data/src/cxx_supportlib/vendor-modified/boost/asio/packaged_task.hpp +3 -3
  63. data/src/cxx_supportlib/vendor-modified/boost/asio/read.hpp +4 -4
  64. data/src/cxx_supportlib/vendor-modified/boost/asio/read_at.hpp +4 -4
  65. data/src/cxx_supportlib/vendor-modified/boost/asio/read_until.hpp +8 -6
  66. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/context_base.hpp +17 -0
  67. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/impl/context.ipp +50 -5
  68. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/stream.hpp +2 -1
  69. data/src/cxx_supportlib/vendor-modified/boost/asio/thread_pool.hpp +1 -1
  70. data/src/cxx_supportlib/vendor-modified/boost/asio/use_future.hpp +3 -2
  71. data/src/cxx_supportlib/vendor-modified/boost/asio/version.hpp +1 -1
  72. data/src/cxx_supportlib/vendor-modified/boost/asio/write.hpp +4 -3
  73. data/src/cxx_supportlib/vendor-modified/boost/asio/write_at.hpp +5 -3
  74. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_gcc_x86_dcas.hpp +13 -12
  75. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/mac/chrono.hpp +10 -10
  76. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp +34 -34
  77. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/mac/thread_clock.hpp +4 -4
  78. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/posix/chrono.hpp +8 -8
  79. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp +27 -27
  80. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/posix/thread_clock.hpp +4 -4
  81. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/system.hpp +5 -4
  82. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/time_point_io.hpp +1 -1
  83. data/src/cxx_supportlib/vendor-modified/boost/circular_buffer.hpp +3 -3
  84. data/src/cxx_supportlib/vendor-modified/boost/circular_buffer/allocators.hpp +89 -0
  85. data/src/cxx_supportlib/vendor-modified/boost/circular_buffer/base.hpp +83 -74
  86. data/src/cxx_supportlib/vendor-modified/boost/circular_buffer/details.hpp +21 -33
  87. data/src/cxx_supportlib/vendor-modified/boost/circular_buffer/space_optimized.hpp +5 -5
  88. data/src/cxx_supportlib/vendor-modified/boost/concept/assert.hpp +1 -1
  89. data/src/cxx_supportlib/vendor-modified/boost/concept/detail/general.hpp +3 -3
  90. data/src/cxx_supportlib/vendor-modified/boost/concept/detail/has_constraints.hpp +3 -3
  91. data/src/cxx_supportlib/vendor-modified/boost/concept/usage.hpp +1 -1
  92. data/src/cxx_supportlib/vendor-modified/boost/concept_check.hpp +19 -19
  93. data/src/cxx_supportlib/vendor-modified/boost/config/auto_link.hpp +8 -0
  94. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/borland.hpp +5 -2
  95. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/clang.hpp +5 -1
  96. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/codegear.hpp +6 -2
  97. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/comeau.hpp +1 -1
  98. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/common_edg.hpp +4 -0
  99. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/cray.hpp +368 -52
  100. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/digitalmars.hpp +4 -1
  101. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/gcc.hpp +6 -3
  102. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/gcc_xml.hpp +3 -0
  103. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/greenhills.hpp +1 -1
  104. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/hp_acc.hpp +1 -1
  105. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/intel.hpp +6 -1
  106. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/kai.hpp +1 -1
  107. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/metrowerks.hpp +4 -1
  108. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/mpw.hpp +4 -1
  109. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/nvcc.hpp +3 -3
  110. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/pathscale.hpp +3 -0
  111. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/sunpro_cc.hpp +3 -0
  112. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/vacpp.hpp +4 -1
  113. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/visualc.hpp +9 -4
  114. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/xlcpp.hpp +4 -0
  115. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/xlcpp_zos.hpp +1 -0
  116. data/src/cxx_supportlib/vendor-modified/boost/config/detail/select_compiler_config.hpp +1 -2
  117. data/src/cxx_supportlib/vendor-modified/boost/config/detail/suffix.hpp +13 -0
  118. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/dinkumware.hpp +2 -2
  119. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/libcpp.hpp +14 -4
  120. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/libstdcpp3.hpp +4 -4
  121. data/src/cxx_supportlib/vendor-modified/boost/container/adaptive_pool.hpp +262 -2
  122. data/src/cxx_supportlib/vendor-modified/boost/container/allocator.hpp +4 -3
  123. data/src/cxx_supportlib/vendor-modified/boost/container/allocator_traits.hpp +1 -1
  124. data/src/cxx_supportlib/vendor-modified/boost/container/deque.hpp +7 -0
  125. data/src/cxx_supportlib/vendor-modified/boost/container/detail/adaptive_node_pool.hpp +22 -19
  126. data/src/cxx_supportlib/vendor-modified/boost/container/detail/adaptive_node_pool_impl.hpp +833 -459
  127. data/src/cxx_supportlib/vendor-modified/boost/container/detail/advanced_insert_int.hpp +24 -6
  128. data/src/cxx_supportlib/vendor-modified/boost/container/detail/allocator_version_traits.hpp +2 -1
  129. data/src/cxx_supportlib/vendor-modified/boost/container/detail/compare_functors.hpp +61 -5
  130. data/src/cxx_supportlib/vendor-modified/boost/container/detail/copy_move_algo.hpp +33 -8
  131. data/src/cxx_supportlib/vendor-modified/boost/container/detail/flat_tree.hpp +132 -41
  132. data/src/cxx_supportlib/vendor-modified/boost/container/detail/iterator.hpp +16 -0
  133. data/src/cxx_supportlib/vendor-modified/boost/container/detail/math_functions.hpp +54 -0
  134. data/src/cxx_supportlib/vendor-modified/boost/container/detail/mpl.hpp +58 -0
  135. data/src/cxx_supportlib/vendor-modified/boost/container/detail/multiallocation_chain.hpp +28 -23
  136. data/src/cxx_supportlib/vendor-modified/boost/container/detail/node_alloc_holder.hpp +167 -115
  137. data/src/cxx_supportlib/vendor-modified/boost/container/detail/pair.hpp +55 -0
  138. data/src/cxx_supportlib/vendor-modified/boost/container/detail/std_fwd.hpp +3 -0
  139. data/src/cxx_supportlib/vendor-modified/boost/container/detail/thread_mutex.hpp +181 -0
  140. data/src/cxx_supportlib/vendor-modified/boost/container/detail/tree.hpp +167 -29
  141. data/src/cxx_supportlib/vendor-modified/boost/container/detail/type_traits.hpp +2 -0
  142. data/src/cxx_supportlib/vendor-modified/boost/container/detail/variadic_templates_tools.hpp +1 -1
  143. data/src/cxx_supportlib/vendor-modified/boost/container/detail/workaround.hpp +18 -0
  144. data/src/cxx_supportlib/vendor-modified/boost/container/flat_map.hpp +389 -3
  145. data/src/cxx_supportlib/vendor-modified/boost/container/flat_set.hpp +262 -0
  146. data/src/cxx_supportlib/vendor-modified/boost/container/list.hpp +52 -8
  147. data/src/cxx_supportlib/vendor-modified/boost/container/map.hpp +364 -0
  148. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/monotonic_buffer_resource.hpp +4 -2
  149. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/resource_adaptor.hpp +1 -1
  150. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/synchronized_pool_resource.hpp +3 -2
  151. data/src/cxx_supportlib/vendor-modified/boost/container/set.hpp +286 -6
  152. data/src/cxx_supportlib/vendor-modified/boost/container/slist.hpp +56 -8
  153. data/src/cxx_supportlib/vendor-modified/boost/container/small_vector.hpp +43 -6
  154. data/src/cxx_supportlib/vendor-modified/boost/container/stable_vector.hpp +100 -31
  155. data/src/cxx_supportlib/vendor-modified/boost/container/static_vector.hpp +2 -1
  156. data/src/cxx_supportlib/vendor-modified/boost/container/string.hpp +126 -69
  157. data/src/cxx_supportlib/vendor-modified/boost/container/vector.hpp +75 -51
  158. data/src/cxx_supportlib/vendor-modified/boost/core/empty_value.hpp +136 -0
  159. data/src/cxx_supportlib/vendor-modified/boost/core/exchange.hpp +49 -0
  160. data/src/cxx_supportlib/vendor-modified/boost/core/explicit_operator_bool.hpp +9 -0
  161. data/src/cxx_supportlib/vendor-modified/boost/core/lightweight_test.hpp +101 -130
  162. data/src/cxx_supportlib/vendor-modified/boost/core/lightweight_test_trait.hpp +2 -2
  163. data/src/cxx_supportlib/vendor-modified/boost/core/noncopyable.hpp +16 -1
  164. data/src/cxx_supportlib/vendor-modified/boost/core/quick_exit.hpp +59 -0
  165. data/src/cxx_supportlib/vendor-modified/boost/core/ref.hpp +2 -1
  166. data/src/cxx_supportlib/vendor-modified/boost/core/swap.hpp +9 -2
  167. data/src/cxx_supportlib/vendor-modified/boost/core/typeinfo.hpp +26 -10
  168. data/src/cxx_supportlib/vendor-modified/boost/date_time/compiler_config.hpp +5 -0
  169. data/src/cxx_supportlib/vendor-modified/boost/date_time/posix_time/posix_time_duration.hpp +3 -3
  170. data/src/cxx_supportlib/vendor-modified/boost/date_time/time_duration.hpp +1 -1
  171. data/src/cxx_supportlib/vendor-modified/boost/detail/basic_pointerbuf.hpp +1 -1
  172. data/src/cxx_supportlib/vendor-modified/boost/detail/indirect_traits.hpp +38 -47
  173. data/src/cxx_supportlib/vendor-modified/boost/detail/lcast_precision.hpp +5 -5
  174. data/src/cxx_supportlib/vendor-modified/boost/detail/reference_content.hpp +7 -7
  175. data/src/cxx_supportlib/vendor-modified/boost/exception/exception.hpp +62 -58
  176. data/src/cxx_supportlib/vendor-modified/boost/function.hpp +1 -1
  177. data/src/cxx_supportlib/vendor-modified/boost/function/function_base.hpp +29 -29
  178. data/src/cxx_supportlib/vendor-modified/boost/function/function_template.hpp +38 -40
  179. data/src/cxx_supportlib/vendor-modified/boost/integer/common_factor_rt.hpp +4 -4
  180. data/src/cxx_supportlib/vendor-modified/boost/intrusive/avltree_algorithms.hpp +44 -44
  181. data/src/cxx_supportlib/vendor-modified/boost/intrusive/bstree_algorithms.hpp +39 -39
  182. data/src/cxx_supportlib/vendor-modified/boost/intrusive/circular_list_algorithms.hpp +15 -15
  183. data/src/cxx_supportlib/vendor-modified/boost/intrusive/circular_slist_algorithms.hpp +7 -7
  184. data/src/cxx_supportlib/vendor-modified/boost/intrusive/derivation_value_traits.hpp +1 -1
  185. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/any_node_and_algorithms.hpp +14 -14
  186. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/avltree_node.hpp +9 -9
  187. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/common_slist_algorithms.hpp +7 -7
  188. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/list_iterator.hpp +1 -1
  189. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/list_node.hpp +2 -2
  190. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/node_cloner_disposer.hpp +2 -2
  191. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/rbtree_node.hpp +6 -6
  192. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/simple_disposers.hpp +1 -1
  193. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/slist_iterator.hpp +1 -1
  194. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/slist_node.hpp +1 -1
  195. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/tree_iterator.hpp +1 -1
  196. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/tree_node.hpp +3 -3
  197. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/tree_value_compare.hpp +33 -14
  198. data/src/cxx_supportlib/vendor-modified/boost/intrusive/hashtable.hpp +12 -12
  199. data/src/cxx_supportlib/vendor-modified/boost/intrusive/linear_slist_algorithms.hpp +4 -4
  200. data/src/cxx_supportlib/vendor-modified/boost/intrusive/pointer_plus_bits.hpp +3 -0
  201. data/src/cxx_supportlib/vendor-modified/boost/intrusive/rbtree_algorithms.hpp +39 -39
  202. data/src/cxx_supportlib/vendor-modified/boost/intrusive/sgtree_algorithms.hpp +61 -61
  203. data/src/cxx_supportlib/vendor-modified/boost/intrusive/slist.hpp +4 -4
  204. data/src/cxx_supportlib/vendor-modified/boost/intrusive/splaytree_algorithms.hpp +66 -66
  205. data/src/cxx_supportlib/vendor-modified/boost/intrusive/treap_algorithms.hpp +54 -54
  206. data/src/cxx_supportlib/vendor-modified/boost/intrusive/unordered_set.hpp +6 -2
  207. data/src/cxx_supportlib/vendor-modified/boost/intrusive/unordered_set_hook.hpp +3 -3
  208. data/src/cxx_supportlib/vendor-modified/boost/iterator/advance.hpp +1 -1
  209. data/src/cxx_supportlib/vendor-modified/boost/iterator/distance.hpp +65 -0
  210. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast.hpp +1 -1
  211. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/bad_lexical_cast.hpp +1 -1
  212. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_lexical.hpp +23 -23
  213. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_lexical_streams.hpp +4 -4
  214. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_numeric.hpp +13 -13
  215. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/inf_nan.hpp +1 -1
  216. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/is_character.hpp +5 -4
  217. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/lcast_char_constants.hpp +1 -1
  218. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/lcast_unsigned_converters.hpp +5 -5
  219. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/widest_char.hpp +5 -2
  220. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/try_lexical_convert.hpp +18 -13
  221. data/src/cxx_supportlib/vendor-modified/boost/libs/regex/src/cregex.cpp +4 -4
  222. data/src/cxx_supportlib/vendor-modified/boost/libs/system/src/error_code.cpp +16 -5
  223. data/src/cxx_supportlib/vendor-modified/boost/libs/thread/src/future.cpp +1 -1
  224. data/src/cxx_supportlib/vendor-modified/boost/libs/thread/src/pthread/thread.cpp +14 -8
  225. data/src/cxx_supportlib/vendor-modified/boost/libs/thread/src/tss_null.cpp +2 -2
  226. data/src/cxx_supportlib/vendor-modified/boost/math/special_functions/detail/fp_traits.hpp +13 -13
  227. data/src/cxx_supportlib/vendor-modified/boost/math/special_functions/math_fwd.hpp +27 -0
  228. data/src/cxx_supportlib/vendor-modified/boost/math/tools/config.hpp +1 -1
  229. data/src/cxx_supportlib/vendor-modified/boost/move/algo/adaptive_merge.hpp +29 -6
  230. data/src/cxx_supportlib/vendor-modified/boost/move/algo/adaptive_sort.hpp +12 -3
  231. data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/adaptive_sort_merge.hpp +1 -1
  232. data/src/cxx_supportlib/vendor-modified/boost/move/algo/move.hpp +1 -1
  233. data/src/cxx_supportlib/vendor-modified/boost/move/algorithm.hpp +1 -1
  234. data/src/cxx_supportlib/vendor-modified/boost/move/core.hpp +8 -8
  235. data/src/cxx_supportlib/vendor-modified/boost/move/detail/meta_utils.hpp +2 -0
  236. data/src/cxx_supportlib/vendor-modified/boost/move/detail/type_traits.hpp +3 -3
  237. data/src/cxx_supportlib/vendor-modified/boost/mpl/assert.hpp +23 -3
  238. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/experimental_traits.hpp +9 -3
  239. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/old_optional_implementation.hpp +10 -11
  240. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_reference_spec.hpp +20 -1
  241. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_trivially_copyable_base.hpp +3 -3
  242. data/src/cxx_supportlib/vendor-modified/boost/optional/optional.hpp +211 -101
  243. data/src/cxx_supportlib/vendor-modified/boost/parameter/python.hpp +5 -6
  244. data/src/cxx_supportlib/vendor-modified/boost/pool/detail/mutex.hpp +119 -25
  245. data/src/cxx_supportlib/vendor-modified/boost/predef/architecture.h +1 -0
  246. data/src/cxx_supportlib/vendor-modified/boost/predef/architecture/arm.h +5 -0
  247. data/src/cxx_supportlib/vendor-modified/boost/predef/architecture/ptx.h +44 -0
  248. data/src/cxx_supportlib/vendor-modified/boost/predef/compiler.h +1 -0
  249. data/src/cxx_supportlib/vendor-modified/boost/predef/compiler/compaq.h +1 -1
  250. data/src/cxx_supportlib/vendor-modified/boost/predef/compiler/nvcc.h +73 -0
  251. data/src/cxx_supportlib/vendor-modified/boost/predef/detail/endian_compat.h +3 -1
  252. data/src/cxx_supportlib/vendor-modified/boost/predef/language.h +1 -0
  253. data/src/cxx_supportlib/vendor-modified/boost/predef/language/cuda.h +52 -0
  254. data/src/cxx_supportlib/vendor-modified/boost/predef/make.h +4 -0
  255. data/src/cxx_supportlib/vendor-modified/boost/predef/os/cygwin.h +6 -1
  256. data/src/cxx_supportlib/vendor-modified/boost/predef/other/endian.h +1 -2
  257. data/src/cxx_supportlib/vendor-modified/boost/predef/version.h +1 -1
  258. data/src/cxx_supportlib/vendor-modified/boost/preprocessor/config/config.hpp +17 -8
  259. data/src/cxx_supportlib/vendor-modified/boost/preprocessor/stringize.hpp +4 -0
  260. data/src/cxx_supportlib/vendor-modified/boost/preprocessor/wstringize.hpp +4 -0
  261. data/src/cxx_supportlib/vendor-modified/boost/random/detail/gray_coded_qrng.hpp +166 -0
  262. data/src/cxx_supportlib/vendor-modified/boost/random/detail/niederreiter_base2_table.hpp +513 -0
  263. data/src/cxx_supportlib/vendor-modified/boost/random/detail/qrng_base.hpp +291 -0
  264. data/src/cxx_supportlib/vendor-modified/boost/random/detail/sobol_table.hpp +4106 -0
  265. data/src/cxx_supportlib/vendor-modified/boost/random/faure.hpp +367 -0
  266. data/src/cxx_supportlib/vendor-modified/boost/random/niederreiter_base2.hpp +360 -0
  267. data/src/cxx_supportlib/vendor-modified/boost/random/sobol.hpp +237 -0
  268. data/src/cxx_supportlib/vendor-modified/boost/range/as_literal.hpp +43 -0
  269. data/src/cxx_supportlib/vendor-modified/boost/range/begin.hpp +13 -5
  270. data/src/cxx_supportlib/vendor-modified/boost/range/concepts.hpp +1 -1
  271. data/src/cxx_supportlib/vendor-modified/boost/range/detail/common.hpp +1 -3
  272. data/src/cxx_supportlib/vendor-modified/boost/range/detail/implementation_help.hpp +2 -2
  273. data/src/cxx_supportlib/vendor-modified/boost/range/distance.hpp +11 -5
  274. data/src/cxx_supportlib/vendor-modified/boost/range/end.hpp +14 -6
  275. data/src/cxx_supportlib/vendor-modified/boost/range/has_range_iterator.hpp +3 -3
  276. data/src/cxx_supportlib/vendor-modified/boost/ratio/config.hpp +6 -2
  277. data/src/cxx_supportlib/vendor-modified/boost/rational.hpp +55 -37
  278. data/src/cxx_supportlib/vendor-modified/boost/regex/concepts.hpp +3 -2
  279. data/src/cxx_supportlib/vendor-modified/boost/regex/config.hpp +11 -1
  280. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/basic_regex.hpp +7 -1
  281. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/basic_regex_creator.hpp +3 -1
  282. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/basic_regex_parser.hpp +5 -2
  283. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/fileiter.hpp +0 -3
  284. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/instances.hpp +15 -4
  285. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/match_flags.hpp +1 -2
  286. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/match_results.hpp +12 -3
  287. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/perl_matcher.hpp +7 -2
  288. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/perl_matcher_common.hpp +7 -3
  289. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/perl_matcher_non_recursive.hpp +6 -2
  290. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/regex_format.hpp +0 -5
  291. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/regex_iterator.hpp +0 -8
  292. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/regex_raw_buffer.hpp +3 -3
  293. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/regex_split.hpp +3 -1
  294. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/regex_token_iterator.hpp +0 -8
  295. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/regex_traits_defaults.hpp +12 -11
  296. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/regex_workaround.hpp +7 -4
  297. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/u32regex_iterator.hpp +1 -9
  298. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/u32regex_token_iterator.hpp +2 -10
  299. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/w32_regex_traits.hpp +2 -0
  300. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/allocate_shared_array.hpp +60 -115
  301. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/local_counted_base.hpp +3 -3
  302. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp +2 -1
  303. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_aix.hpp +2 -1
  304. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_clang.hpp +2 -1
  305. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp +2 -1
  306. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_cw_x86.hpp +2 -1
  307. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp +2 -1
  308. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +2 -1
  309. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp +2 -1
  310. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp +2 -1
  311. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp +2 -1
  312. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_nt.hpp +2 -1
  313. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_pt.hpp +2 -1
  314. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp +2 -1
  315. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_solaris.hpp +2 -1
  316. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_spin.hpp +2 -1
  317. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp +2 -1
  318. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_sync.hpp +2 -1
  319. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp +2 -1
  320. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_impl.hpp +3 -3
  321. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/yield_k.hpp +14 -8
  322. data/src/cxx_supportlib/vendor-modified/boost/system/config.hpp +4 -24
  323. data/src/cxx_supportlib/vendor-modified/boost/system/detail/config.hpp +57 -0
  324. data/src/cxx_supportlib/vendor-modified/boost/system/detail/generic_category.hpp +101 -0
  325. data/src/cxx_supportlib/vendor-modified/boost/system/detail/std_interoperability.hpp +141 -0
  326. data/src/cxx_supportlib/vendor-modified/boost/system/detail/system_category_posix.hpp +132 -0
  327. data/src/cxx_supportlib/vendor-modified/boost/system/error_code.hpp +775 -588
  328. data/src/cxx_supportlib/vendor-modified/boost/system/system_error.hpp +4 -4
  329. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/config.hpp +6 -0
  330. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/move.hpp +13 -6
  331. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/nullary_function.hpp +8 -3
  332. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/thread.hpp +3 -1
  333. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/thread_safety.hpp +160 -0
  334. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/tss_hooks.hpp +2 -2
  335. data/src/cxx_supportlib/vendor-modified/boost/thread/exceptions.hpp +3 -3
  336. data/src/cxx_supportlib/vendor-modified/boost/thread/executors/basic_thread_pool.hpp +24 -1
  337. data/src/cxx_supportlib/vendor-modified/boost/thread/future.hpp +10 -1
  338. data/src/cxx_supportlib/vendor-modified/boost/thread/lock_guard.hpp +4 -4
  339. data/src/cxx_supportlib/vendor-modified/boost/thread/lockable_traits.hpp +31 -0
  340. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/condition_variable.hpp +2 -2
  341. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/condition_variable_fwd.hpp +2 -2
  342. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/mutex.hpp +8 -53
  343. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/pthread_mutex_scoped_lock.hpp +73 -4
  344. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/recursive_mutex.hpp +6 -6
  345. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/thread_data.hpp +14 -9
  346. data/src/cxx_supportlib/vendor-modified/boost/thread/xtime.hpp +6 -6
  347. data/src/cxx_supportlib/vendor-modified/boost/throw_exception.hpp +9 -8
  348. data/src/cxx_supportlib/vendor-modified/boost/token_functions.hpp +1 -0
  349. data/src/cxx_supportlib/vendor-modified/boost/type_index/stl_type_index.hpp +21 -19
  350. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/common_arithmetic_type.hpp +3 -1
  351. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/config.hpp +9 -0
  352. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/detector.hpp +1 -1
  353. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/has_postfix_operator.hpp +55 -0
  354. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/has_prefix_operator.hpp +72 -0
  355. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_function_cxx_03.hpp +108 -0
  356. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_function_cxx_11.hpp +501 -0
  357. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_function_msvc10_fix.hpp +30 -0
  358. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_likely_lambda.hpp +2 -2
  359. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_member_function_pointer_cxx_03.hpp +117 -0
  360. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_member_function_pointer_cxx_11.hpp +557 -0
  361. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_rvalue_reference_msvc10_fix.hpp +43 -0
  362. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detected.hpp +1 -1
  363. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detected_or.hpp +1 -1
  364. data/src/cxx_supportlib/vendor-modified/boost/type_traits/enable_if.hpp +37 -0
  365. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_dereference.hpp +344 -0
  366. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_minus.hpp +5 -0
  367. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_minus_assign.hpp +5 -0
  368. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_plus_assign.hpp +5 -0
  369. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_post_decrement.hpp +21 -0
  370. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_post_increment.hpp +21 -0
  371. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_pre_decrement.hpp +21 -0
  372. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_pre_increment.hpp +22 -0
  373. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_trivial_move_assign.hpp +1 -1
  374. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_trivial_move_constructor.hpp +2 -1
  375. data/src/cxx_supportlib/vendor-modified/boost/type_traits/integral_constant.hpp +5 -15
  376. data/src/cxx_supportlib/vendor-modified/boost/type_traits/intrinsics.hpp +16 -6
  377. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_complete.hpp +3 -1
  378. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_copy_assignable.hpp +3 -4
  379. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_copy_constructible.hpp +4 -6
  380. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_detected.hpp +1 -1
  381. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_detected_convertible.hpp +1 -1
  382. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_detected_exact.hpp +1 -1
  383. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_final.hpp +1 -1
  384. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_function.hpp +4 -79
  385. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_member_function_pointer.hpp +3 -97
  386. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_noncopyable.hpp +39 -0
  387. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_nothrow_move_assignable.hpp +2 -2
  388. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_nothrow_move_constructible.hpp +2 -2
  389. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_rvalue_reference.hpp +4 -0
  390. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_virtual_base_of.hpp +104 -63
  391. data/src/cxx_supportlib/vendor-modified/boost/type_traits/make_void.hpp +1 -1
  392. data/src/cxx_supportlib/vendor-modified/boost/type_traits/nonesuch.hpp +1 -1
  393. data/src/cxx_supportlib/vendor-modified/boost/typeof/constant.hpp +26 -0
  394. data/src/cxx_supportlib/vendor-modified/boost/typeof/dmc/typeof_impl.hpp +4 -4
  395. data/src/cxx_supportlib/vendor-modified/boost/typeof/encode_decode.hpp +0 -3
  396. data/src/cxx_supportlib/vendor-modified/boost/typeof/encode_decode_params.hpp +1 -1
  397. data/src/cxx_supportlib/vendor-modified/boost/typeof/int_encoding.hpp +4 -5
  398. data/src/cxx_supportlib/vendor-modified/boost/typeof/modifiers.hpp +5 -5
  399. data/src/cxx_supportlib/vendor-modified/boost/typeof/msvc/typeof_impl.hpp +9 -9
  400. data/src/cxx_supportlib/vendor-modified/boost/typeof/native.hpp +3 -3
  401. data/src/cxx_supportlib/vendor-modified/boost/typeof/pointers_data_members.hpp +2 -2
  402. data/src/cxx_supportlib/vendor-modified/boost/typeof/register_functions_iterate.hpp +6 -6
  403. data/src/cxx_supportlib/vendor-modified/boost/typeof/register_mem_functions.hpp +1 -1
  404. data/src/cxx_supportlib/vendor-modified/boost/typeof/template_encoding.hpp +4 -4
  405. data/src/cxx_supportlib/vendor-modified/boost/typeof/template_template_param.hpp +2 -2
  406. data/src/cxx_supportlib/vendor-modified/boost/typeof/type_encoding.hpp +2 -2
  407. data/src/cxx_supportlib/vendor-modified/boost/typeof/typeof_impl.hpp +16 -16
  408. data/src/cxx_supportlib/vendor-modified/boost/typeof/vector.hpp +5 -5
  409. data/src/cxx_supportlib/vendor-modified/boost/typeof/vector100.hpp +201 -201
  410. data/src/cxx_supportlib/vendor-modified/boost/typeof/vector150.hpp +301 -301
  411. data/src/cxx_supportlib/vendor-modified/boost/typeof/vector200.hpp +401 -401
  412. data/src/cxx_supportlib/vendor-modified/boost/typeof/vector50.hpp +101 -101
  413. data/src/cxx_supportlib/vendor-modified/boost/utility/detail/minstd_rand.hpp +3 -0
  414. data/src/cxx_supportlib/vendor-modified/boost/utility/string_ref.hpp +2 -0
  415. data/src/cxx_supportlib/vendor-modified/boost/utility/string_view.hpp +26 -6
  416. data/src/cxx_supportlib/vendor-modified/boost/version.hpp +2 -2
  417. data/src/helper-scripts/prespawn +1 -0
  418. data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +40 -0
  419. data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +26 -0
  420. data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +48 -0
  421. data/src/nginx_module/Configuration.c +6 -2
  422. data/src/nginx_module/ContentHandler.c +5 -1
  423. data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +15 -0
  424. data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c +15 -0
  425. data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +28 -0
  426. data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +6 -0
  427. data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +11 -0
  428. data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +11 -0
  429. data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +23 -0
  430. data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +8 -0
  431. data/src/nginx_module/ngx_http_passenger_module.c +2 -0
  432. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/logger.js +0 -0
  433. data/src/ruby_native_extension/extconf.rb +7 -0
  434. data/src/ruby_supportlib/phusion_passenger.rb +7 -7
  435. data/src/ruby_supportlib/phusion_passenger/admin_tools/instance_registry.rb +8 -0
  436. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +23 -0
  437. data/src/ruby_supportlib/phusion_passenger/constants.rb +1 -0
  438. data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +1 -3
  439. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +37 -0
  440. data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +1 -1
  441. data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +10 -0
  442. data/src/ruby_supportlib/phusion_passenger/request_handler.rb +2 -2
  443. data/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb +5 -0
  444. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +11 -0
  445. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +3 -0
  446. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +1 -1
  447. data/src/ruby_supportlib/phusion_passenger/utils/tee_input.rb +6 -0
  448. data/src/ruby_supportlib/phusion_passenger/utils/unseekable_socket.rb +15 -11
  449. metadata +42 -8
  450. data/src/cxx_supportlib/vendor-modified/boost/call_traits.hpp +0 -20
  451. data/src/cxx_supportlib/vendor-modified/boost/detail/call_traits.hpp +0 -172
  452. data/src/cxx_supportlib/vendor-modified/boost/detail/no_exceptions_support.hpp +0 -17
  453. data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_code.ipp +0 -496
@@ -0,0 +1,132 @@
1
+ // POSIX-specific implementation details of system_error_category
2
+ //
3
+ // Copyright 2018 Peter Dimov
4
+ //
5
+ // Distributed under the Boost Software License, Version 1.0. (See accompanying
6
+ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7
+ //
8
+ // See library home page at http://www.boost.org/libs/system
9
+
10
+ namespace boost
11
+ {
12
+
13
+ namespace system
14
+ {
15
+
16
+ namespace detail
17
+ {
18
+
19
+ inline bool is_generic_value( int ev ) BOOST_NOEXCEPT
20
+ {
21
+ using namespace errc;
22
+
23
+ static int const gen[] =
24
+ {
25
+ success,
26
+ address_family_not_supported,
27
+ address_in_use,
28
+ address_not_available,
29
+ already_connected,
30
+ argument_list_too_long,
31
+ argument_out_of_domain,
32
+ bad_address,
33
+ bad_file_descriptor,
34
+ bad_message,
35
+ broken_pipe,
36
+ connection_aborted,
37
+ connection_already_in_progress,
38
+ connection_refused,
39
+ connection_reset,
40
+ cross_device_link,
41
+ destination_address_required,
42
+ device_or_resource_busy,
43
+ directory_not_empty,
44
+ executable_format_error,
45
+ file_exists,
46
+ file_too_large,
47
+ filename_too_long,
48
+ function_not_supported,
49
+ host_unreachable,
50
+ identifier_removed,
51
+ illegal_byte_sequence,
52
+ inappropriate_io_control_operation,
53
+ interrupted,
54
+ invalid_argument,
55
+ invalid_seek,
56
+ io_error,
57
+ is_a_directory,
58
+ message_size,
59
+ network_down,
60
+ network_reset,
61
+ network_unreachable,
62
+ no_buffer_space,
63
+ no_child_process,
64
+ no_link,
65
+ no_lock_available,
66
+ no_message_available,
67
+ no_message,
68
+ no_protocol_option,
69
+ no_space_on_device,
70
+ no_stream_resources,
71
+ no_such_device_or_address,
72
+ no_such_device,
73
+ no_such_file_or_directory,
74
+ no_such_process,
75
+ not_a_directory,
76
+ not_a_socket,
77
+ not_a_stream,
78
+ not_connected,
79
+ not_enough_memory,
80
+ not_supported,
81
+ operation_canceled,
82
+ operation_in_progress,
83
+ operation_not_permitted,
84
+ operation_not_supported,
85
+ operation_would_block,
86
+ owner_dead,
87
+ permission_denied,
88
+ protocol_error,
89
+ protocol_not_supported,
90
+ read_only_file_system,
91
+ resource_deadlock_would_occur,
92
+ resource_unavailable_try_again,
93
+ result_out_of_range,
94
+ state_not_recoverable,
95
+ stream_timeout,
96
+ text_file_busy,
97
+ timed_out,
98
+ too_many_files_open_in_system,
99
+ too_many_files_open,
100
+ too_many_links,
101
+ too_many_symbolic_link_levels,
102
+ value_too_large,
103
+ wrong_protocol_type
104
+ };
105
+
106
+ int const n = sizeof( gen ) / sizeof( gen[0] );
107
+
108
+ for( int i = 0; i < n; ++i )
109
+ {
110
+ if( ev == gen[ i ] ) return true;
111
+ }
112
+
113
+ return false;
114
+ }
115
+
116
+ inline error_condition system_category_default_error_condition_posix( int ev ) BOOST_NOEXCEPT
117
+ {
118
+ if( is_generic_value( ev ) )
119
+ {
120
+ return error_condition( ev, generic_category() );
121
+ }
122
+ else
123
+ {
124
+ return error_condition( ev, system_category() );
125
+ }
126
+ }
127
+
128
+ } // namespace detail
129
+
130
+ } // namespace system
131
+
132
+ } // namespace boost
@@ -1,769 +1,956 @@
1
- // boost/system/error_code.hpp -------------------------------------------------------//
1
+ #ifndef BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED
2
+ #define BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED
2
3
 
3
4
  // Copyright Beman Dawes 2006, 2007
4
5
  // Copyright Christoper Kohlhoff 2007
5
6
  // Copyright Peter Dimov 2017, 2018
6
-
7
+ //
7
8
  // Distributed under the Boost Software License, Version 1.0. (See accompanying
8
9
  // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9
-
10
+ //
10
11
  // See library home page at http://www.boost.org/libs/system
11
12
 
12
- #ifndef BOOST_SYSTEM_ERROR_CODE_HPP
13
- #define BOOST_SYSTEM_ERROR_CODE_HPP
14
-
15
- #include <boost/system/config.hpp>
13
+ #include <boost/system/api_config.hpp>
14
+ #include <boost/system/detail/config.hpp>
16
15
  #include <boost/cstdint.hpp>
17
- #include <boost/assert.hpp>
18
- #include <boost/noncopyable.hpp>
19
- #include <boost/utility/enable_if.hpp>
16
+ #include <boost/config.hpp>
20
17
  #include <ostream>
21
18
  #include <string>
22
- #include <stdexcept>
23
19
  #include <functional>
20
+ #include <cstring>
24
21
 
25
22
  // TODO: undef these macros if not already defined
26
23
  #include <boost/cerrno.hpp>
27
24
 
25
+ #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
26
+ # include <system_error>
27
+ #endif
28
+
28
29
  #if !defined(BOOST_POSIX_API) && !defined(BOOST_WINDOWS_API)
29
30
  # error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined
30
31
  #endif
31
32
 
32
- #ifndef BOOST_NO_CXX11_HDR_SYSTEM_ERROR
33
- #include <system_error>
33
+ namespace boost
34
+ {
35
+
36
+ namespace system
37
+ {
38
+
39
+ class error_code; // values defined by the operating system
40
+ class error_condition; // portable generic values defined below, but ultimately
41
+ // based on the POSIX standard
42
+
43
+ // "Concept" helpers
44
+
45
+ template<class T> struct is_error_code_enum
46
+ {
47
+ static const bool value = false;
48
+ };
49
+
50
+ template<class T> struct is_error_condition_enum
51
+ {
52
+ static const bool value = false;
53
+ };
54
+
55
+ // Generic error_conditions
56
+
57
+ namespace errc
58
+ {
59
+
60
+ enum errc_t
61
+ {
62
+ success = 0,
63
+ address_family_not_supported = EAFNOSUPPORT,
64
+ address_in_use = EADDRINUSE,
65
+ address_not_available = EADDRNOTAVAIL,
66
+ already_connected = EISCONN,
67
+ argument_list_too_long = E2BIG,
68
+ argument_out_of_domain = EDOM,
69
+ bad_address = EFAULT,
70
+ bad_file_descriptor = EBADF,
71
+ bad_message = EBADMSG,
72
+ broken_pipe = EPIPE,
73
+ connection_aborted = ECONNABORTED,
74
+ connection_already_in_progress = EALREADY,
75
+ connection_refused = ECONNREFUSED,
76
+ connection_reset = ECONNRESET,
77
+ cross_device_link = EXDEV,
78
+ destination_address_required = EDESTADDRREQ,
79
+ device_or_resource_busy = EBUSY,
80
+ directory_not_empty = ENOTEMPTY,
81
+ executable_format_error = ENOEXEC,
82
+ file_exists = EEXIST,
83
+ file_too_large = EFBIG,
84
+ filename_too_long = ENAMETOOLONG,
85
+ function_not_supported = ENOSYS,
86
+ host_unreachable = EHOSTUNREACH,
87
+ identifier_removed = EIDRM,
88
+ illegal_byte_sequence = EILSEQ,
89
+ inappropriate_io_control_operation = ENOTTY,
90
+ interrupted = EINTR,
91
+ invalid_argument = EINVAL,
92
+ invalid_seek = ESPIPE,
93
+ io_error = EIO,
94
+ is_a_directory = EISDIR,
95
+ message_size = EMSGSIZE,
96
+ network_down = ENETDOWN,
97
+ network_reset = ENETRESET,
98
+ network_unreachable = ENETUNREACH,
99
+ no_buffer_space = ENOBUFS,
100
+ no_child_process = ECHILD,
101
+ no_link = ENOLINK,
102
+ no_lock_available = ENOLCK,
103
+ no_message_available = ENODATA,
104
+ no_message = ENOMSG,
105
+ no_protocol_option = ENOPROTOOPT,
106
+ no_space_on_device = ENOSPC,
107
+ no_stream_resources = ENOSR,
108
+ no_such_device_or_address = ENXIO,
109
+ no_such_device = ENODEV,
110
+ no_such_file_or_directory = ENOENT,
111
+ no_such_process = ESRCH,
112
+ not_a_directory = ENOTDIR,
113
+ not_a_socket = ENOTSOCK,
114
+ not_a_stream = ENOSTR,
115
+ not_connected = ENOTCONN,
116
+ not_enough_memory = ENOMEM,
117
+ not_supported = ENOTSUP,
118
+ operation_canceled = ECANCELED,
119
+ operation_in_progress = EINPROGRESS,
120
+ operation_not_permitted = EPERM,
121
+ operation_not_supported = EOPNOTSUPP,
122
+ operation_would_block = EWOULDBLOCK,
123
+ owner_dead = EOWNERDEAD,
124
+ permission_denied = EACCES,
125
+ protocol_error = EPROTO,
126
+ protocol_not_supported = EPROTONOSUPPORT,
127
+ read_only_file_system = EROFS,
128
+ resource_deadlock_would_occur = EDEADLK,
129
+ resource_unavailable_try_again = EAGAIN,
130
+ result_out_of_range = ERANGE,
131
+ state_not_recoverable = ENOTRECOVERABLE,
132
+ stream_timeout = ETIME,
133
+ text_file_busy = ETXTBSY,
134
+ timed_out = ETIMEDOUT,
135
+ too_many_files_open_in_system = ENFILE,
136
+ too_many_files_open = EMFILE,
137
+ too_many_links = EMLINK,
138
+ too_many_symbolic_link_levels = ELOOP,
139
+ value_too_large = EOVERFLOW,
140
+ wrong_protocol_type = EPROTOTYPE
141
+ };
142
+
143
+ } // namespace errc
144
+
145
+ #ifdef BOOST_SYSTEM_ENABLE_DEPRECATED
146
+
147
+ namespace posix = errc;
148
+ namespace posix_error = errc;
149
+
34
150
  #endif
35
151
 
36
- #include <boost/config/abi_prefix.hpp> // must be the last #include
152
+ template<> struct is_error_condition_enum<errc::errc_t>
153
+ {
154
+ static const bool value = true;
155
+ };
156
+
157
+ // class error_category
37
158
 
38
- #ifndef BOOST_SYSTEM_NOEXCEPT
39
- #define BOOST_SYSTEM_NOEXCEPT BOOST_NOEXCEPT
159
+ #ifdef BOOST_MSVC
160
+ #pragma warning( push )
161
+ // 'this' : used in base member initializer list
162
+ #pragma warning( disable: 4355 )
40
163
  #endif
41
164
 
42
- namespace boost
165
+ std::size_t hash_value( error_code const & ec );
166
+
167
+ class BOOST_SYMBOL_VISIBLE error_category
43
168
  {
44
- namespace system
45
- {
46
-
47
- class error_code; // values defined by the operating system
48
- class error_condition; // portable generic values defined below, but ultimately
49
- // based on the POSIX standard
50
-
51
- // "Concept" helpers -------------------------------------------------------------//
52
-
53
- template< class T >
54
- struct is_error_code_enum { static const bool value = false; };
55
-
56
- template< class T >
57
- struct is_error_condition_enum { static const bool value = false; };
58
-
59
- // generic error_conditions ------------------------------------------------------//
60
-
61
- namespace errc
62
- {
63
- enum errc_t
64
- {
65
- success = 0,
66
- address_family_not_supported = EAFNOSUPPORT,
67
- address_in_use = EADDRINUSE,
68
- address_not_available = EADDRNOTAVAIL,
69
- already_connected = EISCONN,
70
- argument_list_too_long = E2BIG,
71
- argument_out_of_domain = EDOM,
72
- bad_address = EFAULT,
73
- bad_file_descriptor = EBADF,
74
- bad_message = EBADMSG,
75
- broken_pipe = EPIPE,
76
- connection_aborted = ECONNABORTED,
77
- connection_already_in_progress = EALREADY,
78
- connection_refused = ECONNREFUSED,
79
- connection_reset = ECONNRESET,
80
- cross_device_link = EXDEV,
81
- destination_address_required = EDESTADDRREQ,
82
- device_or_resource_busy = EBUSY,
83
- directory_not_empty = ENOTEMPTY,
84
- executable_format_error = ENOEXEC,
85
- file_exists = EEXIST,
86
- file_too_large = EFBIG,
87
- filename_too_long = ENAMETOOLONG,
88
- function_not_supported = ENOSYS,
89
- host_unreachable = EHOSTUNREACH,
90
- identifier_removed = EIDRM,
91
- illegal_byte_sequence = EILSEQ,
92
- inappropriate_io_control_operation = ENOTTY,
93
- interrupted = EINTR,
94
- invalid_argument = EINVAL,
95
- invalid_seek = ESPIPE,
96
- io_error = EIO,
97
- is_a_directory = EISDIR,
98
- message_size = EMSGSIZE,
99
- network_down = ENETDOWN,
100
- network_reset = ENETRESET,
101
- network_unreachable = ENETUNREACH,
102
- no_buffer_space = ENOBUFS,
103
- no_child_process = ECHILD,
104
- no_link = ENOLINK,
105
- no_lock_available = ENOLCK,
106
- no_message_available = ENODATA,
107
- no_message = ENOMSG,
108
- no_protocol_option = ENOPROTOOPT,
109
- no_space_on_device = ENOSPC,
110
- no_stream_resources = ENOSR,
111
- no_such_device_or_address = ENXIO,
112
- no_such_device = ENODEV,
113
- no_such_file_or_directory = ENOENT,
114
- no_such_process = ESRCH,
115
- not_a_directory = ENOTDIR,
116
- not_a_socket = ENOTSOCK,
117
- not_a_stream = ENOSTR,
118
- not_connected = ENOTCONN,
119
- not_enough_memory = ENOMEM,
120
- not_supported = ENOTSUP,
121
- operation_canceled = ECANCELED,
122
- operation_in_progress = EINPROGRESS,
123
- operation_not_permitted = EPERM,
124
- operation_not_supported = EOPNOTSUPP,
125
- operation_would_block = EWOULDBLOCK,
126
- owner_dead = EOWNERDEAD,
127
- permission_denied = EACCES,
128
- protocol_error = EPROTO,
129
- protocol_not_supported = EPROTONOSUPPORT,
130
- read_only_file_system = EROFS,
131
- resource_deadlock_would_occur = EDEADLK,
132
- resource_unavailable_try_again = EAGAIN,
133
- result_out_of_range = ERANGE,
134
- state_not_recoverable = ENOTRECOVERABLE,
135
- stream_timeout = ETIME,
136
- text_file_busy = ETXTBSY,
137
- timed_out = ETIMEDOUT,
138
- too_many_files_open_in_system = ENFILE,
139
- too_many_files_open = EMFILE,
140
- too_many_links = EMLINK,
141
- too_many_symbolic_link_levels = ELOOP,
142
- value_too_large = EOVERFLOW,
143
- wrong_protocol_type = EPROTOTYPE
144
- };
145
-
146
- } // namespace errc
147
-
148
- # ifdef BOOST_SYSTEM_ENABLE_DEPRECATED
149
- namespace posix = errc;
150
- namespace posix_error = errc;
151
- # endif
169
+ private:
152
170
 
153
- template<> struct is_error_condition_enum<errc::errc_t>
154
- { static const bool value = true; };
171
+ friend std::size_t hash_value( error_code const & ec );
155
172
 
173
+ #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
174
+ public:
156
175
 
157
- // --------------------------------------------------------------------------------//
176
+ error_category( error_category const & ) = delete;
177
+ error_category& operator=( error_category const & ) = delete;
158
178
 
159
- // Operating system specific interfaces ------------------------------------------//
179
+ #else
180
+ private:
160
181
 
182
+ error_category( error_category const & );
183
+ error_category& operator=( error_category const & );
161
184
 
162
- // The interface is divided into general and system-specific portions to
163
- // meet these requirements:
164
- //
165
- // * Code calling an operating system API can create an error_code with
166
- // a single category (system_category), even for POSIX-like operating
167
- // systems that return some POSIX errno values and some native errno
168
- // values. This code should not have to pay the cost of distinguishing
169
- // between categories, since it is not yet known if that is needed.
170
- //
171
- // * Users wishing to write system-specific code should be given enums for
172
- // at least the common error cases.
173
- //
174
- // * System specific code should fail at compile time if moved to another
175
- // operating system.
185
+ #endif
186
+
187
+ private:
176
188
 
177
- // The system specific portions of the interface are located in headers
178
- // with names reflecting the operating system. For example,
179
- //
180
- // <boost/system/cygwin_error.hpp>
181
- // <boost/system/linux_error.hpp>
182
- // <boost/system/windows_error.hpp>
183
- //
184
- // These headers are effectively empty for compiles on operating systems
185
- // where they are not applicable.
189
+ boost::ulong_long_type id_;
186
190
 
187
- // --------------------------------------------------------------------------------//
191
+ protected:
188
192
 
189
- class error_category;
193
+ #if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS)
190
194
 
191
- // predefined error categories ---------------------------------------------------//
195
+ ~error_category() = default;
192
196
 
193
- #ifdef BOOST_ERROR_CODE_HEADER_ONLY
194
- inline const error_category & system_category() BOOST_SYSTEM_NOEXCEPT;
195
- inline const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT;
196
197
  #else
197
- BOOST_SYSTEM_DECL const error_category & system_category() BOOST_SYSTEM_NOEXCEPT;
198
- BOOST_SYSTEM_DECL const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT;
199
- #endif
200
- // deprecated synonyms ------------------------------------------------------------//
201
198
 
202
- #ifdef BOOST_SYSTEM_ENABLE_DEPRECATED
203
- inline const error_category & get_system_category() { return system_category(); }
204
- inline const error_category & get_generic_category() { return generic_category(); }
205
- inline const error_category & get_posix_category() { return generic_category(); }
206
- static const error_category & posix_category BOOST_ATTRIBUTE_UNUSED
207
- = generic_category();
208
- static const error_category & errno_ecat BOOST_ATTRIBUTE_UNUSED
209
- = generic_category();
210
- static const error_category & native_ecat BOOST_ATTRIBUTE_UNUSED
211
- = system_category();
212
- #endif
199
+ // We'd like to make the destructor protected, to make code that deletes
200
+ // an error_category* not compile; unfortunately, doing the below makes
201
+ // the destructor user-provided and hence breaks use after main, as the
202
+ // categories may get destroyed before code that uses them
203
+
204
+ // ~error_category() {}
213
205
 
214
- #ifdef BOOST_MSVC
215
- #pragma warning(push)
216
- // 'this' : used in base member initializer list
217
- #pragma warning(disable: 4355)
218
206
  #endif
219
207
 
220
- // class error_category ------------------------------------------------//
208
+ BOOST_SYSTEM_CONSTEXPR error_category() BOOST_NOEXCEPT: id_( 0 )
209
+ {
210
+ }
221
211
 
222
- class error_category : public noncopyable
212
+ explicit BOOST_SYSTEM_CONSTEXPR error_category( boost::ulong_long_type id ) BOOST_NOEXCEPT: id_( id )
223
213
  {
224
- #ifndef BOOST_NO_CXX11_HDR_SYSTEM_ERROR
214
+ }
215
+
216
+ public:
217
+
218
+ virtual const char * name() const BOOST_NOEXCEPT = 0;
225
219
 
226
- private:
220
+ virtual error_condition default_error_condition( int ev ) const BOOST_NOEXCEPT;
221
+ virtual bool equivalent( int code, const error_condition & condition ) const BOOST_NOEXCEPT;
222
+ virtual bool equivalent( const error_code & code, int condition ) const BOOST_NOEXCEPT;
227
223
 
228
- class std_category: public std::error_category
229
- {
230
- private:
224
+ virtual std::string message( int ev ) const = 0;
225
+ virtual char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT;
231
226
 
232
- boost::system::error_category const * pc_;
227
+ virtual bool failed( int ev ) const BOOST_NOEXCEPT;
233
228
 
234
- public:
229
+ BOOST_SYSTEM_CONSTEXPR bool operator==( const error_category & rhs ) const BOOST_NOEXCEPT
230
+ {
231
+ return rhs.id_ == 0? this == &rhs: id_ == rhs.id_;
232
+ }
233
+
234
+ BOOST_SYSTEM_CONSTEXPR bool operator!=( const error_category & rhs ) const BOOST_NOEXCEPT
235
+ {
236
+ return !( *this == rhs );
237
+ }
235
238
 
236
- explicit std_category( boost::system::error_category const * pc ): pc_( pc )
239
+ BOOST_SYSTEM_CONSTEXPR bool operator<( const error_category & rhs ) const BOOST_NOEXCEPT
240
+ {
241
+ if( id_ < rhs.id_ )
237
242
  {
243
+ return true;
238
244
  }
239
245
 
240
- virtual const char * name() const BOOST_NOEXCEPT
246
+ if( id_ > rhs.id_ )
241
247
  {
242
- return pc_->name();
248
+ return false;
243
249
  }
244
250
 
245
- virtual std::string message( int ev ) const
251
+ if( rhs.id_ != 0 )
246
252
  {
247
- return pc_->message( ev );
253
+ return false; // equal
248
254
  }
249
255
 
250
- virtual std::error_condition default_error_condition( int ev ) const
251
- BOOST_NOEXCEPT;
252
- virtual bool equivalent( int code, const std::error_condition & condition ) const
253
- BOOST_NOEXCEPT;
254
- virtual bool equivalent( const std::error_code & code, int condition ) const
255
- BOOST_NOEXCEPT;
256
- };
256
+ return std::less<error_category const *>()( this, &rhs );
257
+ }
257
258
 
258
- std_category std_cat_;
259
+ #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
259
260
 
260
- public:
261
+ operator std::error_category const & () const;
261
262
 
262
- error_category() BOOST_SYSTEM_NOEXCEPT: std_cat_( this ) {}
263
+ #endif
264
+ };
263
265
 
264
- operator std::error_category const & () const BOOST_SYSTEM_NOEXCEPT
265
- {
266
- // do not map generic to std::generic on purpose; occasionally,
267
- // there are two std::generic categories in a program, which leads
268
- // to error codes/conditions mysteriously not being equal to themselves
269
- return std_cat_;
270
- }
266
+ #ifdef BOOST_MSVC
267
+ #pragma warning( pop )
268
+ #endif
271
269
 
272
- #else
270
+ // predefined error categories
273
271
 
274
- // to maintain ABI compatibility between 03 and 11,
275
- // define a class with the same layout
272
+ namespace detail
273
+ {
276
274
 
277
- private:
275
+ class BOOST_SYMBOL_VISIBLE generic_error_category: public error_category
276
+ {
277
+ public:
278
278
 
279
- class std_category
280
- {
281
- private:
279
+ // clang++ 3.8 and below: initialization of const object
280
+ // requires a user-provided default constructor
281
+ BOOST_SYSTEM_CONSTEXPR generic_error_category() BOOST_NOEXCEPT:
282
+ error_category( ( boost::ulong_long_type( 0xB2AB117A ) << 32 ) + 0x257EDF0D )
283
+ {
284
+ }
282
285
 
283
- boost::system::error_category const * pc_;
286
+ const char * name() const BOOST_NOEXCEPT
287
+ {
288
+ return "generic";
289
+ }
284
290
 
285
- public:
291
+ std::string message( int ev ) const;
292
+ char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT;
293
+ };
286
294
 
287
- explicit std_category( boost::system::error_category const * pc ): pc_( pc )
288
- {
289
- }
295
+ class BOOST_SYMBOL_VISIBLE system_error_category: public error_category
296
+ {
297
+ public:
290
298
 
291
- virtual ~std_category() {}
299
+ BOOST_SYSTEM_CONSTEXPR system_error_category() BOOST_NOEXCEPT:
300
+ error_category( ( boost::ulong_long_type( 0x8FAFD21E ) << 32 ) + 0x25C5E09B )
301
+ {
302
+ }
292
303
 
293
- virtual const char * name() const BOOST_NOEXCEPT
294
- {
295
- return pc_->name();
296
- }
304
+ const char * name() const BOOST_NOEXCEPT
305
+ {
306
+ return "system";
307
+ }
297
308
 
298
- // we can't define message, because (1) it returns an std::string,
299
- // which can be different between 03 and 11, and (2) on mingw, there
300
- // are actually two `message` functions, not one, so it doesn't work
301
- // even if we do
309
+ error_condition default_error_condition( int ev ) const BOOST_NOEXCEPT;
302
310
 
303
- // neither can we define default_error_condition or equivalent
311
+ std::string message( int ev ) const;
312
+ char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT;
313
+ };
304
314
 
305
- // if these functions are called, it will crash, but that's still
306
- // better than the alternative of having the class layout change
307
- };
315
+ } // namespace detail
308
316
 
309
- std_category std_cat_;
317
+ // generic_category(), system_category()
310
318
 
311
- public:
319
+ #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
312
320
 
313
- error_category() BOOST_SYSTEM_NOEXCEPT: std_cat_( this ) {}
321
+ namespace detail
322
+ {
314
323
 
315
- #endif
324
+ template<class T> struct cat_holder
325
+ {
326
+ BOOST_SYSTEM_REQUIRE_CONST_INIT static constexpr system_error_category system_category_instance{};
327
+ BOOST_SYSTEM_REQUIRE_CONST_INIT static constexpr generic_error_category generic_category_instance{};
328
+ };
316
329
 
317
- public:
318
- virtual ~error_category(){}
319
-
320
- virtual const char * name() const BOOST_SYSTEM_NOEXCEPT = 0;
321
- virtual std::string message( int ev ) const = 0;
322
- inline virtual error_condition default_error_condition( int ev ) const
323
- BOOST_SYSTEM_NOEXCEPT;
324
- inline virtual bool equivalent( int code,
325
- const error_condition & condition ) const
326
- BOOST_SYSTEM_NOEXCEPT;
327
- inline virtual bool equivalent( const error_code & code,
328
- int condition ) const BOOST_SYSTEM_NOEXCEPT;
329
-
330
- bool operator==(const error_category & rhs) const BOOST_SYSTEM_NOEXCEPT
331
- { return this == &rhs; }
332
- bool operator!=(const error_category & rhs) const BOOST_SYSTEM_NOEXCEPT
333
- { return this != &rhs; }
334
- bool operator<( const error_category & rhs ) const BOOST_SYSTEM_NOEXCEPT
335
- { return std::less<const error_category*>()( this, &rhs ); }
336
- };
330
+ template<class T> BOOST_SYSTEM_REQUIRE_CONST_INIT constexpr system_error_category cat_holder<T>::system_category_instance;
331
+ template<class T> BOOST_SYSTEM_REQUIRE_CONST_INIT constexpr generic_error_category cat_holder<T>::generic_category_instance;
337
332
 
338
- #ifdef BOOST_MSVC
339
- #pragma warning(pop)
340
- #endif
333
+ } // namespace detail
341
334
 
342
- // class error_condition ---------------------------------------------------------//
335
+ constexpr error_category const & system_category() BOOST_NOEXCEPT
336
+ {
337
+ return detail::cat_holder<void>::system_category_instance;
338
+ }
343
339
 
344
- // error_conditions are portable, error_codes are system or library specific
340
+ constexpr error_category const & generic_category() BOOST_NOEXCEPT
341
+ {
342
+ return detail::cat_holder<void>::generic_category_instance;
343
+ }
345
344
 
346
- class error_condition
347
- {
348
- public:
345
+ #else // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
349
346
 
350
- // constructors:
351
- error_condition() BOOST_SYSTEM_NOEXCEPT : m_val(0), m_cat(&generic_category()) {}
352
- error_condition( int val, const error_category & cat ) BOOST_SYSTEM_NOEXCEPT
353
- : m_val(val), m_cat(&cat) {}
347
+ inline error_category const & system_category() BOOST_NOEXCEPT
348
+ {
349
+ static const detail::system_error_category system_category_instance;
350
+ return system_category_instance;
351
+ }
354
352
 
355
- template <class ErrorConditionEnum>
356
- error_condition(ErrorConditionEnum e,
357
- typename boost::enable_if<is_error_condition_enum<ErrorConditionEnum> >::type*
358
- = 0) BOOST_SYSTEM_NOEXCEPT
359
- {
360
- *this = make_error_condition(e);
361
- }
353
+ inline error_category const & generic_category() BOOST_NOEXCEPT
354
+ {
355
+ static const detail::generic_error_category generic_category_instance;
356
+ return generic_category_instance;
357
+ }
362
358
 
363
- // modifiers:
359
+ #endif // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
364
360
 
365
- void assign( int val, const error_category & cat ) BOOST_SYSTEM_NOEXCEPT
366
- {
367
- m_val = val;
368
- m_cat = &cat;
369
- }
361
+ // deprecated synonyms
370
362
 
371
- template<typename ErrorConditionEnum>
372
- typename boost::enable_if<is_error_condition_enum<ErrorConditionEnum>,
373
- error_condition>::type &
374
- operator=( ErrorConditionEnum val ) BOOST_SYSTEM_NOEXCEPT
375
- {
376
- *this = make_error_condition(val);
377
- return *this;
378
- }
363
+ #ifdef BOOST_SYSTEM_ENABLE_DEPRECATED
379
364
 
380
- void clear() BOOST_SYSTEM_NOEXCEPT
381
- {
382
- m_val = 0;
383
- m_cat = &generic_category();
384
- }
365
+ inline const error_category & get_system_category() { return system_category(); }
366
+ inline const error_category & get_generic_category() { return generic_category(); }
367
+ inline const error_category & get_posix_category() { return generic_category(); }
368
+ static const error_category & posix_category BOOST_ATTRIBUTE_UNUSED = generic_category();
369
+ static const error_category & errno_ecat BOOST_ATTRIBUTE_UNUSED = generic_category();
370
+ static const error_category & native_ecat BOOST_ATTRIBUTE_UNUSED = system_category();
385
371
 
386
- // observers:
387
- int value() const BOOST_SYSTEM_NOEXCEPT { return m_val; }
388
- const error_category & category() const BOOST_SYSTEM_NOEXCEPT { return *m_cat; }
389
- std::string message() const { return m_cat->message(value()); }
372
+ #endif
390
373
 
391
- #if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
374
+ // enable_if
392
375
 
393
- explicit operator bool() const BOOST_SYSTEM_NOEXCEPT // true if error
394
- {
395
- return m_val != 0;
396
- }
376
+ namespace detail
377
+ {
397
378
 
398
- #else
379
+ template<bool C, class T = void> struct enable_if
380
+ {
381
+ typedef T type;
382
+ };
399
383
 
400
- typedef void (*unspecified_bool_type)();
401
- static void unspecified_bool_true() {}
384
+ template<class T> struct enable_if<false, T>
385
+ {
386
+ };
402
387
 
403
- operator unspecified_bool_type() const BOOST_SYSTEM_NOEXCEPT // true if error
404
- {
405
- return m_val == 0 ? 0 : unspecified_bool_true;
406
- }
388
+ // failed_impl
407
389
 
408
- bool operator!() const BOOST_SYSTEM_NOEXCEPT // true if no error
409
- {
410
- return m_val == 0;
411
- }
390
+ #if !defined(BOOST_SYSTEM_HAS_CONSTEXPR)
412
391
 
413
- #endif
392
+ inline bool failed_impl( int ev, error_category const & cat )
393
+ {
394
+ return cat.failed( ev );
395
+ }
414
396
 
415
- // relationals:
416
- // the more symmetrical non-member syntax allows enum
417
- // conversions work for both rhs and lhs.
418
- inline friend bool operator==( const error_condition & lhs,
419
- const error_condition & rhs ) BOOST_SYSTEM_NOEXCEPT
420
- {
421
- return lhs.m_cat == rhs.m_cat && lhs.m_val == rhs.m_val;
422
- }
423
-
424
- inline friend bool operator<( const error_condition & lhs,
425
- const error_condition & rhs ) BOOST_SYSTEM_NOEXCEPT
426
- // the more symmetrical non-member syntax allows enum
427
- // conversions work for both rhs and lhs.
428
- {
429
- return lhs.m_cat < rhs.m_cat
430
- || (lhs.m_cat == rhs.m_cat && lhs.m_val < rhs.m_val);
431
- }
432
-
433
- #ifndef BOOST_NO_CXX11_HDR_SYSTEM_ERROR
434
-
435
- operator std::error_condition () const BOOST_SYSTEM_NOEXCEPT
436
- {
437
- return std::error_condition( value(), category() );
438
- }
397
+ #else
398
+
399
+ BOOST_SYSTEM_CONSTEXPR inline bool failed_impl( int ev, error_category const & cat )
400
+ {
401
+ if( cat == system_category() || cat == generic_category() )
402
+ {
403
+ return ev != 0;
404
+ }
405
+ else
406
+ {
407
+ return cat.failed( ev );
408
+ }
409
+ }
439
410
 
440
411
  #endif
441
412
 
442
- private:
443
- int m_val;
444
- const error_category * m_cat;
445
-
446
- };
447
-
448
- // class error_code --------------------------------------------------------------//
449
-
450
- // We want error_code to be a value type that can be copied without slicing
451
- // and without requiring heap allocation, but we also want it to have
452
- // polymorphic behavior based on the error category. This is achieved by
453
- // abstract base class error_category supplying the polymorphic behavior,
454
- // and error_code containing a pointer to an object of a type derived
455
- // from error_category.
456
- class error_code
457
- {
458
- public:
459
-
460
- // constructors:
461
- error_code() BOOST_SYSTEM_NOEXCEPT : m_val(0), m_cat(&system_category()) {}
462
- error_code( int val, const error_category & cat ) BOOST_SYSTEM_NOEXCEPT
463
- : m_val(val), m_cat(&cat) {}
464
-
465
- template <class ErrorCodeEnum>
466
- error_code(ErrorCodeEnum e,
467
- typename boost::enable_if<is_error_code_enum<ErrorCodeEnum> >::type* = 0)
468
- BOOST_SYSTEM_NOEXCEPT
469
- {
470
- *this = make_error_code(e);
471
- }
472
-
473
- // modifiers:
474
- void assign( int val, const error_category & cat ) BOOST_SYSTEM_NOEXCEPT
475
- {
476
- m_val = val;
477
- m_cat = &cat;
478
- }
479
-
480
- template<typename ErrorCodeEnum>
481
- typename boost::enable_if<is_error_code_enum<ErrorCodeEnum>, error_code>::type &
482
- operator=( ErrorCodeEnum val ) BOOST_SYSTEM_NOEXCEPT
483
- {
484
- *this = make_error_code(val);
413
+ } // namespace detail
414
+
415
+ // class error_condition
416
+
417
+ // error_conditions are portable, error_codes are system or library specific
418
+
419
+ class error_condition
420
+ {
421
+ private:
422
+
423
+ int val_;
424
+ bool failed_;
425
+ error_category const * cat_;
426
+
427
+ public:
428
+
429
+ // constructors:
430
+
431
+ BOOST_SYSTEM_CONSTEXPR error_condition() BOOST_NOEXCEPT:
432
+ val_( 0 ), failed_( false ), cat_( &generic_category() )
433
+ {
434
+ }
435
+
436
+ BOOST_SYSTEM_CONSTEXPR error_condition( int val, const error_category & cat ) BOOST_NOEXCEPT:
437
+ val_( val ), failed_( detail::failed_impl( val, cat ) ), cat_( &cat )
438
+ {
439
+ }
440
+
441
+ template<class ErrorConditionEnum> BOOST_SYSTEM_CONSTEXPR error_condition( ErrorConditionEnum e,
442
+ typename detail::enable_if<is_error_condition_enum<ErrorConditionEnum>::value>::type* = 0) BOOST_NOEXCEPT
443
+ {
444
+ *this = make_error_condition( e );
445
+ }
446
+
447
+ // modifiers:
448
+
449
+ BOOST_SYSTEM_CONSTEXPR void assign( int val, const error_category & cat ) BOOST_NOEXCEPT
450
+ {
451
+ val_ = val;
452
+ failed_ = detail::failed_impl( val, cat );
453
+ cat_ = &cat;
454
+ }
455
+
456
+ template<typename ErrorConditionEnum>
457
+ BOOST_SYSTEM_CONSTEXPR typename detail::enable_if<is_error_condition_enum<ErrorConditionEnum>::value, error_condition>::type &
458
+ operator=( ErrorConditionEnum val ) BOOST_NOEXCEPT
459
+ {
460
+ *this = make_error_condition( val );
485
461
  return *this;
486
- }
462
+ }
487
463
 
488
- void clear() BOOST_SYSTEM_NOEXCEPT
489
- {
490
- m_val = 0;
491
- m_cat = &system_category();
492
- }
464
+ BOOST_SYSTEM_CONSTEXPR void clear() BOOST_NOEXCEPT
465
+ {
466
+ val_ = 0;
467
+ failed_ = false;
468
+ cat_ = &generic_category();
469
+ }
493
470
 
494
- // observers:
495
- int value() const BOOST_SYSTEM_NOEXCEPT { return m_val; }
496
- const error_category & category() const BOOST_SYSTEM_NOEXCEPT { return *m_cat; }
497
- error_condition default_error_condition() const BOOST_SYSTEM_NOEXCEPT
498
- { return m_cat->default_error_condition(value()); }
499
- std::string message() const { return m_cat->message(value()); }
471
+ // observers:
472
+
473
+ BOOST_SYSTEM_CONSTEXPR int value() const BOOST_NOEXCEPT
474
+ {
475
+ return val_;
476
+ }
477
+
478
+ BOOST_SYSTEM_CONSTEXPR const error_category & category() const BOOST_NOEXCEPT
479
+ {
480
+ return *cat_;
481
+ }
482
+
483
+ std::string message() const
484
+ {
485
+ return cat_->message( value() );
486
+ }
487
+
488
+ char const * message( char * buffer, std::size_t len ) const BOOST_NOEXCEPT
489
+ {
490
+ return cat_->message( value(), buffer, len );
491
+ }
492
+
493
+ BOOST_SYSTEM_CONSTEXPR bool failed() const BOOST_NOEXCEPT
494
+ {
495
+ return failed_;
496
+ }
500
497
 
501
498
  #if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
502
499
 
503
- explicit operator bool() const BOOST_SYSTEM_NOEXCEPT // true if error
504
- {
505
- return m_val != 0;
506
- }
500
+ BOOST_SYSTEM_CONSTEXPR explicit operator bool() const BOOST_NOEXCEPT // true if error
501
+ {
502
+ return failed_;
503
+ }
507
504
 
508
505
  #else
509
506
 
510
- typedef void (*unspecified_bool_type)();
511
- static void unspecified_bool_true() {}
507
+ typedef void (*unspecified_bool_type)();
508
+ static void unspecified_bool_true() {}
512
509
 
513
- operator unspecified_bool_type() const BOOST_SYSTEM_NOEXCEPT // true if error
514
- {
515
- return m_val == 0 ? 0 : unspecified_bool_true;
516
- }
510
+ BOOST_SYSTEM_CONSTEXPR operator unspecified_bool_type() const BOOST_NOEXCEPT // true if error
511
+ {
512
+ return failed_? unspecified_bool_true: 0;
513
+ }
517
514
 
518
- bool operator!() const BOOST_SYSTEM_NOEXCEPT // true if no error
519
- {
520
- return m_val == 0;
521
- }
515
+ BOOST_SYSTEM_CONSTEXPR bool operator!() const BOOST_NOEXCEPT // true if no error
516
+ {
517
+ return !failed_;
518
+ }
522
519
 
523
520
  #endif
524
521
 
525
- // relationals:
526
- inline friend bool operator==( const error_code & lhs,
527
- const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT
528
- // the more symmetrical non-member syntax allows enum
529
- // conversions work for both rhs and lhs.
530
- {
531
- return lhs.m_cat == rhs.m_cat && lhs.m_val == rhs.m_val;
532
- }
533
-
534
- inline friend bool operator<( const error_code & lhs,
535
- const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT
536
- // the more symmetrical non-member syntax allows enum
537
- // conversions work for both rhs and lhs.
538
- {
539
- return lhs.m_cat < rhs.m_cat
540
- || (lhs.m_cat == rhs.m_cat && lhs.m_val < rhs.m_val);
541
- }
542
-
543
- #ifndef BOOST_NO_CXX11_HDR_SYSTEM_ERROR
544
-
545
- operator std::error_code () const BOOST_SYSTEM_NOEXCEPT
546
- {
547
- return std::error_code( value(), category() );
548
- }
522
+ // relationals:
523
+ // the more symmetrical non-member syntax allows enum
524
+ // conversions work for both rhs and lhs.
525
+
526
+ BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( const error_condition & lhs, const error_condition & rhs ) BOOST_NOEXCEPT
527
+ {
528
+ return lhs.val_ == rhs.val_ && *lhs.cat_ == *rhs.cat_;
529
+ }
530
+
531
+ BOOST_SYSTEM_CONSTEXPR inline friend bool operator<( const error_condition & lhs, const error_condition & rhs ) BOOST_NOEXCEPT
532
+ {
533
+ return *lhs.cat_ < *rhs.cat_ || ( *lhs.cat_ == *rhs.cat_ && lhs.val_ < rhs.val_ );
534
+ }
535
+
536
+ #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
537
+
538
+ operator std::error_condition () const
539
+ {
540
+ return std::error_condition( value(), category() );
541
+ }
549
542
 
550
543
  #endif
544
+ };
551
545
 
552
- private:
553
- int m_val;
554
- const error_category * m_cat;
546
+ // class error_code
555
547
 
556
- };
548
+ // We want error_code to be a value type that can be copied without slicing
549
+ // and without requiring heap allocation, but we also want it to have
550
+ // polymorphic behavior based on the error category. This is achieved by
551
+ // abstract base class error_category supplying the polymorphic behavior,
552
+ // and error_code containing a pointer to an object of a type derived
553
+ // from error_category.
557
554
 
558
- // predefined error_code object used as "throw on error" tag
559
- # ifdef BOOST_SYSTEM_ENABLE_DEPRECATED
560
- BOOST_SYSTEM_DECL extern error_code throws;
561
- # endif
555
+ class error_code
556
+ {
557
+ private:
558
+
559
+ int val_;
560
+ bool failed_;
561
+ const error_category * cat_;
562
+
563
+ public:
562
564
 
563
- // Moving from a "throws" object to a "throws" function without breaking
564
- // existing code is a bit of a problem. The workaround is to place the
565
- // "throws" function in namespace boost rather than namespace boost::system.
565
+ // constructors:
566
566
 
567
- } // namespace system
568
-
569
- namespace detail
570
- {
571
- // Misuse of the error_code object is turned into a noisy failure by
572
- // poisoning the reference. This particular implementation doesn't
573
- // produce warnings or errors from popular compilers, is very efficient
574
- // (as determined by inspecting generated code), and does not suffer
575
- // from order of initialization problems. In practice, it also seems
576
- // cause user function error handling implementation errors to be detected
577
- // very early in the development cycle.
578
- inline system::error_code* throws()
567
+ BOOST_SYSTEM_CONSTEXPR error_code() BOOST_NOEXCEPT:
568
+ val_( 0 ), failed_( false ), cat_( &system_category() )
579
569
  {
580
- // See github.com/boostorg/system/pull/12 by visigoth for why the return
581
- // is poisoned with nonzero rather than (0). A test, test_throws_usage(),
582
- // has been added to error_code_test.cpp, and as visigoth mentioned it
583
- // fails on clang for release builds with a return of 0 but works fine
584
- // with (1).
585
- // Since the undefined behavior sanitizer (-fsanitize=undefined) does not
586
- // allow a reference to be formed to the unaligned address of (1), we use
587
- // (8) instead.
588
- return reinterpret_cast<system::error_code*>(8);
589
570
  }
590
- }
591
571
 
592
- inline system::error_code& throws()
593
- { return *detail::throws(); }
572
+ BOOST_SYSTEM_CONSTEXPR error_code( int val, const error_category & cat ) BOOST_NOEXCEPT:
573
+ val_( val ), failed_( detail::failed_impl( val, cat ) ), cat_( &cat )
574
+ {
575
+ }
576
+
577
+ template<class ErrorCodeEnum> BOOST_SYSTEM_CONSTEXPR error_code( ErrorCodeEnum e,
578
+ typename detail::enable_if<is_error_code_enum<ErrorCodeEnum>::value>::type* = 0 ) BOOST_NOEXCEPT
579
+ {
580
+ *this = make_error_code( e );
581
+ }
594
582
 
595
- namespace system
596
- {
597
- // non-member functions ------------------------------------------------//
583
+ // modifiers:
598
584
 
599
- inline bool operator!=( const error_code & lhs,
600
- const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT
585
+ BOOST_SYSTEM_CONSTEXPR void assign( int val, const error_category & cat ) BOOST_NOEXCEPT
601
586
  {
602
- return !(lhs == rhs);
587
+ val_ = val;
588
+ failed_ = detail::failed_impl( val, cat );
589
+ cat_ = &cat;
590
+ }
591
+
592
+ template<typename ErrorCodeEnum>
593
+ BOOST_SYSTEM_CONSTEXPR typename detail::enable_if<is_error_code_enum<ErrorCodeEnum>::value, error_code>::type &
594
+ operator=( ErrorCodeEnum val ) BOOST_NOEXCEPT
595
+ {
596
+ *this = make_error_code( val );
597
+ return *this;
603
598
  }
604
599
 
605
- inline bool operator!=( const error_condition & lhs,
606
- const error_condition & rhs ) BOOST_SYSTEM_NOEXCEPT
600
+ BOOST_SYSTEM_CONSTEXPR void clear() BOOST_NOEXCEPT
607
601
  {
608
- return !(lhs == rhs);
602
+ val_ = 0;
603
+ failed_ = false;
604
+ cat_ = &system_category();
609
605
  }
610
606
 
611
- inline bool operator==( const error_code & code,
612
- const error_condition & condition ) BOOST_SYSTEM_NOEXCEPT
607
+ // observers:
608
+
609
+ BOOST_SYSTEM_CONSTEXPR int value() const BOOST_NOEXCEPT
613
610
  {
614
- return code.category().equivalent( code.value(), condition )
615
- || condition.category().equivalent( code, condition.value() );
611
+ return val_;
616
612
  }
617
613
 
618
- inline bool operator!=( const error_code & lhs,
619
- const error_condition & rhs ) BOOST_SYSTEM_NOEXCEPT
614
+ BOOST_SYSTEM_CONSTEXPR const error_category & category() const BOOST_NOEXCEPT
620
615
  {
621
- return !(lhs == rhs);
616
+ return *cat_;
622
617
  }
623
618
 
624
- inline bool operator==( const error_condition & condition,
625
- const error_code & code ) BOOST_SYSTEM_NOEXCEPT
619
+ error_condition default_error_condition() const BOOST_NOEXCEPT
626
620
  {
627
- return condition.category().equivalent( code, condition.value() )
628
- || code.category().equivalent( code.value(), condition );
621
+ return cat_->default_error_condition( value() );
629
622
  }
630
623
 
631
- inline bool operator!=( const error_condition & lhs,
632
- const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT
624
+ std::string message() const
633
625
  {
634
- return !(lhs == rhs);
626
+ return cat_->message( value() );
635
627
  }
636
628
 
637
- // TODO: both of these may move elsewhere, but the LWG hasn't spoken yet.
629
+ char const * message( char * buffer, std::size_t len ) const BOOST_NOEXCEPT
630
+ {
631
+ return cat_->message( value(), buffer, len );
632
+ }
638
633
 
639
- template <class charT, class traits>
640
- inline std::basic_ostream<charT,traits>&
641
- operator<< (std::basic_ostream<charT,traits>& os, error_code ec)
634
+ BOOST_SYSTEM_CONSTEXPR bool failed() const BOOST_NOEXCEPT
642
635
  {
643
- os << ec.category().name() << ':' << ec.value();
644
- return os;
636
+ return failed_;
645
637
  }
646
638
 
647
- inline std::size_t hash_value( const error_code & ec )
639
+ #if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
640
+
641
+ BOOST_SYSTEM_CONSTEXPR explicit operator bool() const BOOST_NOEXCEPT // true if error
648
642
  {
649
- return static_cast<std::size_t>(ec.value())
650
- + reinterpret_cast<std::size_t>(&ec.category());
643
+ return failed_;
651
644
  }
652
645
 
653
- // make_* functions for errc::errc_t ---------------------------------------------//
646
+ #else
647
+
648
+ typedef void (*unspecified_bool_type)();
649
+ static void unspecified_bool_true() {}
654
650
 
655
- namespace errc
651
+ BOOST_SYSTEM_CONSTEXPR operator unspecified_bool_type() const BOOST_NOEXCEPT // true if error
656
652
  {
657
- // explicit conversion:
658
- inline error_code make_error_code( errc_t e ) BOOST_SYSTEM_NOEXCEPT
659
- { return error_code( e, generic_category() ); }
653
+ return failed_? unspecified_bool_true: 0;
654
+ }
660
655
 
661
- // implicit conversion:
662
- inline error_condition make_error_condition( errc_t e ) BOOST_SYSTEM_NOEXCEPT
663
- { return error_condition( e, generic_category() ); }
656
+ BOOST_SYSTEM_CONSTEXPR bool operator!() const BOOST_NOEXCEPT // true if no error
657
+ {
658
+ return !failed_;
664
659
  }
665
660
 
666
- // error_category default implementation -----------------------------------------//
661
+ #endif
662
+
663
+ // relationals:
667
664
 
668
- error_condition error_category::default_error_condition( int ev ) const
669
- BOOST_SYSTEM_NOEXCEPT
665
+ // the more symmetrical non-member syntax allows enum
666
+ // conversions work for both rhs and lhs.
667
+
668
+ BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( const error_code & lhs, const error_code & rhs ) BOOST_NOEXCEPT
670
669
  {
671
- return error_condition( ev, *this );
670
+ return lhs.val_ == rhs.val_ && *lhs.cat_ == *rhs.cat_;
672
671
  }
673
672
 
674
- bool error_category::equivalent( int code,
675
- const error_condition & condition ) const BOOST_SYSTEM_NOEXCEPT
673
+ BOOST_SYSTEM_CONSTEXPR inline friend bool operator<( const error_code & lhs, const error_code & rhs ) BOOST_NOEXCEPT
676
674
  {
677
- return default_error_condition( code ) == condition;
675
+ return *lhs.cat_ < *rhs.cat_ || ( *lhs.cat_ == *rhs.cat_ && lhs.val_ < rhs.val_ );
678
676
  }
679
677
 
680
- bool error_category::equivalent( const error_code & code,
681
- int condition ) const BOOST_SYSTEM_NOEXCEPT
678
+ #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
679
+
680
+ operator std::error_code () const
682
681
  {
683
- return *this == code.category() && code.value() == condition;
682
+ return std::error_code( value(), category() );
684
683
  }
685
684
 
686
- #ifndef BOOST_NO_CXX11_HDR_SYSTEM_ERROR
685
+ #endif
686
+ };
687
+
688
+ } // namespace system
689
+
690
+ // boost::throws()
691
+
692
+ namespace detail
693
+ {
694
+
695
+ // Misuse of the error_code object is turned into a noisy failure by
696
+ // poisoning the reference. This particular implementation doesn't
697
+ // produce warnings or errors from popular compilers, is very efficient
698
+ // (as determined by inspecting generated code), and does not suffer
699
+ // from order of initialization problems. In practice, it also seems
700
+ // cause user function error handling implementation errors to be detected
701
+ // very early in the development cycle.
702
+
703
+ inline system::error_code* throws()
704
+ {
705
+ // See github.com/boostorg/system/pull/12 by visigoth for why the return
706
+ // is poisoned with nonzero rather than (0). A test, test_throws_usage(),
707
+ // has been added to error_code_test.cpp, and as visigoth mentioned it
708
+ // fails on clang for release builds with a return of 0 but works fine
709
+ // with (1).
710
+ // Since the undefined behavior sanitizer (-fsanitize=undefined) does not
711
+ // allow a reference to be formed to the unaligned address of (1), we use
712
+ // (8) instead.
713
+
714
+ return reinterpret_cast<system::error_code*>(8);
715
+ }
716
+
717
+ } // namespace detail
718
+
719
+ inline system::error_code& throws()
720
+ {
721
+ return *detail::throws();
722
+ }
723
+
724
+ // non-member functions of error_code and error_condition
725
+
726
+ namespace system
727
+ {
728
+
729
+ BOOST_SYSTEM_CONSTEXPR inline bool operator!=( const error_code & lhs, const error_code & rhs ) BOOST_NOEXCEPT
730
+ {
731
+ return !( lhs == rhs );
732
+ }
733
+
734
+ BOOST_SYSTEM_CONSTEXPR inline bool operator!=( const error_condition & lhs, const error_condition & rhs ) BOOST_NOEXCEPT
735
+ {
736
+ return !( lhs == rhs );
737
+ }
738
+
739
+ inline bool operator==( const error_code & code, const error_condition & condition ) BOOST_NOEXCEPT
740
+ {
741
+ return code.category().equivalent( code.value(), condition ) || condition.category().equivalent( code, condition.value() );
742
+ }
743
+
744
+ inline bool operator!=( const error_code & lhs, const error_condition & rhs ) BOOST_NOEXCEPT
745
+ {
746
+ return !( lhs == rhs );
747
+ }
748
+
749
+ inline bool operator==( const error_condition & condition, const error_code & code ) BOOST_NOEXCEPT
750
+ {
751
+ return code.category().equivalent( code.value(), condition ) || condition.category().equivalent( code, condition.value() );
752
+ }
753
+
754
+ inline bool operator!=( const error_condition & lhs, const error_code & rhs ) BOOST_NOEXCEPT
755
+ {
756
+ return !( lhs == rhs );
757
+ }
758
+
759
+ template <class charT, class traits>
760
+ inline std::basic_ostream<charT,traits>&
761
+ operator<< (std::basic_ostream<charT,traits>& os, error_code ec)
762
+ {
763
+ os << ec.category().name() << ':' << ec.value();
764
+ return os;
765
+ }
687
766
 
688
- inline std::error_condition error_category::std_category::default_error_condition(
689
- int ev ) const BOOST_NOEXCEPT
767
+ inline std::size_t hash_value( error_code const & ec )
768
+ {
769
+ error_category const & cat = ec.category();
770
+
771
+ boost::ulong_long_type id = cat.id_;
772
+
773
+ if( id == 0 )
690
774
  {
691
- return pc_->default_error_condition( ev );
775
+ id = reinterpret_cast<boost::ulong_long_type>( &cat );
692
776
  }
693
777
 
694
- inline bool error_category::std_category::equivalent( int code,
695
- const std::error_condition & condition ) const BOOST_NOEXCEPT
778
+ boost::ulong_long_type hv = ( boost::ulong_long_type( 0xCBF29CE4 ) << 32 ) + 0x84222325;
779
+ boost::ulong_long_type const prime = ( boost::ulong_long_type( 0x00000100 ) << 32 ) + 0x000001B3;
780
+
781
+ // id
782
+
783
+ hv ^= id;
784
+ hv *= prime;
785
+
786
+ // value
787
+
788
+ hv ^= static_cast<unsigned>( ec.value() );
789
+ hv *= prime;
790
+
791
+ return static_cast<std::size_t>( hv );
792
+ }
793
+
794
+ // make_* functions for errc::errc_t
795
+
796
+ namespace errc
797
+ {
798
+
799
+ // explicit conversion:
800
+ BOOST_SYSTEM_CONSTEXPR inline error_code make_error_code( errc_t e ) BOOST_NOEXCEPT
801
+ {
802
+ return error_code( e, generic_category() );
803
+ }
804
+
805
+ // implicit conversion:
806
+ BOOST_SYSTEM_CONSTEXPR inline error_condition make_error_condition( errc_t e ) BOOST_NOEXCEPT
807
+ {
808
+ return error_condition( e, generic_category() );
809
+ }
810
+
811
+ } // namespace errc
812
+
813
+ // error_category default implementation
814
+
815
+ inline error_condition error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT
816
+ {
817
+ return error_condition( ev, *this );
818
+ }
819
+
820
+ inline bool error_category::equivalent( int code, const error_condition & condition ) const BOOST_NOEXCEPT
821
+ {
822
+ return default_error_condition( code ) == condition;
823
+ }
824
+
825
+ inline bool error_category::equivalent( const error_code & code, int condition ) const BOOST_NOEXCEPT
826
+ {
827
+ return *this == code.category() && code.value() == condition;
828
+ }
829
+
830
+ inline char const * error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
831
+ {
832
+ if( len == 0 )
696
833
  {
697
- if( condition.category() == *this )
698
- {
699
- boost::system::error_condition bn( condition.value(), *pc_ );
700
- return pc_->equivalent( code, bn );
701
- }
702
- else if( condition.category() == std::generic_category()
703
- || condition.category() == boost::system::generic_category() )
704
- {
705
- boost::system::error_condition bn( condition.value(),
706
- boost::system::generic_category() );
834
+ return buffer;
835
+ }
707
836
 
708
- return pc_->equivalent( code, bn );
709
- }
710
- #ifndef BOOST_NO_RTTI
711
- else if( std_category const* pc2 = dynamic_cast< std_category const* >(
712
- &condition.category() ) )
713
- {
714
- boost::system::error_condition bn( condition.value(), *pc2->pc_ );
715
- return pc_->equivalent( code, bn );
716
- }
717
- #endif
718
- else
719
- {
720
- return default_error_condition( code ) == condition;
721
- }
722
- }
723
-
724
- inline bool error_category::std_category::equivalent( const std::error_code & code,
725
- int condition ) const BOOST_NOEXCEPT
726
- {
727
- if( code.category() == *this )
728
- {
729
- boost::system::error_code bc( code.value(), *pc_ );
730
- return pc_->equivalent( bc, condition );
731
- }
732
- else if( code.category() == std::generic_category()
733
- || code.category() == boost::system::generic_category() )
734
- {
735
- boost::system::error_code bc( code.value(),
736
- boost::system::generic_category() );
737
-
738
- return pc_->equivalent( bc, condition );
739
- }
740
- #ifndef BOOST_NO_RTTI
741
- else if( std_category const* pc2 = dynamic_cast< std_category const* >(
742
- &code.category() ) )
743
- {
744
- boost::system::error_code bc( code.value(), *pc2->pc_ );
745
- return pc_->equivalent( bc, condition );
746
- }
747
- #endif
748
- else if( *pc_ == boost::system::generic_category() )
749
- {
750
- return std::generic_category().equivalent( code, condition );
751
- }
752
- else
753
- {
754
- return false;
755
- }
837
+ if( len == 1 )
838
+ {
839
+ buffer[0] = 0;
840
+ return buffer;
756
841
  }
757
842
 
843
+ #if !defined(BOOST_NO_EXCEPTIONS)
844
+ try
758
845
  #endif
846
+ {
847
+ std::string m = this->message( ev );
848
+
849
+ # if defined( BOOST_MSVC )
850
+ # pragma warning( push )
851
+ # pragma warning( disable: 4996 )
852
+ # elif defined(__clang__) && defined(__has_warning)
853
+ # pragma clang diagnostic push
854
+ # if __has_warning("-Wdeprecated-declarations")
855
+ # pragma clang diagnostic ignored "-Wdeprecated-declarations"
856
+ # endif
857
+ # endif
858
+
859
+ std::strncpy( buffer, m.c_str(), len - 1 );
860
+ buffer[ len-1 ] = 0;
861
+
862
+ # if defined( BOOST_MSVC )
863
+ # pragma warning( pop )
864
+ # elif defined(__clang__) && defined(__has_warning)
865
+ # pragma clang diagnostic pop
866
+ # endif
867
+
868
+ return buffer;
869
+ }
870
+ #if !defined(BOOST_NO_EXCEPTIONS)
871
+ catch( ... )
872
+ {
873
+ return "Message text unavailable";
874
+ }
875
+ #endif
876
+ }
877
+
878
+ inline bool error_category::failed( int ev ) const BOOST_NOEXCEPT
879
+ {
880
+ return ev != 0;
881
+ }
882
+
883
+ } // namespace system
759
884
 
760
- } // namespace system
761
885
  } // namespace boost
762
886
 
763
- #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
887
+ // generic_error_category implementation
764
888
 
765
- # ifdef BOOST_ERROR_CODE_HEADER_ONLY
766
- # include <boost/system/detail/error_code.ipp>
767
- # endif
889
+ #include <boost/system/detail/generic_category.hpp>
890
+
891
+ inline std::string boost::system::detail::generic_error_category::message( int ev ) const
892
+ {
893
+ return generic_error_category_message( ev );
894
+ }
895
+
896
+ inline char const * boost::system::detail::generic_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
897
+ {
898
+ return generic_error_category_message( ev, buffer, len );
899
+ }
900
+
901
+ // system_error_category implementation
902
+
903
+ #if defined(BOOST_WINDOWS_API)
904
+
905
+ #include <boost/system/detail/system_category_win32.hpp>
906
+
907
+ inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT
908
+ {
909
+ return system_category_default_error_condition_win32( ev );
910
+ }
911
+
912
+ inline std::string boost::system::detail::system_error_category::message( int ev ) const
913
+ {
914
+ return system_category_message_win32( ev );
915
+ }
916
+
917
+ inline char const * boost::system::detail::system_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
918
+ {
919
+ return system_category_message_win32( ev, buffer, len );
920
+ }
921
+
922
+ #else // #if defined(BOOST_WINDOWS_API)
923
+
924
+ #include <boost/system/detail/system_category_posix.hpp>
925
+
926
+ inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT
927
+ {
928
+ return system_category_default_error_condition_posix( ev );
929
+ }
930
+
931
+ inline std::string boost::system::detail::system_error_category::message( int ev ) const
932
+ {
933
+ return generic_error_category_message( ev );
934
+ }
935
+
936
+ inline char const * boost::system::detail::system_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
937
+ {
938
+ return generic_error_category_message( ev, buffer, len );
939
+ }
940
+
941
+ #endif // #if defined(BOOST_WINDOWS_API)
942
+
943
+ // interoperability with std::error_code, std::error_condition
944
+
945
+ #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
946
+
947
+ #include <boost/system/detail/std_interoperability.hpp>
948
+
949
+ inline boost::system::error_category::operator std::error_category const & () const
950
+ {
951
+ return boost::system::detail::to_std_category( *this );
952
+ }
953
+
954
+ #endif // #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
768
955
 
769
- #endif // BOOST_SYSTEM_ERROR_CODE_HPP
956
+ #endif // BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED