xref: /freebsd/contrib/llvm-project/libcxx/include/__system_error/errc.h (revision 6580f5c38dd5b01aeeaed16b370f1a12423437f0)
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef _LIBCPP___ERRC
11 #define _LIBCPP___ERRC
12 
13 /*
14     system_error synopsis
15 
16 namespace std
17 {
18 
19 enum class errc
20 {
21     address_family_not_supported,       // EAFNOSUPPORT
22     address_in_use,                     // EADDRINUSE
23     address_not_available,              // EADDRNOTAVAIL
24     already_connected,                  // EISCONN
25     argument_list_too_long,             // E2BIG
26     argument_out_of_domain,             // EDOM
27     bad_address,                        // EFAULT
28     bad_file_descriptor,                // EBADF
29     bad_message,                        // EBADMSG
30     broken_pipe,                        // EPIPE
31     connection_aborted,                 // ECONNABORTED
32     connection_already_in_progress,     // EALREADY
33     connection_refused,                 // ECONNREFUSED
34     connection_reset,                   // ECONNRESET
35     cross_device_link,                  // EXDEV
36     destination_address_required,       // EDESTADDRREQ
37     device_or_resource_busy,            // EBUSY
38     directory_not_empty,                // ENOTEMPTY
39     executable_format_error,            // ENOEXEC
40     file_exists,                        // EEXIST
41     file_too_large,                     // EFBIG
42     filename_too_long,                  // ENAMETOOLONG
43     function_not_supported,             // ENOSYS
44     host_unreachable,                   // EHOSTUNREACH
45     identifier_removed,                 // EIDRM
46     illegal_byte_sequence,              // EILSEQ
47     inappropriate_io_control_operation, // ENOTTY
48     integrity_check_failed,             // EINTEGRITY // FreeBSD customization
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     address_family_not_supported       = EAFNOSUPPORT,
119     address_in_use                     = EADDRINUSE,
120     address_not_available              = EADDRNOTAVAIL,
121     already_connected                  = EISCONN,
122     argument_list_too_long             = E2BIG,
123     argument_out_of_domain             = EDOM,
124     bad_address                        = EFAULT,
125     bad_file_descriptor                = EBADF,
126     bad_message                        = EBADMSG,
127     broken_pipe                        = EPIPE,
128     connection_aborted                 = ECONNABORTED,
129     connection_already_in_progress     = EALREADY,
130     connection_refused                 = ECONNREFUSED,
131     connection_reset                   = ECONNRESET,
132     cross_device_link                  = EXDEV,
133     destination_address_required       = EDESTADDRREQ,
134     device_or_resource_busy            = EBUSY,
135     directory_not_empty                = ENOTEMPTY,
136     executable_format_error            = ENOEXEC,
137     file_exists                        = EEXIST,
138     file_too_large                     = EFBIG,
139     filename_too_long                  = ENAMETOOLONG,
140     function_not_supported             = ENOSYS,
141     host_unreachable                   = EHOSTUNREACH,
142     identifier_removed                 = EIDRM,
143     illegal_byte_sequence              = EILSEQ,
144     inappropriate_io_control_operation = ENOTTY,
145 #ifdef EINTEGRITY
146     integrity_check_failed             = EINTEGRITY, // FreeBSD customization
147 #endif
148     interrupted                        = EINTR,
149     invalid_argument                   = EINVAL,
150     invalid_seek                       = ESPIPE,
151     io_error                           = EIO,
152     is_a_directory                     = EISDIR,
153     message_size                       = EMSGSIZE,
154     network_down                       = ENETDOWN,
155     network_reset                      = ENETRESET,
156     network_unreachable                = ENETUNREACH,
157     no_buffer_space                    = ENOBUFS,
158     no_child_process                   = ECHILD,
159     no_link                            = ENOLINK,
160     no_lock_available                  = ENOLCK,
161 #ifdef ENODATA
162     no_message_available = ENODATA,
163 #else
164     no_message_available = ENOMSG,
165 #endif
166     no_message         = ENOMSG,
167     no_protocol_option = ENOPROTOOPT,
168     no_space_on_device = ENOSPC,
169 #ifdef ENOSR
170     no_stream_resources = ENOSR,
171 #else
172     no_stream_resources = ENOMEM,
173 #endif
174     no_such_device_or_address = ENXIO,
175     no_such_device            = ENODEV,
176     no_such_file_or_directory = ENOENT,
177     no_such_process           = ESRCH,
178     not_a_directory           = ENOTDIR,
179     not_a_socket              = ENOTSOCK,
180 #ifdef ENOSTR
181     not_a_stream = ENOSTR,
182 #else
183     not_a_stream = EINVAL,
184 #endif
185     not_connected                  = ENOTCONN,
186     not_enough_memory              = ENOMEM,
187     not_supported                  = ENOTSUP,
188     operation_canceled             = ECANCELED,
189     operation_in_progress          = EINPROGRESS,
190     operation_not_permitted        = EPERM,
191     operation_not_supported        = EOPNOTSUPP,
192     operation_would_block          = EWOULDBLOCK,
193     owner_dead                     = EOWNERDEAD,
194     permission_denied              = EACCES,
195     protocol_error                 = EPROTO,
196     protocol_not_supported         = EPROTONOSUPPORT,
197     read_only_file_system          = EROFS,
198     resource_deadlock_would_occur  = EDEADLK,
199     resource_unavailable_try_again = EAGAIN,
200     result_out_of_range            = ERANGE,
201     state_not_recoverable          = ENOTRECOVERABLE,
202 #ifdef ETIME
203     stream_timeout = ETIME,
204 #else
205     stream_timeout = ETIMEDOUT,
206 #endif
207     text_file_busy                = ETXTBSY,
208     timed_out                     = ETIMEDOUT,
209     too_many_files_open_in_system = ENFILE,
210     too_many_files_open           = EMFILE,
211     too_many_links                = EMLINK,
212     too_many_symbolic_link_levels = ELOOP,
213     value_too_large               = EOVERFLOW,
214     wrong_protocol_type           = EPROTOTYPE};
215 _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
216 
217 _LIBCPP_END_NAMESPACE_STD
218 
219 #endif // _LIBCPP___ERRC
220