linux_error.hpp 3.3 KB

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