14f4effd6SZhihao Yuan// -*- C++ -*- 2*eb8650a7SLouis Dionne//===----------------------------------------------------------------------===// 34f4effd6SZhihao Yuan// 457b08b09SChandler Carruth// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 557b08b09SChandler Carruth// See https://llvm.org/LICENSE.txt for license information. 657b08b09SChandler Carruth// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 74f4effd6SZhihao Yuan// 84f4effd6SZhihao Yuan//===----------------------------------------------------------------------===// 94f4effd6SZhihao Yuan 104f4effd6SZhihao Yuan#ifndef _LIBCPP___ERRC 114f4effd6SZhihao Yuan#define _LIBCPP___ERRC 124f4effd6SZhihao Yuan 134f4effd6SZhihao Yuan/* 144f4effd6SZhihao Yuan system_error synopsis 154f4effd6SZhihao Yuan 164f4effd6SZhihao Yuannamespace std 174f4effd6SZhihao Yuan{ 184f4effd6SZhihao Yuan 194f4effd6SZhihao Yuanenum class errc 204f4effd6SZhihao Yuan{ 214f4effd6SZhihao Yuan address_family_not_supported, // EAFNOSUPPORT 224f4effd6SZhihao Yuan address_in_use, // EADDRINUSE 234f4effd6SZhihao Yuan address_not_available, // EADDRNOTAVAIL 244f4effd6SZhihao Yuan already_connected, // EISCONN 254f4effd6SZhihao Yuan argument_list_too_long, // E2BIG 264f4effd6SZhihao Yuan argument_out_of_domain, // EDOM 274f4effd6SZhihao Yuan bad_address, // EFAULT 284f4effd6SZhihao Yuan bad_file_descriptor, // EBADF 294f4effd6SZhihao Yuan bad_message, // EBADMSG 304f4effd6SZhihao Yuan broken_pipe, // EPIPE 314f4effd6SZhihao Yuan connection_aborted, // ECONNABORTED 324f4effd6SZhihao Yuan connection_already_in_progress, // EALREADY 334f4effd6SZhihao Yuan connection_refused, // ECONNREFUSED 344f4effd6SZhihao Yuan connection_reset, // ECONNRESET 354f4effd6SZhihao Yuan cross_device_link, // EXDEV 364f4effd6SZhihao Yuan destination_address_required, // EDESTADDRREQ 374f4effd6SZhihao Yuan device_or_resource_busy, // EBUSY 384f4effd6SZhihao Yuan directory_not_empty, // ENOTEMPTY 394f4effd6SZhihao Yuan executable_format_error, // ENOEXEC 404f4effd6SZhihao Yuan file_exists, // EEXIST 414f4effd6SZhihao Yuan file_too_large, // EFBIG 424f4effd6SZhihao Yuan filename_too_long, // ENAMETOOLONG 434f4effd6SZhihao Yuan function_not_supported, // ENOSYS 444f4effd6SZhihao Yuan host_unreachable, // EHOSTUNREACH 454f4effd6SZhihao Yuan identifier_removed, // EIDRM 464f4effd6SZhihao Yuan illegal_byte_sequence, // EILSEQ 474f4effd6SZhihao Yuan inappropriate_io_control_operation, // ENOTTY 484f4effd6SZhihao Yuan interrupted, // EINTR 494f4effd6SZhihao Yuan invalid_argument, // EINVAL 504f4effd6SZhihao Yuan invalid_seek, // ESPIPE 514f4effd6SZhihao Yuan io_error, // EIO 524f4effd6SZhihao Yuan is_a_directory, // EISDIR 534f4effd6SZhihao Yuan message_size, // EMSGSIZE 544f4effd6SZhihao Yuan network_down, // ENETDOWN 554f4effd6SZhihao Yuan network_reset, // ENETRESET 564f4effd6SZhihao Yuan network_unreachable, // ENETUNREACH 574f4effd6SZhihao Yuan no_buffer_space, // ENOBUFS 584f4effd6SZhihao Yuan no_child_process, // ECHILD 594f4effd6SZhihao Yuan no_link, // ENOLINK 604f4effd6SZhihao Yuan no_lock_available, // ENOLCK 614f4effd6SZhihao Yuan no_message_available, // ENODATA 624f4effd6SZhihao Yuan no_message, // ENOMSG 634f4effd6SZhihao Yuan no_protocol_option, // ENOPROTOOPT 644f4effd6SZhihao Yuan no_space_on_device, // ENOSPC 654f4effd6SZhihao Yuan no_stream_resources, // ENOSR 664f4effd6SZhihao Yuan no_such_device_or_address, // ENXIO 674f4effd6SZhihao Yuan no_such_device, // ENODEV 684f4effd6SZhihao Yuan no_such_file_or_directory, // ENOENT 694f4effd6SZhihao Yuan no_such_process, // ESRCH 704f4effd6SZhihao Yuan not_a_directory, // ENOTDIR 714f4effd6SZhihao Yuan not_a_socket, // ENOTSOCK 724f4effd6SZhihao Yuan not_a_stream, // ENOSTR 734f4effd6SZhihao Yuan not_connected, // ENOTCONN 744f4effd6SZhihao Yuan not_enough_memory, // ENOMEM 754f4effd6SZhihao Yuan not_supported, // ENOTSUP 764f4effd6SZhihao Yuan operation_canceled, // ECANCELED 774f4effd6SZhihao Yuan operation_in_progress, // EINPROGRESS 784f4effd6SZhihao Yuan operation_not_permitted, // EPERM 794f4effd6SZhihao Yuan operation_not_supported, // EOPNOTSUPP 804f4effd6SZhihao Yuan operation_would_block, // EWOULDBLOCK 814f4effd6SZhihao Yuan owner_dead, // EOWNERDEAD 824f4effd6SZhihao Yuan permission_denied, // EACCES 834f4effd6SZhihao Yuan protocol_error, // EPROTO 844f4effd6SZhihao Yuan protocol_not_supported, // EPROTONOSUPPORT 854f4effd6SZhihao Yuan read_only_file_system, // EROFS 864f4effd6SZhihao Yuan resource_deadlock_would_occur, // EDEADLK 874f4effd6SZhihao Yuan resource_unavailable_try_again, // EAGAIN 884f4effd6SZhihao Yuan result_out_of_range, // ERANGE 894f4effd6SZhihao Yuan state_not_recoverable, // ENOTRECOVERABLE 904f4effd6SZhihao Yuan stream_timeout, // ETIME 914f4effd6SZhihao Yuan text_file_busy, // ETXTBSY 924f4effd6SZhihao Yuan timed_out, // ETIMEDOUT 934f4effd6SZhihao Yuan too_many_files_open_in_system, // ENFILE 944f4effd6SZhihao Yuan too_many_files_open, // EMFILE 954f4effd6SZhihao Yuan too_many_links, // EMLINK 964f4effd6SZhihao Yuan too_many_symbolic_link_levels, // ELOOP 974f4effd6SZhihao Yuan value_too_large, // EOVERFLOW 984f4effd6SZhihao Yuan wrong_protocol_type // EPROTOTYPE 994f4effd6SZhihao Yuan}; 1004f4effd6SZhihao Yuan 1014f4effd6SZhihao Yuan*/ 1024f4effd6SZhihao Yuan 1034f4effd6SZhihao Yuan#include <__config> 1044f4effd6SZhihao Yuan#include <cerrno> 1054f4effd6SZhihao Yuan 1064f4effd6SZhihao Yuan#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 1074f4effd6SZhihao Yuan# pragma GCC system_header 1084f4effd6SZhihao Yuan#endif 1094f4effd6SZhihao Yuan 1104f4effd6SZhihao Yuan_LIBCPP_BEGIN_NAMESPACE_STD 1114f4effd6SZhihao Yuan 1124f4effd6SZhihao Yuan// Some error codes are not present on all platforms, so we provide equivalents 1134f4effd6SZhihao Yuan// for them: 1144f4effd6SZhihao Yuan 1154f4effd6SZhihao Yuan//enum class errc 1164f4effd6SZhihao Yuan_LIBCPP_DECLARE_STRONG_ENUM(errc) 1174f4effd6SZhihao Yuan{ 1184f4effd6SZhihao Yuan address_family_not_supported = EAFNOSUPPORT, 1194f4effd6SZhihao Yuan address_in_use = EADDRINUSE, 1204f4effd6SZhihao Yuan address_not_available = EADDRNOTAVAIL, 1214f4effd6SZhihao Yuan already_connected = EISCONN, 1224f4effd6SZhihao Yuan argument_list_too_long = E2BIG, 1234f4effd6SZhihao Yuan argument_out_of_domain = EDOM, 1244f4effd6SZhihao Yuan bad_address = EFAULT, 1254f4effd6SZhihao Yuan bad_file_descriptor = EBADF, 1264f4effd6SZhihao Yuan bad_message = EBADMSG, 1274f4effd6SZhihao Yuan broken_pipe = EPIPE, 1284f4effd6SZhihao Yuan connection_aborted = ECONNABORTED, 1294f4effd6SZhihao Yuan connection_already_in_progress = EALREADY, 1304f4effd6SZhihao Yuan connection_refused = ECONNREFUSED, 1314f4effd6SZhihao Yuan connection_reset = ECONNRESET, 1324f4effd6SZhihao Yuan cross_device_link = EXDEV, 1334f4effd6SZhihao Yuan destination_address_required = EDESTADDRREQ, 1344f4effd6SZhihao Yuan device_or_resource_busy = EBUSY, 1354f4effd6SZhihao Yuan directory_not_empty = ENOTEMPTY, 1364f4effd6SZhihao Yuan executable_format_error = ENOEXEC, 1374f4effd6SZhihao Yuan file_exists = EEXIST, 1384f4effd6SZhihao Yuan file_too_large = EFBIG, 1394f4effd6SZhihao Yuan filename_too_long = ENAMETOOLONG, 1404f4effd6SZhihao Yuan function_not_supported = ENOSYS, 1414f4effd6SZhihao Yuan host_unreachable = EHOSTUNREACH, 1424f4effd6SZhihao Yuan identifier_removed = EIDRM, 1434f4effd6SZhihao Yuan illegal_byte_sequence = EILSEQ, 1444f4effd6SZhihao Yuan inappropriate_io_control_operation = ENOTTY, 1454f4effd6SZhihao Yuan interrupted = EINTR, 1464f4effd6SZhihao Yuan invalid_argument = EINVAL, 1474f4effd6SZhihao Yuan invalid_seek = ESPIPE, 1484f4effd6SZhihao Yuan io_error = EIO, 1494f4effd6SZhihao Yuan is_a_directory = EISDIR, 1504f4effd6SZhihao Yuan message_size = EMSGSIZE, 1514f4effd6SZhihao Yuan network_down = ENETDOWN, 1524f4effd6SZhihao Yuan network_reset = ENETRESET, 1534f4effd6SZhihao Yuan network_unreachable = ENETUNREACH, 1544f4effd6SZhihao Yuan no_buffer_space = ENOBUFS, 1554f4effd6SZhihao Yuan no_child_process = ECHILD, 1564f4effd6SZhihao Yuan no_link = ENOLINK, 1574f4effd6SZhihao Yuan no_lock_available = ENOLCK, 1584f4effd6SZhihao Yuan#ifdef ENODATA 1594f4effd6SZhihao Yuan no_message_available = ENODATA, 1604f4effd6SZhihao Yuan#else 1614f4effd6SZhihao Yuan no_message_available = ENOMSG, 1624f4effd6SZhihao Yuan#endif 1634f4effd6SZhihao Yuan no_message = ENOMSG, 1644f4effd6SZhihao Yuan no_protocol_option = ENOPROTOOPT, 1654f4effd6SZhihao Yuan no_space_on_device = ENOSPC, 1664f4effd6SZhihao Yuan#ifdef ENOSR 1674f4effd6SZhihao Yuan no_stream_resources = ENOSR, 1684f4effd6SZhihao Yuan#else 1694f4effd6SZhihao Yuan no_stream_resources = ENOMEM, 1704f4effd6SZhihao Yuan#endif 1714f4effd6SZhihao Yuan no_such_device_or_address = ENXIO, 1724f4effd6SZhihao Yuan no_such_device = ENODEV, 1734f4effd6SZhihao Yuan no_such_file_or_directory = ENOENT, 1744f4effd6SZhihao Yuan no_such_process = ESRCH, 1754f4effd6SZhihao Yuan not_a_directory = ENOTDIR, 1764f4effd6SZhihao Yuan not_a_socket = ENOTSOCK, 1774f4effd6SZhihao Yuan#ifdef ENOSTR 1784f4effd6SZhihao Yuan not_a_stream = ENOSTR, 1794f4effd6SZhihao Yuan#else 1804f4effd6SZhihao Yuan not_a_stream = EINVAL, 1814f4effd6SZhihao Yuan#endif 1824f4effd6SZhihao Yuan not_connected = ENOTCONN, 1834f4effd6SZhihao Yuan not_enough_memory = ENOMEM, 1844f4effd6SZhihao Yuan not_supported = ENOTSUP, 1854f4effd6SZhihao Yuan operation_canceled = ECANCELED, 1864f4effd6SZhihao Yuan operation_in_progress = EINPROGRESS, 1874f4effd6SZhihao Yuan operation_not_permitted = EPERM, 1884f4effd6SZhihao Yuan operation_not_supported = EOPNOTSUPP, 1894f4effd6SZhihao Yuan operation_would_block = EWOULDBLOCK, 1904f4effd6SZhihao Yuan owner_dead = EOWNERDEAD, 1914f4effd6SZhihao Yuan permission_denied = EACCES, 1924f4effd6SZhihao Yuan protocol_error = EPROTO, 1934f4effd6SZhihao Yuan protocol_not_supported = EPROTONOSUPPORT, 1944f4effd6SZhihao Yuan read_only_file_system = EROFS, 1954f4effd6SZhihao Yuan resource_deadlock_would_occur = EDEADLK, 1964f4effd6SZhihao Yuan resource_unavailable_try_again = EAGAIN, 1974f4effd6SZhihao Yuan result_out_of_range = ERANGE, 1984f4effd6SZhihao Yuan state_not_recoverable = ENOTRECOVERABLE, 1994f4effd6SZhihao Yuan#ifdef ETIME 2004f4effd6SZhihao Yuan stream_timeout = ETIME, 2014f4effd6SZhihao Yuan#else 2024f4effd6SZhihao Yuan stream_timeout = ETIMEDOUT, 2034f4effd6SZhihao Yuan#endif 2044f4effd6SZhihao Yuan text_file_busy = ETXTBSY, 2054f4effd6SZhihao Yuan timed_out = ETIMEDOUT, 2064f4effd6SZhihao Yuan too_many_files_open_in_system = ENFILE, 2074f4effd6SZhihao Yuan too_many_files_open = EMFILE, 2084f4effd6SZhihao Yuan too_many_links = EMLINK, 2094f4effd6SZhihao Yuan too_many_symbolic_link_levels = ELOOP, 2104f4effd6SZhihao Yuan value_too_large = EOVERFLOW, 2114f4effd6SZhihao Yuan wrong_protocol_type = EPROTOTYPE 2124f4effd6SZhihao Yuan}; 2134f4effd6SZhihao Yuan_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc) 2144f4effd6SZhihao Yuan 2154f4effd6SZhihao Yuan_LIBCPP_END_NAMESPACE_STD 2164f4effd6SZhihao Yuan 2174f4effd6SZhihao Yuan#endif // _LIBCPP___ERRC 218