errc.h 9.0 KB

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