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