xref: /freebsd/lib/libc/gen/errlst.c (revision 02e9120893770924227138ba49df1edb3896112a)
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright (c) 1982, 1985, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the University nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  */
31 
32 #include <errno.h>
33 #include <stdio.h>
34 #include "errlst.h"
35 
36 const char __uprefix[] = "Unknown error";
37 
38 const char *const sys_errlist[] = {
39 	"No error: 0",				/*  0 - ENOERROR */
40 	"Operation not permitted",		/*  1 - EPERM */
41 	"No such file or directory",		/*  2 - ENOENT */
42 	"No such process",			/*  3 - ESRCH */
43 	"Interrupted system call",		/*  4 - EINTR */
44 	"Input/output error",			/*  5 - EIO */
45 	"Device not configured",		/*  6 - ENXIO */
46 	"Argument list too long",		/*  7 - E2BIG */
47 	"Exec format error",			/*  8 - ENOEXEC */
48 	"Bad file descriptor",			/*  9 - EBADF */
49 	"No child processes",			/* 10 - ECHILD */
50 	"Resource deadlock avoided",		/* 11 - EDEADLK */
51 	"Cannot allocate memory",		/* 12 - ENOMEM */
52 	"Permission denied",			/* 13 - EACCES */
53 	"Bad address",				/* 14 - EFAULT */
54 	"Block device required",		/* 15 - ENOTBLK */
55 	"Device busy",				/* 16 - EBUSY */
56 	"File exists",				/* 17 - EEXIST */
57 	"Cross-device link",			/* 18 - EXDEV */
58 	"Operation not supported by device",	/* 19 - ENODEV */
59 	"Not a directory",			/* 20 - ENOTDIR */
60 	"Is a directory",			/* 21 - EISDIR */
61 	"Invalid argument",			/* 22 - EINVAL */
62 	"Too many open files in system",	/* 23 - ENFILE */
63 	"Too many open files",			/* 24 - EMFILE */
64 	"Inappropriate ioctl for device",	/* 25 - ENOTTY */
65 	"Text file busy",			/* 26 - ETXTBSY */
66 	"File too large",			/* 27 - EFBIG */
67 	"No space left on device",		/* 28 - ENOSPC */
68 	"Illegal seek",				/* 29 - ESPIPE */
69 	"Read-only file system",		/* 30 - EROFS */
70 	"Too many links",			/* 31 - EMLINK */
71 	"Broken pipe",				/* 32 - EPIPE */
72 
73 /* math software */
74 	"Numerical argument out of domain",	/* 33 - EDOM */
75 	"Result too large",			/* 34 - ERANGE */
76 
77 /* non-blocking and interrupt i/o */
78 	"Resource temporarily unavailable",	/* 35 - EAGAIN */
79 						/* 35 - EWOULDBLOCK */
80 	"Operation now in progress",		/* 36 - EINPROGRESS */
81 	"Operation already in progress",	/* 37 - EALREADY */
82 
83 /* ipc/network software -- argument errors */
84 	"Socket operation on non-socket",	/* 38 - ENOTSOCK */
85 	"Destination address required",		/* 39 - EDESTADDRREQ */
86 	"Message too long",			/* 40 - EMSGSIZE */
87 	"Protocol wrong type for socket",	/* 41 - EPROTOTYPE */
88 	"Protocol not available",		/* 42 - ENOPROTOOPT */
89 	"Protocol not supported",		/* 43 - EPROTONOSUPPORT */
90 	"Socket type not supported",		/* 44 - ESOCKTNOSUPPORT */
91 	"Operation not supported",		/* 45 - EOPNOTSUPP */
92 	"Protocol family not supported",	/* 46 - EPFNOSUPPORT */
93 						/* 47 - EAFNOSUPPORT */
94 	"Address family not supported by protocol family",
95 	"Address already in use",		/* 48 - EADDRINUSE */
96 	"Can't assign requested address",	/* 49 - EADDRNOTAVAIL */
97 
98 /* ipc/network software -- operational errors */
99 	"Network is down",			/* 50 - ENETDOWN */
100 	"Network is unreachable",		/* 51 - ENETUNREACH */
101 	"Network dropped connection on reset",	/* 52 - ENETRESET */
102 	"Software caused connection abort",	/* 53 - ECONNABORTED */
103 	"Connection reset by peer",		/* 54 - ECONNRESET */
104 	"No buffer space available",		/* 55 - ENOBUFS */
105 	"Socket is already connected",		/* 56 - EISCONN */
106 	"Socket is not connected",		/* 57 - ENOTCONN */
107 	"Can't send after socket shutdown",	/* 58 - ESHUTDOWN */
108 	"Too many references: can't splice",	/* 59 - ETOOMANYREFS */
109 	"Operation timed out",			/* 60 - ETIMEDOUT */
110 	"Connection refused",			/* 61 - ECONNREFUSED */
111 
112 	"Too many levels of symbolic links",	/* 62 - ELOOP */
113 	"File name too long",			/* 63 - ENAMETOOLONG */
114 
115 /* should be rearranged */
116 	"Host is down",				/* 64 - EHOSTDOWN */
117 	"No route to host",			/* 65 - EHOSTUNREACH */
118 	"Directory not empty",			/* 66 - ENOTEMPTY */
119 
120 /* quotas & mush */
121 	"Too many processes",			/* 67 - EPROCLIM */
122 	"Too many users",			/* 68 - EUSERS */
123 	"Disc quota exceeded",			/* 69 - EDQUOT */
124 
125 /* Network File System */
126 	"Stale NFS file handle",		/* 70 - ESTALE */
127 	"Too many levels of remote in path",	/* 71 - EREMOTE */
128 	"RPC struct is bad",			/* 72 - EBADRPC */
129 	"RPC version wrong",			/* 73 - ERPCMISMATCH */
130 	"RPC prog. not avail",			/* 74 - EPROGUNAVAIL */
131 	"Program version wrong",		/* 75 - EPROGMISMATCH */
132 	"Bad procedure for program",		/* 76 - EPROCUNAVAIL */
133 
134 	"No locks available",			/* 77 - ENOLCK */
135 	"Function not implemented",		/* 78 - ENOSYS */
136 	"Inappropriate file type or format",	/* 79 - EFTYPE */
137 	"Authentication error",			/* 80 - EAUTH */
138 	"Need authenticator",			/* 81 - ENEEDAUTH */
139 	"Identifier removed",			/* 82 - EIDRM */
140 	"No message of desired type",		/* 83 - ENOMSG */
141 	"Value too large to be stored in data type", /* 84 - EOVERFLOW */
142 	"Operation canceled",			/* 85 - ECANCELED */
143 	"Illegal byte sequence",		/* 86 - EILSEQ */
144 	"Attribute not found",			/* 87 - ENOATTR */
145 
146 /* General */
147 	"Programming error",			/* 88 - EDOOFUS */
148 
149 	"Bad message",				/* 89 - EBADMSG */
150 	"Multihop attempted",			/* 90 - EMULTIHOP */
151 	"Link has been severed",		/* 91 - ENOLINK */
152 	"Protocol error",			/* 92 - EPROTO */
153 	"Capabilities insufficient",		/* 93 - ENOTCAPABLE */
154 	"Not permitted in capability mode",	/* 94 - ECAPMODE */
155 	"State not recoverable",		/* 95 - ENOTRECOVERABLE */
156 	"Previous owner died",			/* 96 - EOWNERDEAD */
157 	"Integrity check failed",		/* 97 - EINTEGRITY */
158 
159 /*
160  * Reserved space in sys_errlist, take the next slot for a next error code.
161  * Reserve prevents the array size from changing for some time.
162  */
163 	__uprefix,				/* 98 */
164 	__uprefix,				/* 99 */
165 	__uprefix,				/* 100 */
166 	__uprefix,				/* 101 */
167 	__uprefix,				/* 102 */
168 	__uprefix,				/* 103 */
169 	__uprefix,				/* 104 */
170 	__uprefix,				/* 105 */
171 	__uprefix,				/* 106 */
172 	__uprefix,				/* 107 */
173 	__uprefix,				/* 108 */
174 	__uprefix,				/* 109 */
175 	__uprefix,				/* 110 */
176 	__uprefix,				/* 111 */
177 	__uprefix,				/* 112 */
178 	__uprefix,				/* 113 */
179 	__uprefix,				/* 114 */
180 	__uprefix,				/* 115 */
181 	__uprefix,				/* 116 */
182 	__uprefix,				/* 117 */
183 	__uprefix,				/* 118 */
184 	__uprefix,				/* 119 */
185 	__uprefix,				/* 120 */
186 	__uprefix,				/* 121 */
187 	__uprefix,				/* 122 */
188 	__uprefix,				/* 123 */
189 	__uprefix,				/* 124 */
190 	__uprefix,				/* 125 */
191 	__uprefix,				/* 126 */
192 	__uprefix,				/* 127 */
193 	__uprefix,				/* 128 */
194 	__uprefix,				/* 129 */
195 	__uprefix,				/* 130 */
196 	__uprefix,				/* 131 */
197 	__uprefix,				/* 132 */
198 	__uprefix,				/* 133 */
199 	__uprefix,				/* 134 */
200 	__uprefix,				/* 135 */
201 	__uprefix,				/* 136 */
202 	__uprefix,				/* 137 */
203 	__uprefix,				/* 138 */
204 	__uprefix,				/* 139 */
205 	__uprefix,				/* 140 */
206 	__uprefix,				/* 141 */
207 	__uprefix,				/* 142 */
208 	__uprefix,				/* 143 */
209 	__uprefix,				/* 144 */
210 	__uprefix,				/* 145 */
211 	__uprefix,				/* 146 */
212 	__uprefix,				/* 147 */
213 	__uprefix,				/* 148 */
214 	__uprefix,				/* 149 */
215 	__uprefix,				/* 150 */
216 };
217 const int sys_nerr = ELAST + 1;
218 
219 #ifdef PIC
220 __strong_reference(sys_errlist, __hidden_sys_errlist);
221 __strong_reference(sys_nerr, __hidden_sys_nerr);
222 #endif
223