linux_error.hpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. // boost/system/linux_error.hpp -------------------------------------------//
  2. // Copyright Beman Dawes 2007
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See library home page at http://www.boost.org/libs/system
  6. #ifndef BOOST_SYSTEM_LINUX_ERROR_HPP
  7. #define BOOST_SYSTEM_LINUX_ERROR_HPP
  8. #include <boost/config/pragma_message.hpp>
  9. #if !defined(BOOST_ALLOW_DEPRECATED_HEADERS)
  10. BOOST_PRAGMA_MESSAGE("This header is deprecated and is slated for removal."
  11. " If you want it retained, please open an issue in github.com/boostorg/system.")
  12. #endif
  13. // This header is effectively empty for compiles on operating systems where
  14. // it is not applicable.
  15. #if defined(linux) || defined(__linux) || defined(__linux__)
  16. #include <boost/system/error_code.hpp>
  17. namespace boost
  18. {
  19. namespace system
  20. {
  21. // To construct an error_code after a API error:
  22. //
  23. // error_code( errno, system_category() )
  24. // User code should use the portable "posix" enums for POSIX errors; this
  25. // allows such code to be portable to non-POSIX systems. For the non-POSIX
  26. // errno values that POSIX-based systems typically provide in addition to
  27. // POSIX values, use the system specific enums below.
  28. namespace linux_error
  29. {
  30. enum linux_errno
  31. {
  32. advertise_error = EADV,
  33. bad_exchange = EBADE,
  34. bad_file_number = EBADFD,
  35. bad_font_format = EBFONT,
  36. bad_request_code = EBADRQC,
  37. bad_request_descriptor = EBADR,
  38. bad_slot = EBADSLT,
  39. channel_range = ECHRNG,
  40. communication_error = ECOMM,
  41. dot_dot_error = EDOTDOT,
  42. exchange_full = EXFULL,
  43. host_down = EHOSTDOWN,
  44. is_named_file_type= EISNAM,
  45. key_expired = EKEYEXPIRED,
  46. key_rejected = EKEYREJECTED,
  47. key_revoked = EKEYREVOKED,
  48. level2_halt= EL2HLT,
  49. level2_no_syncronized= EL2NSYNC,
  50. level3_halt = EL3HLT,
  51. level3_reset = EL3RST,
  52. link_range = ELNRNG,
  53. medium_type = EMEDIUMTYPE,
  54. no_anode= ENOANO,
  55. no_block_device = ENOTBLK,
  56. no_csi = ENOCSI,
  57. no_key = ENOKEY,
  58. no_medium = ENOMEDIUM,
  59. no_network = ENONET,
  60. no_package = ENOPKG,
  61. not_avail = ENAVAIL,
  62. not_named_file_type= ENOTNAM,
  63. not_recoverable = ENOTRECOVERABLE,
  64. not_unique = ENOTUNIQ,
  65. owner_dead = EOWNERDEAD,
  66. protocol_no_supported = EPFNOSUPPORT,
  67. remote_address_changed = EREMCHG,
  68. remote_io_error = EREMOTEIO,
  69. remote_object = EREMOTE,
  70. restart_needed = ERESTART,
  71. shared_library_access = ELIBACC,
  72. shared_library_bad = ELIBBAD,
  73. shared_library_execute = ELIBEXEC,
  74. shared_library_max_ = ELIBMAX,
  75. shared_library_section= ELIBSCN,
  76. shutdown = ESHUTDOWN,
  77. socket_type_not_supported = ESOCKTNOSUPPORT,
  78. srmount_error = ESRMNT,
  79. stream_pipe_error = ESTRPIPE,
  80. too_many_references = ETOOMANYREFS,
  81. too_many_users = EUSERS,
  82. unattached = EUNATCH,
  83. unclean = EUCLEAN
  84. };
  85. } // namespace linux_error
  86. # ifdef BOOST_SYSTEM_ENABLE_DEPRECATED
  87. namespace Linux = linux_error;
  88. # endif
  89. template<> struct is_error_code_enum<linux_error::linux_errno>
  90. { static const bool value = true; };
  91. namespace linux_error
  92. {
  93. inline error_code make_error_code( linux_errno e )
  94. { return error_code( e, system_category() ); }
  95. }
  96. } // namespace system
  97. } // namespace boost
  98. #endif // Linux
  99. #endif // BOOST_SYSTEM_LINUX_ERROR_HPP