• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // -*- C++ -*-
2 //===---------------------------- __errc ----------------------------------===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 
11 #ifndef _LIBCPP___ERRC
12 #define _LIBCPP___ERRC
13 
14 /*
15     system_error synopsis
16 
17 namespace std
18 {
19 
20 enum class errc
21 {
22     address_family_not_supported,       // EAFNOSUPPORT
23     address_in_use,                     // EADDRINUSE
24     address_not_available,              // EADDRNOTAVAIL
25     already_connected,                  // EISCONN
26     argument_list_too_long,             // E2BIG
27     argument_out_of_domain,             // EDOM
28     bad_address,                        // EFAULT
29     bad_file_descriptor,                // EBADF
30     bad_message,                        // EBADMSG
31     broken_pipe,                        // EPIPE
32     connection_aborted,                 // ECONNABORTED
33     connection_already_in_progress,     // EALREADY
34     connection_refused,                 // ECONNREFUSED
35     connection_reset,                   // ECONNRESET
36     cross_device_link,                  // EXDEV
37     destination_address_required,       // EDESTADDRREQ
38     device_or_resource_busy,            // EBUSY
39     directory_not_empty,                // ENOTEMPTY
40     executable_format_error,            // ENOEXEC
41     file_exists,                        // EEXIST
42     file_too_large,                     // EFBIG
43     filename_too_long,                  // ENAMETOOLONG
44     function_not_supported,             // ENOSYS
45     host_unreachable,                   // EHOSTUNREACH
46     identifier_removed,                 // EIDRM
47     illegal_byte_sequence,              // EILSEQ
48     inappropriate_io_control_operation, // ENOTTY
49     interrupted,                        // EINTR
50     invalid_argument,                   // EINVAL
51     invalid_seek,                       // ESPIPE
52     io_error,                           // EIO
53     is_a_directory,                     // EISDIR
54     message_size,                       // EMSGSIZE
55     network_down,                       // ENETDOWN
56     network_reset,                      // ENETRESET
57     network_unreachable,                // ENETUNREACH
58     no_buffer_space,                    // ENOBUFS
59     no_child_process,                   // ECHILD
60     no_link,                            // ENOLINK
61     no_lock_available,                  // ENOLCK
62     no_message_available,               // ENODATA
63     no_message,                         // ENOMSG
64     no_protocol_option,                 // ENOPROTOOPT
65     no_space_on_device,                 // ENOSPC
66     no_stream_resources,                // ENOSR
67     no_such_device_or_address,          // ENXIO
68     no_such_device,                     // ENODEV
69     no_such_file_or_directory,          // ENOENT
70     no_such_process,                    // ESRCH
71     not_a_directory,                    // ENOTDIR
72     not_a_socket,                       // ENOTSOCK
73     not_a_stream,                       // ENOSTR
74     not_connected,                      // ENOTCONN
75     not_enough_memory,                  // ENOMEM
76     not_supported,                      // ENOTSUP
77     operation_canceled,                 // ECANCELED
78     operation_in_progress,              // EINPROGRESS
79     operation_not_permitted,            // EPERM
80     operation_not_supported,            // EOPNOTSUPP
81     operation_would_block,              // EWOULDBLOCK
82     owner_dead,                         // EOWNERDEAD
83     permission_denied,                  // EACCES
84     protocol_error,                     // EPROTO
85     protocol_not_supported,             // EPROTONOSUPPORT
86     read_only_file_system,              // EROFS
87     resource_deadlock_would_occur,      // EDEADLK
88     resource_unavailable_try_again,     // EAGAIN
89     result_out_of_range,                // ERANGE
90     state_not_recoverable,              // ENOTRECOVERABLE
91     stream_timeout,                     // ETIME
92     text_file_busy,                     // ETXTBSY
93     timed_out,                          // ETIMEDOUT
94     too_many_files_open_in_system,      // ENFILE
95     too_many_files_open,                // EMFILE
96     too_many_links,                     // EMLINK
97     too_many_symbolic_link_levels,      // ELOOP
98     value_too_large,                    // EOVERFLOW
99     wrong_protocol_type                 // EPROTOTYPE
100 };
101 
102 */
103 
104 #include <__config>
105 #include <cerrno>
106 
107 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
108 #pragma GCC system_header
109 #endif
110 
111 _LIBCPP_BEGIN_NAMESPACE_STD
112 
113 // Some error codes are not present on all platforms, so we provide equivalents
114 // for them:
115 
116 //enum class errc
117 _LIBCPP_DECLARE_STRONG_ENUM(errc)
118 {
119     address_family_not_supported        = EAFNOSUPPORT,
120     address_in_use                      = EADDRINUSE,
121     address_not_available               = EADDRNOTAVAIL,
122     already_connected                   = EISCONN,
123     argument_list_too_long              = E2BIG,
124     argument_out_of_domain              = EDOM,
125     bad_address                         = EFAULT,
126     bad_file_descriptor                 = EBADF,
127     bad_message                         = EBADMSG,
128     broken_pipe                         = EPIPE,
129     connection_aborted                  = ECONNABORTED,
130     connection_already_in_progress      = EALREADY,
131     connection_refused                  = ECONNREFUSED,
132     connection_reset                    = ECONNRESET,
133     cross_device_link                   = EXDEV,
134     destination_address_required        = EDESTADDRREQ,
135     device_or_resource_busy             = EBUSY,
136     directory_not_empty                 = ENOTEMPTY,
137     executable_format_error             = ENOEXEC,
138     file_exists                         = EEXIST,
139     file_too_large                      = EFBIG,
140     filename_too_long                   = ENAMETOOLONG,
141     function_not_supported              = ENOSYS,
142     host_unreachable                    = EHOSTUNREACH,
143     identifier_removed                  = EIDRM,
144     illegal_byte_sequence               = EILSEQ,
145     inappropriate_io_control_operation  = ENOTTY,
146     interrupted                         = EINTR,
147     invalid_argument                    = EINVAL,
148     invalid_seek                        = ESPIPE,
149     io_error                            = EIO,
150     is_a_directory                      = EISDIR,
151     message_size                        = EMSGSIZE,
152     network_down                        = ENETDOWN,
153     network_reset                       = ENETRESET,
154     network_unreachable                 = ENETUNREACH,
155     no_buffer_space                     = ENOBUFS,
156     no_child_process                    = ECHILD,
157     no_link                             = ENOLINK,
158     no_lock_available                   = ENOLCK,
159 #ifdef ENODATA
160     no_message_available                = ENODATA,
161 #else
162     no_message_available                = ENOMSG,
163 #endif
164     no_message                          = ENOMSG,
165     no_protocol_option                  = ENOPROTOOPT,
166     no_space_on_device                  = ENOSPC,
167 #ifdef ENOSR
168     no_stream_resources                 = ENOSR,
169 #else
170     no_stream_resources                 = ENOMEM,
171 #endif
172     no_such_device_or_address           = ENXIO,
173     no_such_device                      = ENODEV,
174     no_such_file_or_directory           = ENOENT,
175     no_such_process                     = ESRCH,
176     not_a_directory                     = ENOTDIR,
177     not_a_socket                        = ENOTSOCK,
178 #ifdef ENOSTR
179     not_a_stream                        = ENOSTR,
180 #else
181     not_a_stream                        = EINVAL,
182 #endif
183     not_connected                       = ENOTCONN,
184     not_enough_memory                   = ENOMEM,
185     not_supported                       = ENOTSUP,
186     operation_canceled                  = ECANCELED,
187     operation_in_progress               = EINPROGRESS,
188     operation_not_permitted             = EPERM,
189     operation_not_supported             = EOPNOTSUPP,
190     operation_would_block               = EWOULDBLOCK,
191     owner_dead                          = EOWNERDEAD,
192     permission_denied                   = EACCES,
193     protocol_error                      = EPROTO,
194     protocol_not_supported              = EPROTONOSUPPORT,
195     read_only_file_system               = EROFS,
196     resource_deadlock_would_occur       = EDEADLK,
197     resource_unavailable_try_again      = EAGAIN,
198     result_out_of_range                 = ERANGE,
199     state_not_recoverable               = ENOTRECOVERABLE,
200 #ifdef ETIME
201     stream_timeout                      = ETIME,
202 #else
203     stream_timeout                      = ETIMEDOUT,
204 #endif
205     text_file_busy                      = ETXTBSY,
206     timed_out                           = ETIMEDOUT,
207     too_many_files_open_in_system       = ENFILE,
208     too_many_files_open                 = EMFILE,
209     too_many_links                      = EMLINK,
210     too_many_symbolic_link_levels       = ELOOP,
211     value_too_large                     = EOVERFLOW,
212     wrong_protocol_type                 = EPROTOTYPE
213 };
214 _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
215 
216 _LIBCPP_END_NAMESPACE_STD
217 
218 #endif  // _LIBCPP___ERRC
219