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