Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:14:04

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___ERRC
0011 #define _LIBCPP___ERRC
0012 
0013 /*
0014     system_error synopsis
0015 
0016 namespace std
0017 {
0018 
0019 enum class errc
0020 {
0021     address_family_not_supported,       // EAFNOSUPPORT
0022     address_in_use,                     // EADDRINUSE
0023     address_not_available,              // EADDRNOTAVAIL
0024     already_connected,                  // EISCONN
0025     argument_list_too_long,             // E2BIG
0026     argument_out_of_domain,             // EDOM
0027     bad_address,                        // EFAULT
0028     bad_file_descriptor,                // EBADF
0029     bad_message,                        // EBADMSG
0030     broken_pipe,                        // EPIPE
0031     connection_aborted,                 // ECONNABORTED
0032     connection_already_in_progress,     // EALREADY
0033     connection_refused,                 // ECONNREFUSED
0034     connection_reset,                   // ECONNRESET
0035     cross_device_link,                  // EXDEV
0036     destination_address_required,       // EDESTADDRREQ
0037     device_or_resource_busy,            // EBUSY
0038     directory_not_empty,                // ENOTEMPTY
0039     executable_format_error,            // ENOEXEC
0040     file_exists,                        // EEXIST
0041     file_too_large,                     // EFBIG
0042     filename_too_long,                  // ENAMETOOLONG
0043     function_not_supported,             // ENOSYS
0044     host_unreachable,                   // EHOSTUNREACH
0045     identifier_removed,                 // EIDRM
0046     illegal_byte_sequence,              // EILSEQ
0047     inappropriate_io_control_operation, // ENOTTY
0048     interrupted,                        // EINTR
0049     invalid_argument,                   // EINVAL
0050     invalid_seek,                       // ESPIPE
0051     io_error,                           // EIO
0052     is_a_directory,                     // EISDIR
0053     message_size,                       // EMSGSIZE
0054     network_down,                       // ENETDOWN
0055     network_reset,                      // ENETRESET
0056     network_unreachable,                // ENETUNREACH
0057     no_buffer_space,                    // ENOBUFS
0058     no_child_process,                   // ECHILD
0059     no_link,                            // ENOLINK
0060     no_lock_available,                  // ENOLCK
0061     no_message_available,               // ENODATA         // deprecated
0062     no_message,                         // ENOMSG
0063     no_protocol_option,                 // ENOPROTOOPT
0064     no_space_on_device,                 // ENOSPC
0065     no_stream_resources,                // ENOSR           // deprecated
0066     no_such_device_or_address,          // ENXIO
0067     no_such_device,                     // ENODEV
0068     no_such_file_or_directory,          // ENOENT
0069     no_such_process,                    // ESRCH
0070     not_a_directory,                    // ENOTDIR
0071     not_a_socket,                       // ENOTSOCK
0072     not_a_stream,                       // ENOSTR          // deprecated
0073     not_connected,                      // ENOTCONN
0074     not_enough_memory,                  // ENOMEM
0075     not_supported,                      // ENOTSUP
0076     operation_canceled,                 // ECANCELED
0077     operation_in_progress,              // EINPROGRESS
0078     operation_not_permitted,            // EPERM
0079     operation_not_supported,            // EOPNOTSUPP
0080     operation_would_block,              // EWOULDBLOCK
0081     owner_dead,                         // EOWNERDEAD
0082     permission_denied,                  // EACCES
0083     protocol_error,                     // EPROTO
0084     protocol_not_supported,             // EPROTONOSUPPORT
0085     read_only_file_system,              // EROFS
0086     resource_deadlock_would_occur,      // EDEADLK
0087     resource_unavailable_try_again,     // EAGAIN
0088     result_out_of_range,                // ERANGE
0089     state_not_recoverable,              // ENOTRECOVERABLE
0090     stream_timeout,                     // ETIME           // deprecated
0091     text_file_busy,                     // ETXTBSY
0092     timed_out,                          // ETIMEDOUT
0093     too_many_files_open_in_system,      // ENFILE
0094     too_many_files_open,                // EMFILE
0095     too_many_links,                     // EMLINK
0096     too_many_symbolic_link_levels,      // ELOOP
0097     value_too_large,                    // EOVERFLOW
0098     wrong_protocol_type                 // EPROTOTYPE
0099 };
0100 
0101 */
0102 
0103 #include <__config>
0104 #include <cerrno>
0105 
0106 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0107 #  pragma GCC system_header
0108 #endif
0109 
0110 // The method of pushing and popping the diagnostics fails for GCC.  GCC does
0111 // not recognize the pragma's used to generate deprecated diagnostics for
0112 // macros. So GCC does not need the pushing and popping.
0113 //
0114 // TODO Remove this when the deprecated constants are removed.
0115 //
0116 // Note based on the post-review comments in
0117 // https://github.com/llvm/llvm-project/pull/80542 libc++ no longer deprecates
0118 // the macros. Since C libraries may start to deprecate these POSIX macros the
0119 // deprecation warning avoidance is kept.
0120 #if defined(_LIBCPP_COMPILER_CLANG_BASED)
0121 #  define _LIBCPP_SUPPRESS_DEPRECATED_ERRC_PUSH _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0122 #  define _LIBCPP_SUPPRESS_DEPRECATED_ERRC_POP _LIBCPP_SUPPRESS_DEPRECATED_POP
0123 #else
0124 #  define _LIBCPP_SUPPRESS_DEPRECATED_ERRC_PUSH
0125 #  define _LIBCPP_SUPPRESS_DEPRECATED_ERRC_POP
0126 #endif
0127 
0128 _LIBCPP_BEGIN_NAMESPACE_STD
0129 
0130 // Some error codes are not present on all platforms, so we provide equivalents
0131 // for them:
0132 
0133 // enum class errc
0134 //
0135 // LWG3869 deprecates the UNIX STREAMS macros and enum values.
0136 // This makes the code cumbersome:
0137 // - the enum value is deprecated and should show a diagnostic,
0138 // - the macro is deprecated and should _not_ show a diagnostic in this
0139 //   context, and
0140 // - the macro is not always available.
0141 // This leads to the odd pushing and popping of the deprecated
0142 // diagnostic.
0143 _LIBCPP_DECLARE_STRONG_ENUM(errc){
0144     address_family_not_supported       = EAFNOSUPPORT,
0145     address_in_use                     = EADDRINUSE,
0146     address_not_available              = EADDRNOTAVAIL,
0147     already_connected                  = EISCONN,
0148     argument_list_too_long             = E2BIG,
0149     argument_out_of_domain             = EDOM,
0150     bad_address                        = EFAULT,
0151     bad_file_descriptor                = EBADF,
0152     bad_message                        = EBADMSG,
0153     broken_pipe                        = EPIPE,
0154     connection_aborted                 = ECONNABORTED,
0155     connection_already_in_progress     = EALREADY,
0156     connection_refused                 = ECONNREFUSED,
0157     connection_reset                   = ECONNRESET,
0158     cross_device_link                  = EXDEV,
0159     destination_address_required       = EDESTADDRREQ,
0160     device_or_resource_busy            = EBUSY,
0161     directory_not_empty                = ENOTEMPTY,
0162     executable_format_error            = ENOEXEC,
0163     file_exists                        = EEXIST,
0164     file_too_large                     = EFBIG,
0165     filename_too_long                  = ENAMETOOLONG,
0166     function_not_supported             = ENOSYS,
0167     host_unreachable                   = EHOSTUNREACH,
0168     identifier_removed                 = EIDRM,
0169     illegal_byte_sequence              = EILSEQ,
0170     inappropriate_io_control_operation = ENOTTY,
0171     interrupted                        = EINTR,
0172     invalid_argument                   = EINVAL,
0173     invalid_seek                       = ESPIPE,
0174     io_error                           = EIO,
0175     is_a_directory                     = EISDIR,
0176     message_size                       = EMSGSIZE,
0177     network_down                       = ENETDOWN,
0178     network_reset                      = ENETRESET,
0179     network_unreachable                = ENETUNREACH,
0180     no_buffer_space                    = ENOBUFS,
0181     no_child_process                   = ECHILD,
0182     no_link                            = ENOLINK,
0183     no_lock_available                  = ENOLCK,
0184     // clang-format off
0185     no_message_available _LIBCPP_DEPRECATED =
0186     _LIBCPP_SUPPRESS_DEPRECATED_ERRC_PUSH
0187 #ifdef ENODATA
0188                                               ENODATA
0189 #else
0190                                               ENOMSG
0191 #endif
0192     _LIBCPP_SUPPRESS_DEPRECATED_ERRC_POP
0193     ,
0194     // clang-format on
0195     no_message         = ENOMSG,
0196     no_protocol_option = ENOPROTOOPT,
0197     no_space_on_device = ENOSPC,
0198     // clang-format off
0199     no_stream_resources _LIBCPP_DEPRECATED =
0200     _LIBCPP_SUPPRESS_DEPRECATED_ERRC_PUSH
0201 #ifdef ENOSR
0202                                               ENOSR
0203 #else
0204                                               ENOMEM
0205 #endif
0206     _LIBCPP_SUPPRESS_DEPRECATED_ERRC_POP
0207     ,
0208     // clang-format on
0209     no_such_device_or_address = ENXIO,
0210     no_such_device            = ENODEV,
0211     no_such_file_or_directory = ENOENT,
0212     no_such_process           = ESRCH,
0213     not_a_directory           = ENOTDIR,
0214     not_a_socket              = ENOTSOCK,
0215     // clang-format off
0216     not_a_stream _LIBCPP_DEPRECATED =
0217     _LIBCPP_SUPPRESS_DEPRECATED_ERRC_PUSH
0218 #ifdef ENOSTR
0219                                       ENOSTR
0220 #else
0221                                       EINVAL
0222 #endif
0223     _LIBCPP_SUPPRESS_DEPRECATED_ERRC_POP
0224     ,
0225     // clang-format on
0226     not_connected                  = ENOTCONN,
0227     not_enough_memory              = ENOMEM,
0228     not_supported                  = ENOTSUP,
0229     operation_canceled             = ECANCELED,
0230     operation_in_progress          = EINPROGRESS,
0231     operation_not_permitted        = EPERM,
0232     operation_not_supported        = EOPNOTSUPP,
0233     operation_would_block          = EWOULDBLOCK,
0234     owner_dead                     = EOWNERDEAD,
0235     permission_denied              = EACCES,
0236     protocol_error                 = EPROTO,
0237     protocol_not_supported         = EPROTONOSUPPORT,
0238     read_only_file_system          = EROFS,
0239     resource_deadlock_would_occur  = EDEADLK,
0240     resource_unavailable_try_again = EAGAIN,
0241     result_out_of_range            = ERANGE,
0242     state_not_recoverable          = ENOTRECOVERABLE,
0243     // clang-format off
0244     stream_timeout _LIBCPP_DEPRECATED =
0245     _LIBCPP_SUPPRESS_DEPRECATED_ERRC_PUSH
0246 #ifdef ETIME
0247                                         ETIME
0248 #else
0249                                         ETIMEDOUT
0250 #endif
0251     _LIBCPP_SUPPRESS_DEPRECATED_ERRC_POP
0252     ,
0253     // clang-format on
0254     text_file_busy                = ETXTBSY,
0255     timed_out                     = ETIMEDOUT,
0256     too_many_files_open_in_system = ENFILE,
0257     too_many_files_open           = EMFILE,
0258     too_many_links                = EMLINK,
0259     too_many_symbolic_link_levels = ELOOP,
0260     value_too_large               = EOVERFLOW,
0261     wrong_protocol_type           = EPROTOTYPE};
0262 _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
0263 
0264 _LIBCPP_END_NAMESPACE_STD
0265 
0266 #endif // _LIBCPP___ERRC