Chris@16: // boost/system/linux_error.hpp -------------------------------------------// Chris@16: Chris@16: // Copyright Beman Dawes 2007 Chris@16: Chris@16: // Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // See library home page at http://www.boost.org/libs/system Chris@16: Chris@16: #ifndef BOOST_LINUX_ERROR_HPP Chris@16: #define BOOST_LINUX_ERROR_HPP Chris@16: Chris@16: // This header is effectively empty for compiles on operating systems where Chris@16: // it is not applicable. Chris@16: Chris@16: #if defined(linux) || defined(__linux) || defined(__linux__) Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost Chris@16: { Chris@16: namespace system Chris@16: { Chris@16: // To construct an error_code after a API error: Chris@16: // Chris@16: // error_code( errno, system_category() ) Chris@16: Chris@16: // User code should use the portable "posix" enums for POSIX errors; this Chris@16: // allows such code to be portable to non-POSIX systems. For the non-POSIX Chris@16: // errno values that POSIX-based systems typically provide in addition to Chris@16: // POSIX values, use the system specific enums below. Chris@16: Chris@16: namespace linux_error Chris@16: { Chris@16: enum linux_errno Chris@16: { Chris@16: advertise_error = EADV, Chris@16: bad_exchange = EBADE, Chris@16: bad_file_number = EBADFD, Chris@16: bad_font_format = EBFONT, Chris@16: bad_request_code = EBADRQC, Chris@16: bad_request_descriptor = EBADR, Chris@16: bad_slot = EBADSLT, Chris@16: channel_range = ECHRNG, Chris@16: communication_error = ECOMM, Chris@16: dot_dot_error = EDOTDOT, Chris@16: exchange_full = EXFULL, Chris@16: host_down = EHOSTDOWN, Chris@16: is_named_file_type= EISNAM, Chris@16: key_expired = EKEYEXPIRED, Chris@16: key_rejected = EKEYREJECTED, Chris@16: key_revoked = EKEYREVOKED, Chris@16: level2_halt= EL2HLT, Chris@16: level2_no_syncronized= EL2NSYNC, Chris@16: level3_halt = EL3HLT, Chris@16: level3_reset = EL3RST, Chris@16: link_range = ELNRNG, Chris@16: medium_type = EMEDIUMTYPE, Chris@16: no_anode= ENOANO, Chris@16: no_block_device = ENOTBLK, Chris@16: no_csi = ENOCSI, Chris@16: no_key = ENOKEY, Chris@16: no_medium = ENOMEDIUM, Chris@16: no_network = ENONET, Chris@16: no_package = ENOPKG, Chris@16: not_avail = ENAVAIL, Chris@16: not_named_file_type= ENOTNAM, Chris@16: not_recoverable = ENOTRECOVERABLE, Chris@16: not_unique = ENOTUNIQ, Chris@16: owner_dead = EOWNERDEAD, Chris@16: protocol_no_supported = EPFNOSUPPORT, Chris@16: remote_address_changed = EREMCHG, Chris@16: remote_io_error = EREMOTEIO, Chris@16: remote_object = EREMOTE, Chris@16: restart_needed = ERESTART, Chris@16: shared_library_access = ELIBACC, Chris@16: shared_library_bad = ELIBBAD, Chris@16: shared_library_execute = ELIBEXEC, Chris@16: shared_library_max_ = ELIBMAX, Chris@16: shared_library_section= ELIBSCN, Chris@16: shutdown = ESHUTDOWN, Chris@16: socket_type_not_supported = ESOCKTNOSUPPORT, Chris@16: srmount_error = ESRMNT, Chris@16: stream_pipe_error = ESTRPIPE, Chris@16: too_many_references = ETOOMANYREFS, Chris@16: too_many_users = EUSERS, Chris@16: unattached = EUNATCH, Chris@16: unclean = EUCLEAN Chris@16: }; Chris@16: } // namespace linux_error Chris@16: Chris@16: # ifndef BOOST_SYSTEM_NO_DEPRECATED Chris@16: namespace Linux = linux_error; Chris@16: # endif Chris@16: Chris@16: template<> struct is_error_code_enum Chris@16: { static const bool value = true; }; Chris@16: Chris@16: namespace linux_error Chris@16: { Chris@16: inline error_code make_error_code( linux_errno e ) Chris@16: { return error_code( e, system_category() ); } Chris@16: } Chris@16: Chris@16: } // namespace system Chris@16: } // namespace boost Chris@16: Chris@16: #endif // Linux Chris@16: Chris@16: #endif // BOOST_LINUX_ERROR_HPP