xref: /llvm-project/libc/src/__support/StringUtil/tables/posix_errors.h (revision 46944b0cbc9a9d8daad0182c40fcd3560bc9ca35)
125174976SSiva Chandra Reddy //===-- Map of POSIX error numbers to strings -------------------*- C++ -*-===//
225174976SSiva Chandra Reddy //
325174976SSiva Chandra Reddy // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
425174976SSiva Chandra Reddy // See https://llvm.org/LICENSE.txt for license information.
525174976SSiva Chandra Reddy // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
625174976SSiva Chandra Reddy //
725174976SSiva Chandra Reddy //===----------------------------------------------------------------------===//
825174976SSiva Chandra Reddy 
9330793c9SNick Desaulniers #ifndef LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_POSIX_ERRORS_H
10330793c9SNick Desaulniers #define LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_POSIX_ERRORS_H
1125174976SSiva Chandra Reddy 
12*46944b0cSJob Henandez Lara #include "hdr/errno_macros.h"
1325174976SSiva Chandra Reddy #include "src/__support/StringUtil/message_mapper.h"
145ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
1525174976SSiva Chandra Reddy 
165ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
1725174976SSiva Chandra Reddy 
185bf8efd2SRoland McGrath LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRORS = {
1925174976SSiva Chandra Reddy     MsgMapping(EPERM, "Operation not permitted"),
2025174976SSiva Chandra Reddy     MsgMapping(ENOENT, "No such file or directory"),
2125174976SSiva Chandra Reddy     MsgMapping(ESRCH, "No such process"),
2225174976SSiva Chandra Reddy     MsgMapping(EINTR, "Interrupted system call"),
2325174976SSiva Chandra Reddy     MsgMapping(EIO, "Input/output error"),
2425174976SSiva Chandra Reddy     MsgMapping(ENXIO, "No such device or address"),
2525174976SSiva Chandra Reddy     MsgMapping(E2BIG, "Argument list too long"),
2625174976SSiva Chandra Reddy     MsgMapping(ENOEXEC, "Exec format error"),
2725174976SSiva Chandra Reddy     MsgMapping(EBADF, "Bad file descriptor"),
2825174976SSiva Chandra Reddy     MsgMapping(ECHILD, "No child processes"),
2925174976SSiva Chandra Reddy     MsgMapping(EAGAIN, "Resource temporarily unavailable"),
3025174976SSiva Chandra Reddy     MsgMapping(ENOMEM, "Cannot allocate memory"),
3125174976SSiva Chandra Reddy     MsgMapping(EACCES, "Permission denied"),
3225174976SSiva Chandra Reddy     MsgMapping(EFAULT, "Bad address"),
3325174976SSiva Chandra Reddy     MsgMapping(EBUSY, "Device or resource busy"),
3425174976SSiva Chandra Reddy     MsgMapping(EEXIST, "File exists"),
3525174976SSiva Chandra Reddy     MsgMapping(EXDEV, "Invalid cross-device link"),
3625174976SSiva Chandra Reddy     MsgMapping(ENODEV, "No such device"),
3725174976SSiva Chandra Reddy     MsgMapping(ENOTDIR, "Not a directory"),
3825174976SSiva Chandra Reddy     MsgMapping(EISDIR, "Is a directory"),
3925174976SSiva Chandra Reddy     MsgMapping(EINVAL, "Invalid argument"),
4025174976SSiva Chandra Reddy     MsgMapping(ENFILE, "Too many open files in system"),
4125174976SSiva Chandra Reddy     MsgMapping(EMFILE, "Too many open files"),
4225174976SSiva Chandra Reddy     MsgMapping(ENOTTY, "Inappropriate ioctl for device"),
4325174976SSiva Chandra Reddy     MsgMapping(ETXTBSY, "Text file busy"),
4425174976SSiva Chandra Reddy     MsgMapping(EFBIG, "File too large"),
4525174976SSiva Chandra Reddy     MsgMapping(ENOSPC, "No space left on device"),
4625174976SSiva Chandra Reddy     MsgMapping(ESPIPE, "Illegal seek"),
4725174976SSiva Chandra Reddy     MsgMapping(EROFS, "Read-only file system"),
4825174976SSiva Chandra Reddy     MsgMapping(EMLINK, "Too many links"),
4925174976SSiva Chandra Reddy     MsgMapping(EPIPE, "Broken pipe"),
5025174976SSiva Chandra Reddy     MsgMapping(EDEADLK, "Resource deadlock avoided"),
5125174976SSiva Chandra Reddy     MsgMapping(ENAMETOOLONG, "File name too long"),
5225174976SSiva Chandra Reddy     MsgMapping(ENOLCK, "No locks available"),
5325174976SSiva Chandra Reddy     MsgMapping(ENOSYS, "Function not implemented"),
5425174976SSiva Chandra Reddy     MsgMapping(ENOTEMPTY, "Directory not empty"),
5525174976SSiva Chandra Reddy     MsgMapping(ELOOP, "Too many levels of symbolic links"),
5625174976SSiva Chandra Reddy     MsgMapping(ENOMSG, "No message of desired type"),
5725174976SSiva Chandra Reddy     MsgMapping(EIDRM, "Identifier removed"),
5825174976SSiva Chandra Reddy     MsgMapping(ENOSTR, "Device not a stream"),
5925174976SSiva Chandra Reddy     MsgMapping(ENODATA, "No data available"),
6025174976SSiva Chandra Reddy     MsgMapping(ETIME, "Timer expired"),
6125174976SSiva Chandra Reddy     MsgMapping(ENOSR, "Out of streams resources"),
6225174976SSiva Chandra Reddy     MsgMapping(ENOLINK, "Link has been severed"),
6325174976SSiva Chandra Reddy     MsgMapping(EPROTO, "Protocol error"),
6425174976SSiva Chandra Reddy     MsgMapping(EMULTIHOP, "Multihop attempted"),
6525174976SSiva Chandra Reddy     MsgMapping(EBADMSG, "Bad message"),
6625174976SSiva Chandra Reddy     MsgMapping(EOVERFLOW, "Value too large for defined data type"),
6725174976SSiva Chandra Reddy     MsgMapping(ENOTSOCK, "Socket operation on non-socket"),
6825174976SSiva Chandra Reddy     MsgMapping(EDESTADDRREQ, "Destination address required"),
6925174976SSiva Chandra Reddy     MsgMapping(EMSGSIZE, "Message too long"),
7025174976SSiva Chandra Reddy     MsgMapping(EPROTOTYPE, "Protocol wrong type for socket"),
7125174976SSiva Chandra Reddy     MsgMapping(ENOPROTOOPT, "Protocol not available"),
7225174976SSiva Chandra Reddy     MsgMapping(EPROTONOSUPPORT, "Protocol not supported"),
7325174976SSiva Chandra Reddy     MsgMapping(ENOTSUP, "Operation not supported"),
7425174976SSiva Chandra Reddy     MsgMapping(EAFNOSUPPORT, "Address family not supported by protocol"),
7525174976SSiva Chandra Reddy     MsgMapping(EADDRINUSE, "Address already in use"),
7625174976SSiva Chandra Reddy     MsgMapping(EADDRNOTAVAIL, "Cannot assign requested address"),
7725174976SSiva Chandra Reddy     MsgMapping(ENETDOWN, "Network is down"),
7825174976SSiva Chandra Reddy     MsgMapping(ENETUNREACH, "Network is unreachable"),
7925174976SSiva Chandra Reddy     MsgMapping(ENETRESET, "Network dropped connection on reset"),
8025174976SSiva Chandra Reddy     MsgMapping(ECONNABORTED, "Software caused connection abort"),
8125174976SSiva Chandra Reddy     MsgMapping(ECONNRESET, "Connection reset by peer"),
8225174976SSiva Chandra Reddy     MsgMapping(ENOBUFS, "No buffer space available"),
8325174976SSiva Chandra Reddy     MsgMapping(EISCONN, "Transport endpoint is already connected"),
8425174976SSiva Chandra Reddy     MsgMapping(ENOTCONN, "Transport endpoint is not connected"),
8525174976SSiva Chandra Reddy     MsgMapping(ETIMEDOUT, "Connection timed out"),
8625174976SSiva Chandra Reddy     MsgMapping(ECONNREFUSED, "Connection refused"),
8725174976SSiva Chandra Reddy     MsgMapping(EHOSTUNREACH, "No route to host"),
8825174976SSiva Chandra Reddy     MsgMapping(EALREADY, "Operation already in progress"),
8925174976SSiva Chandra Reddy     MsgMapping(EINPROGRESS, "Operation now in progress"),
9025174976SSiva Chandra Reddy     MsgMapping(ESTALE, "Stale file handle"),
9125174976SSiva Chandra Reddy     MsgMapping(EDQUOT, "Disk quota exceeded"),
9225174976SSiva Chandra Reddy     MsgMapping(ECANCELED, "Operation canceled"),
9325174976SSiva Chandra Reddy     MsgMapping(EOWNERDEAD, "Owner died"),
9425174976SSiva Chandra Reddy     MsgMapping(ENOTRECOVERABLE, "State not recoverable"),
9525174976SSiva Chandra Reddy };
9625174976SSiva Chandra Reddy 
97f009f72dSMichael Jones LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRNO_NAMES = {
98f009f72dSMichael Jones     MsgMapping(EPERM, "EPERM"),
99f009f72dSMichael Jones     MsgMapping(ENOENT, "ENOENT"),
100f009f72dSMichael Jones     MsgMapping(ESRCH, "ESRCH"),
101f009f72dSMichael Jones     MsgMapping(EINTR, "EINTR"),
102f009f72dSMichael Jones     MsgMapping(EIO, "EIO"),
103f009f72dSMichael Jones     MsgMapping(ENXIO, "ENXIO"),
104f009f72dSMichael Jones     MsgMapping(E2BIG, "E2BIG"),
105f009f72dSMichael Jones     MsgMapping(ENOEXEC, "ENOEXEC"),
106f009f72dSMichael Jones     MsgMapping(EBADF, "EBADF"),
107f009f72dSMichael Jones     MsgMapping(ECHILD, "ECHILD"),
108f009f72dSMichael Jones     MsgMapping(EAGAIN, "EAGAIN"),
109f009f72dSMichael Jones     MsgMapping(ENOMEM, "ENOMEM"),
110f009f72dSMichael Jones     MsgMapping(EACCES, "EACCES"),
111f009f72dSMichael Jones     MsgMapping(EFAULT, "EFAULT"),
112f009f72dSMichael Jones     MsgMapping(EBUSY, "EBUSY"),
113f009f72dSMichael Jones     MsgMapping(EEXIST, "EEXIST"),
114f009f72dSMichael Jones     MsgMapping(EXDEV, "EXDEV"),
115f009f72dSMichael Jones     MsgMapping(ENODEV, "ENODEV"),
116f009f72dSMichael Jones     MsgMapping(ENOTDIR, "ENOTDIR"),
117f009f72dSMichael Jones     MsgMapping(EISDIR, "EISDIR"),
118f009f72dSMichael Jones     MsgMapping(EINVAL, "EINVAL"),
119f009f72dSMichael Jones     MsgMapping(ENFILE, "ENFILE"),
120f009f72dSMichael Jones     MsgMapping(EMFILE, "EMFILE"),
121f009f72dSMichael Jones     MsgMapping(ENOTTY, "ENOTTY"),
122f009f72dSMichael Jones     MsgMapping(ETXTBSY, "ETXTBSY"),
123f009f72dSMichael Jones     MsgMapping(EFBIG, "EFBIG"),
124f009f72dSMichael Jones     MsgMapping(ENOSPC, "ENOSPC"),
125f009f72dSMichael Jones     MsgMapping(ESPIPE, "ESPIPE"),
126f009f72dSMichael Jones     MsgMapping(EROFS, "EROFS"),
127f009f72dSMichael Jones     MsgMapping(EMLINK, "EMLINK"),
128f009f72dSMichael Jones     MsgMapping(EPIPE, "EPIPE"),
129f009f72dSMichael Jones     MsgMapping(EDEADLK, "EDEADLK"),
130f009f72dSMichael Jones     MsgMapping(ENAMETOOLONG, "ENAMETOOLONG"),
131f009f72dSMichael Jones     MsgMapping(ENOLCK, "ENOLCK"),
132f009f72dSMichael Jones     MsgMapping(ENOSYS, "ENOSYS"),
133f009f72dSMichael Jones     MsgMapping(ENOTEMPTY, "ENOTEMPTY"),
134f009f72dSMichael Jones     MsgMapping(ELOOP, "ELOOP"),
135f009f72dSMichael Jones     MsgMapping(ENOMSG, "ENOMSG"),
136f009f72dSMichael Jones     MsgMapping(EIDRM, "EIDRM"),
137f009f72dSMichael Jones     MsgMapping(ENOSTR, "ENOSTR"),
138f009f72dSMichael Jones     MsgMapping(ENODATA, "ENODATA"),
139f009f72dSMichael Jones     MsgMapping(ETIME, "ETIME"),
140f009f72dSMichael Jones     MsgMapping(ENOSR, "ENOSR"),
141f009f72dSMichael Jones     MsgMapping(ENOLINK, "ENOLINK"),
142f009f72dSMichael Jones     MsgMapping(EPROTO, "EPROTO"),
143f009f72dSMichael Jones     MsgMapping(EMULTIHOP, "EMULTIHOP"),
144f009f72dSMichael Jones     MsgMapping(EBADMSG, "EBADMSG"),
145f009f72dSMichael Jones     MsgMapping(EOVERFLOW, "EOVERFLOW"),
146f009f72dSMichael Jones     MsgMapping(ENOTSOCK, "ENOTSOCK"),
147f009f72dSMichael Jones     MsgMapping(EDESTADDRREQ, "EDESTADDRREQ"),
148f009f72dSMichael Jones     MsgMapping(EMSGSIZE, "EMSGSIZE"),
149f009f72dSMichael Jones     MsgMapping(EPROTOTYPE, "EPROTOTYPE"),
150f009f72dSMichael Jones     MsgMapping(ENOPROTOOPT, "ENOPROTOOPT"),
151f009f72dSMichael Jones     MsgMapping(EPROTONOSUPPORT, "EPROTONOSUPPORT"),
152f009f72dSMichael Jones     MsgMapping(ENOTSUP, "ENOTSUP"),
153f009f72dSMichael Jones     MsgMapping(EAFNOSUPPORT, "EAFNOSUPPORT"),
154f009f72dSMichael Jones     MsgMapping(EADDRINUSE, "EADDRINUSE"),
155f009f72dSMichael Jones     MsgMapping(EADDRNOTAVAIL, "EADDRNOTAVAIL"),
156f009f72dSMichael Jones     MsgMapping(ENETDOWN, "ENETDOWN"),
157f009f72dSMichael Jones     MsgMapping(ENETUNREACH, "ENETUNREACH"),
158f009f72dSMichael Jones     MsgMapping(ENETRESET, "ENETRESET"),
159f009f72dSMichael Jones     MsgMapping(ECONNABORTED, "ECONNABORTED"),
160f009f72dSMichael Jones     MsgMapping(ECONNRESET, "ECONNRESET"),
161f009f72dSMichael Jones     MsgMapping(ENOBUFS, "ENOBUFS"),
162f009f72dSMichael Jones     MsgMapping(EISCONN, "EISCONN"),
163f009f72dSMichael Jones     MsgMapping(ENOTCONN, "ENOTCONN"),
164f009f72dSMichael Jones     MsgMapping(ETIMEDOUT, "ETIMEDOUT"),
165f009f72dSMichael Jones     MsgMapping(ECONNREFUSED, "ECONNREFUSED"),
166f009f72dSMichael Jones     MsgMapping(EHOSTUNREACH, "EHOSTUNREACH"),
167f009f72dSMichael Jones     MsgMapping(EALREADY, "EALREADY"),
168f009f72dSMichael Jones     MsgMapping(EINPROGRESS, "EINPROGRESS"),
169f009f72dSMichael Jones     MsgMapping(ESTALE, "ESTALE"),
170f009f72dSMichael Jones     MsgMapping(EDQUOT, "EDQUOT"),
171f009f72dSMichael Jones     MsgMapping(ECANCELED, "ECANCELED"),
172f009f72dSMichael Jones     MsgMapping(EOWNERDEAD, "EOWNERDEAD"),
173f009f72dSMichael Jones     MsgMapping(ENOTRECOVERABLE, "ENOTRECOVERABLE"),
174f009f72dSMichael Jones };
175f009f72dSMichael Jones 
1765ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
17725174976SSiva Chandra Reddy 
178330793c9SNick Desaulniers #endif // LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_POSIX_ERRORS_H
179