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