xref: /llvm-project/libc/src/__support/StringUtil/tables/posix_errors.h (revision 46944b0cbc9a9d8daad0182c40fcd3560bc9ca35)
1 //===-- Map of POSIX error numbers to strings -------------------*- C++ -*-===//
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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_POSIX_ERRORS_H
10 #define LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_POSIX_ERRORS_H
11 
12 #include "hdr/errno_macros.h"
13 #include "src/__support/StringUtil/message_mapper.h"
14 #include "src/__support/macros/config.h"
15 
16 namespace LIBC_NAMESPACE_DECL {
17 
18 LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRORS = {
19     MsgMapping(EPERM, "Operation not permitted"),
20     MsgMapping(ENOENT, "No such file or directory"),
21     MsgMapping(ESRCH, "No such process"),
22     MsgMapping(EINTR, "Interrupted system call"),
23     MsgMapping(EIO, "Input/output error"),
24     MsgMapping(ENXIO, "No such device or address"),
25     MsgMapping(E2BIG, "Argument list too long"),
26     MsgMapping(ENOEXEC, "Exec format error"),
27     MsgMapping(EBADF, "Bad file descriptor"),
28     MsgMapping(ECHILD, "No child processes"),
29     MsgMapping(EAGAIN, "Resource temporarily unavailable"),
30     MsgMapping(ENOMEM, "Cannot allocate memory"),
31     MsgMapping(EACCES, "Permission denied"),
32     MsgMapping(EFAULT, "Bad address"),
33     MsgMapping(EBUSY, "Device or resource busy"),
34     MsgMapping(EEXIST, "File exists"),
35     MsgMapping(EXDEV, "Invalid cross-device link"),
36     MsgMapping(ENODEV, "No such device"),
37     MsgMapping(ENOTDIR, "Not a directory"),
38     MsgMapping(EISDIR, "Is a directory"),
39     MsgMapping(EINVAL, "Invalid argument"),
40     MsgMapping(ENFILE, "Too many open files in system"),
41     MsgMapping(EMFILE, "Too many open files"),
42     MsgMapping(ENOTTY, "Inappropriate ioctl for device"),
43     MsgMapping(ETXTBSY, "Text file busy"),
44     MsgMapping(EFBIG, "File too large"),
45     MsgMapping(ENOSPC, "No space left on device"),
46     MsgMapping(ESPIPE, "Illegal seek"),
47     MsgMapping(EROFS, "Read-only file system"),
48     MsgMapping(EMLINK, "Too many links"),
49     MsgMapping(EPIPE, "Broken pipe"),
50     MsgMapping(EDEADLK, "Resource deadlock avoided"),
51     MsgMapping(ENAMETOOLONG, "File name too long"),
52     MsgMapping(ENOLCK, "No locks available"),
53     MsgMapping(ENOSYS, "Function not implemented"),
54     MsgMapping(ENOTEMPTY, "Directory not empty"),
55     MsgMapping(ELOOP, "Too many levels of symbolic links"),
56     MsgMapping(ENOMSG, "No message of desired type"),
57     MsgMapping(EIDRM, "Identifier removed"),
58     MsgMapping(ENOSTR, "Device not a stream"),
59     MsgMapping(ENODATA, "No data available"),
60     MsgMapping(ETIME, "Timer expired"),
61     MsgMapping(ENOSR, "Out of streams resources"),
62     MsgMapping(ENOLINK, "Link has been severed"),
63     MsgMapping(EPROTO, "Protocol error"),
64     MsgMapping(EMULTIHOP, "Multihop attempted"),
65     MsgMapping(EBADMSG, "Bad message"),
66     MsgMapping(EOVERFLOW, "Value too large for defined data type"),
67     MsgMapping(ENOTSOCK, "Socket operation on non-socket"),
68     MsgMapping(EDESTADDRREQ, "Destination address required"),
69     MsgMapping(EMSGSIZE, "Message too long"),
70     MsgMapping(EPROTOTYPE, "Protocol wrong type for socket"),
71     MsgMapping(ENOPROTOOPT, "Protocol not available"),
72     MsgMapping(EPROTONOSUPPORT, "Protocol not supported"),
73     MsgMapping(ENOTSUP, "Operation not supported"),
74     MsgMapping(EAFNOSUPPORT, "Address family not supported by protocol"),
75     MsgMapping(EADDRINUSE, "Address already in use"),
76     MsgMapping(EADDRNOTAVAIL, "Cannot assign requested address"),
77     MsgMapping(ENETDOWN, "Network is down"),
78     MsgMapping(ENETUNREACH, "Network is unreachable"),
79     MsgMapping(ENETRESET, "Network dropped connection on reset"),
80     MsgMapping(ECONNABORTED, "Software caused connection abort"),
81     MsgMapping(ECONNRESET, "Connection reset by peer"),
82     MsgMapping(ENOBUFS, "No buffer space available"),
83     MsgMapping(EISCONN, "Transport endpoint is already connected"),
84     MsgMapping(ENOTCONN, "Transport endpoint is not connected"),
85     MsgMapping(ETIMEDOUT, "Connection timed out"),
86     MsgMapping(ECONNREFUSED, "Connection refused"),
87     MsgMapping(EHOSTUNREACH, "No route to host"),
88     MsgMapping(EALREADY, "Operation already in progress"),
89     MsgMapping(EINPROGRESS, "Operation now in progress"),
90     MsgMapping(ESTALE, "Stale file handle"),
91     MsgMapping(EDQUOT, "Disk quota exceeded"),
92     MsgMapping(ECANCELED, "Operation canceled"),
93     MsgMapping(EOWNERDEAD, "Owner died"),
94     MsgMapping(ENOTRECOVERABLE, "State not recoverable"),
95 };
96 
97 LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRNO_NAMES = {
98     MsgMapping(EPERM, "EPERM"),
99     MsgMapping(ENOENT, "ENOENT"),
100     MsgMapping(ESRCH, "ESRCH"),
101     MsgMapping(EINTR, "EINTR"),
102     MsgMapping(EIO, "EIO"),
103     MsgMapping(ENXIO, "ENXIO"),
104     MsgMapping(E2BIG, "E2BIG"),
105     MsgMapping(ENOEXEC, "ENOEXEC"),
106     MsgMapping(EBADF, "EBADF"),
107     MsgMapping(ECHILD, "ECHILD"),
108     MsgMapping(EAGAIN, "EAGAIN"),
109     MsgMapping(ENOMEM, "ENOMEM"),
110     MsgMapping(EACCES, "EACCES"),
111     MsgMapping(EFAULT, "EFAULT"),
112     MsgMapping(EBUSY, "EBUSY"),
113     MsgMapping(EEXIST, "EEXIST"),
114     MsgMapping(EXDEV, "EXDEV"),
115     MsgMapping(ENODEV, "ENODEV"),
116     MsgMapping(ENOTDIR, "ENOTDIR"),
117     MsgMapping(EISDIR, "EISDIR"),
118     MsgMapping(EINVAL, "EINVAL"),
119     MsgMapping(ENFILE, "ENFILE"),
120     MsgMapping(EMFILE, "EMFILE"),
121     MsgMapping(ENOTTY, "ENOTTY"),
122     MsgMapping(ETXTBSY, "ETXTBSY"),
123     MsgMapping(EFBIG, "EFBIG"),
124     MsgMapping(ENOSPC, "ENOSPC"),
125     MsgMapping(ESPIPE, "ESPIPE"),
126     MsgMapping(EROFS, "EROFS"),
127     MsgMapping(EMLINK, "EMLINK"),
128     MsgMapping(EPIPE, "EPIPE"),
129     MsgMapping(EDEADLK, "EDEADLK"),
130     MsgMapping(ENAMETOOLONG, "ENAMETOOLONG"),
131     MsgMapping(ENOLCK, "ENOLCK"),
132     MsgMapping(ENOSYS, "ENOSYS"),
133     MsgMapping(ENOTEMPTY, "ENOTEMPTY"),
134     MsgMapping(ELOOP, "ELOOP"),
135     MsgMapping(ENOMSG, "ENOMSG"),
136     MsgMapping(EIDRM, "EIDRM"),
137     MsgMapping(ENOSTR, "ENOSTR"),
138     MsgMapping(ENODATA, "ENODATA"),
139     MsgMapping(ETIME, "ETIME"),
140     MsgMapping(ENOSR, "ENOSR"),
141     MsgMapping(ENOLINK, "ENOLINK"),
142     MsgMapping(EPROTO, "EPROTO"),
143     MsgMapping(EMULTIHOP, "EMULTIHOP"),
144     MsgMapping(EBADMSG, "EBADMSG"),
145     MsgMapping(EOVERFLOW, "EOVERFLOW"),
146     MsgMapping(ENOTSOCK, "ENOTSOCK"),
147     MsgMapping(EDESTADDRREQ, "EDESTADDRREQ"),
148     MsgMapping(EMSGSIZE, "EMSGSIZE"),
149     MsgMapping(EPROTOTYPE, "EPROTOTYPE"),
150     MsgMapping(ENOPROTOOPT, "ENOPROTOOPT"),
151     MsgMapping(EPROTONOSUPPORT, "EPROTONOSUPPORT"),
152     MsgMapping(ENOTSUP, "ENOTSUP"),
153     MsgMapping(EAFNOSUPPORT, "EAFNOSUPPORT"),
154     MsgMapping(EADDRINUSE, "EADDRINUSE"),
155     MsgMapping(EADDRNOTAVAIL, "EADDRNOTAVAIL"),
156     MsgMapping(ENETDOWN, "ENETDOWN"),
157     MsgMapping(ENETUNREACH, "ENETUNREACH"),
158     MsgMapping(ENETRESET, "ENETRESET"),
159     MsgMapping(ECONNABORTED, "ECONNABORTED"),
160     MsgMapping(ECONNRESET, "ECONNRESET"),
161     MsgMapping(ENOBUFS, "ENOBUFS"),
162     MsgMapping(EISCONN, "EISCONN"),
163     MsgMapping(ENOTCONN, "ENOTCONN"),
164     MsgMapping(ETIMEDOUT, "ETIMEDOUT"),
165     MsgMapping(ECONNREFUSED, "ECONNREFUSED"),
166     MsgMapping(EHOSTUNREACH, "EHOSTUNREACH"),
167     MsgMapping(EALREADY, "EALREADY"),
168     MsgMapping(EINPROGRESS, "EINPROGRESS"),
169     MsgMapping(ESTALE, "ESTALE"),
170     MsgMapping(EDQUOT, "EDQUOT"),
171     MsgMapping(ECANCELED, "ECANCELED"),
172     MsgMapping(EOWNERDEAD, "EOWNERDEAD"),
173     MsgMapping(ENOTRECOVERABLE, "ENOTRECOVERABLE"),
174 };
175 
176 } // namespace LIBC_NAMESPACE_DECL
177 
178 #endif // LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_POSIX_ERRORS_H
179