Path: blob/main/contrib/llvm-project/libcxx/include/__system_error/errc.h
35233 views
// -*- C++ -*-1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___ERRC10#define _LIBCPP___ERRC1112/*13system_error synopsis1415namespace std16{1718enum class errc19{20address_family_not_supported, // EAFNOSUPPORT21address_in_use, // EADDRINUSE22address_not_available, // EADDRNOTAVAIL23already_connected, // EISCONN24argument_list_too_long, // E2BIG25argument_out_of_domain, // EDOM26bad_address, // EFAULT27bad_file_descriptor, // EBADF28bad_message, // EBADMSG29broken_pipe, // EPIPE30connection_aborted, // ECONNABORTED31connection_already_in_progress, // EALREADY32connection_refused, // ECONNREFUSED33connection_reset, // ECONNRESET34cross_device_link, // EXDEV35destination_address_required, // EDESTADDRREQ36device_or_resource_busy, // EBUSY37directory_not_empty, // ENOTEMPTY38executable_format_error, // ENOEXEC39file_exists, // EEXIST40file_too_large, // EFBIG41filename_too_long, // ENAMETOOLONG42function_not_supported, // ENOSYS43host_unreachable, // EHOSTUNREACH44identifier_removed, // EIDRM45illegal_byte_sequence, // EILSEQ46inappropriate_io_control_operation, // ENOTTY47integrity_check_failed, // EINTEGRITY // FreeBSD customization48interrupted, // EINTR49invalid_argument, // EINVAL50invalid_seek, // ESPIPE51io_error, // EIO52is_a_directory, // EISDIR53message_size, // EMSGSIZE54network_down, // ENETDOWN55network_reset, // ENETRESET56network_unreachable, // ENETUNREACH57no_buffer_space, // ENOBUFS58no_child_process, // ECHILD59no_link, // ENOLINK60no_lock_available, // ENOLCK61no_message_available, // ENODATA // deprecated62no_message, // ENOMSG63no_protocol_option, // ENOPROTOOPT64no_space_on_device, // ENOSPC65no_stream_resources, // ENOSR // deprecated66no_such_device_or_address, // ENXIO67no_such_device, // ENODEV68no_such_file_or_directory, // ENOENT69no_such_process, // ESRCH70not_a_directory, // ENOTDIR71not_a_socket, // ENOTSOCK72not_a_stream, // ENOSTR // deprecated73not_connected, // ENOTCONN74not_enough_memory, // ENOMEM75not_supported, // ENOTSUP76operation_canceled, // ECANCELED77operation_in_progress, // EINPROGRESS78operation_not_permitted, // EPERM79operation_not_supported, // EOPNOTSUPP80operation_would_block, // EWOULDBLOCK81owner_dead, // EOWNERDEAD82permission_denied, // EACCES83protocol_error, // EPROTO84protocol_not_supported, // EPROTONOSUPPORT85read_only_file_system, // EROFS86resource_deadlock_would_occur, // EDEADLK87resource_unavailable_try_again, // EAGAIN88result_out_of_range, // ERANGE89state_not_recoverable, // ENOTRECOVERABLE90stream_timeout, // ETIME // deprecated91text_file_busy, // ETXTBSY92timed_out, // ETIMEDOUT93too_many_files_open_in_system, // ENFILE94too_many_files_open, // EMFILE95too_many_links, // EMLINK96too_many_symbolic_link_levels, // ELOOP97value_too_large, // EOVERFLOW98wrong_protocol_type // EPROTOTYPE99};100101*/102103#include <__config>104#include <cerrno>105106#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)107# pragma GCC system_header108#endif109110// The method of pushing and popping the diagnostics fails for GCC. GCC does111// not recognize the pragma's used to generate deprecated diagnostics for112// macros. So GCC does not need the pushing and popping.113//114// TODO Remove this when the deprecated constants are removed.115//116// Note based on the post-review comments in117// https://github.com/llvm/llvm-project/pull/80542 libc++ no longer deprecates118// the macros. Since C libraries may start to deprecate these POSIX macros the119// deprecation warning avoidance is kept.120#if defined(_LIBCPP_COMPILER_CLANG_BASED)121# define _LIBCPP_SUPPRESS_DEPRECATED_ERRC_PUSH _LIBCPP_SUPPRESS_DEPRECATED_PUSH122# define _LIBCPP_SUPPRESS_DEPRECATED_ERRC_POP _LIBCPP_SUPPRESS_DEPRECATED_POP123#else124# define _LIBCPP_SUPPRESS_DEPRECATED_ERRC_PUSH125# define _LIBCPP_SUPPRESS_DEPRECATED_ERRC_POP126#endif127128_LIBCPP_BEGIN_NAMESPACE_STD129130// Some error codes are not present on all platforms, so we provide equivalents131// for them:132133// enum class errc134//135// LWG3869 deprecates the UNIX STREAMS macros and enum values.136// This makes the code clumbersome:137// - the enum value is deprecated and should show a diagnostic,138// - the macro is deprecated and should _not_ show a diagnostic in this139// context, and140// - the macro is not always available.141// This leads to the odd pushing and popping of the deprecated142// diagnostic.143_LIBCPP_DECLARE_STRONG_ENUM(errc){144address_family_not_supported = EAFNOSUPPORT,145address_in_use = EADDRINUSE,146address_not_available = EADDRNOTAVAIL,147already_connected = EISCONN,148argument_list_too_long = E2BIG,149argument_out_of_domain = EDOM,150bad_address = EFAULT,151bad_file_descriptor = EBADF,152bad_message = EBADMSG,153broken_pipe = EPIPE,154connection_aborted = ECONNABORTED,155connection_already_in_progress = EALREADY,156connection_refused = ECONNREFUSED,157connection_reset = ECONNRESET,158cross_device_link = EXDEV,159destination_address_required = EDESTADDRREQ,160device_or_resource_busy = EBUSY,161directory_not_empty = ENOTEMPTY,162executable_format_error = ENOEXEC,163file_exists = EEXIST,164file_too_large = EFBIG,165filename_too_long = ENAMETOOLONG,166function_not_supported = ENOSYS,167host_unreachable = EHOSTUNREACH,168identifier_removed = EIDRM,169illegal_byte_sequence = EILSEQ,170inappropriate_io_control_operation = ENOTTY,171#ifdef EINTEGRITY172integrity_check_failed = EINTEGRITY, // FreeBSD customization173#endif174interrupted = EINTR,175invalid_argument = EINVAL,176invalid_seek = ESPIPE,177io_error = EIO,178is_a_directory = EISDIR,179message_size = EMSGSIZE,180network_down = ENETDOWN,181network_reset = ENETRESET,182network_unreachable = ENETUNREACH,183no_buffer_space = ENOBUFS,184no_child_process = ECHILD,185no_link = ENOLINK,186no_lock_available = ENOLCK,187// clang-format off188no_message_available _LIBCPP_DEPRECATED =189_LIBCPP_SUPPRESS_DEPRECATED_ERRC_PUSH190#ifdef ENODATA191ENODATA192#else193ENOMSG194#endif195_LIBCPP_SUPPRESS_DEPRECATED_ERRC_POP196,197// clang-format on198no_message = ENOMSG,199no_protocol_option = ENOPROTOOPT,200no_space_on_device = ENOSPC,201// clang-format off202no_stream_resources _LIBCPP_DEPRECATED =203_LIBCPP_SUPPRESS_DEPRECATED_ERRC_PUSH204#ifdef ENOSR205ENOSR206#else207ENOMEM208#endif209_LIBCPP_SUPPRESS_DEPRECATED_ERRC_POP210,211// clang-format on212no_such_device_or_address = ENXIO,213no_such_device = ENODEV,214no_such_file_or_directory = ENOENT,215no_such_process = ESRCH,216not_a_directory = ENOTDIR,217not_a_socket = ENOTSOCK,218// clang-format off219not_a_stream _LIBCPP_DEPRECATED =220_LIBCPP_SUPPRESS_DEPRECATED_ERRC_PUSH221#ifdef ENOSTR222ENOSTR223#else224EINVAL225#endif226_LIBCPP_SUPPRESS_DEPRECATED_ERRC_POP227,228// clang-format on229not_connected = ENOTCONN,230not_enough_memory = ENOMEM,231not_supported = ENOTSUP,232operation_canceled = ECANCELED,233operation_in_progress = EINPROGRESS,234operation_not_permitted = EPERM,235operation_not_supported = EOPNOTSUPP,236operation_would_block = EWOULDBLOCK,237owner_dead = EOWNERDEAD,238permission_denied = EACCES,239protocol_error = EPROTO,240protocol_not_supported = EPROTONOSUPPORT,241read_only_file_system = EROFS,242resource_deadlock_would_occur = EDEADLK,243resource_unavailable_try_again = EAGAIN,244result_out_of_range = ERANGE,245state_not_recoverable = ENOTRECOVERABLE,246// clang-format off247stream_timeout _LIBCPP_DEPRECATED =248_LIBCPP_SUPPRESS_DEPRECATED_ERRC_PUSH249#ifdef ETIME250ETIME251#else252ETIMEDOUT253#endif254_LIBCPP_SUPPRESS_DEPRECATED_ERRC_POP255,256// clang-format on257text_file_busy = ETXTBSY,258timed_out = ETIMEDOUT,259too_many_files_open_in_system = ENFILE,260too_many_files_open = EMFILE,261too_many_links = EMLINK,262too_many_symbolic_link_levels = ELOOP,263value_too_large = EOVERFLOW,264wrong_protocol_type = EPROTOTYPE};265_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)266267_LIBCPP_END_NAMESPACE_STD268269#endif // _LIBCPP___ERRC270271272