xref: /freebsd/lib/libc/gen/errlst.c (revision dd41de95a84d979615a2ef11df6850622bf6184e)
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 <sys/cdefs.h>
33 __SCCSID("@(#)errlst.c	8.2 (Berkeley) 11/16/93");
34 __FBSDID("$FreeBSD$");
35 
36 #include <errno.h>
37 #include <stdio.h>
38 #include "errlst.h"
39 
40 const char __uprefix[] = "Unknown error";
41 
42 const char *const sys_errlist[] = {
43 	"No error: 0",				/*  0 - ENOERROR */
44 	"Operation not permitted",		/*  1 - EPERM */
45 	"No such file or directory",		/*  2 - ENOENT */
46 	"No such process",			/*  3 - ESRCH */
47 	"Interrupted system call",		/*  4 - EINTR */
48 	"Input/output error",			/*  5 - EIO */
49 	"Device not configured",		/*  6 - ENXIO */
50 	"Argument list too long",		/*  7 - E2BIG */
51 	"Exec format error",			/*  8 - ENOEXEC */
52 	"Bad file descriptor",			/*  9 - EBADF */
53 	"No child processes",			/* 10 - ECHILD */
54 	"Resource deadlock avoided",		/* 11 - EDEADLK */
55 	"Cannot allocate memory",		/* 12 - ENOMEM */
56 	"Permission denied",			/* 13 - EACCES */
57 	"Bad address",				/* 14 - EFAULT */
58 	"Block device required",		/* 15 - ENOTBLK */
59 	"Device busy",				/* 16 - EBUSY */
60 	"File exists",				/* 17 - EEXIST */
61 	"Cross-device link",			/* 18 - EXDEV */
62 	"Operation not supported by device",	/* 19 - ENODEV */
63 	"Not a directory",			/* 20 - ENOTDIR */
64 	"Is a directory",			/* 21 - EISDIR */
65 	"Invalid argument",			/* 22 - EINVAL */
66 	"Too many open files in system",	/* 23 - ENFILE */
67 	"Too many open files",			/* 24 - EMFILE */
68 	"Inappropriate ioctl for device",	/* 25 - ENOTTY */
69 	"Text file busy",			/* 26 - ETXTBSY */
70 	"File too large",			/* 27 - EFBIG */
71 	"No space left on device",		/* 28 - ENOSPC */
72 	"Illegal seek",				/* 29 - ESPIPE */
73 	"Read-only file system",		/* 30 - EROFS */
74 	"Too many links",			/* 31 - EMLINK */
75 	"Broken pipe",				/* 32 - EPIPE */
76 
77 /* math software */
78 	"Numerical argument out of domain",	/* 33 - EDOM */
79 	"Result too large",			/* 34 - ERANGE */
80 
81 /* non-blocking and interrupt i/o */
82 	"Resource temporarily unavailable",	/* 35 - EAGAIN */
83 						/* 35 - EWOULDBLOCK */
84 	"Operation now in progress",		/* 36 - EINPROGRESS */
85 	"Operation already in progress",	/* 37 - EALREADY */
86 
87 /* ipc/network software -- argument errors */
88 	"Socket operation on non-socket",	/* 38 - ENOTSOCK */
89 	"Destination address required",		/* 39 - EDESTADDRREQ */
90 	"Message too long",			/* 40 - EMSGSIZE */
91 	"Protocol wrong type for socket",	/* 41 - EPROTOTYPE */
92 	"Protocol not available",		/* 42 - ENOPROTOOPT */
93 	"Protocol not supported",		/* 43 - EPROTONOSUPPORT */
94 	"Socket type not supported",		/* 44 - ESOCKTNOSUPPORT */
95 	"Operation not supported",		/* 45 - EOPNOTSUPP */
96 	"Protocol family not supported",	/* 46 - EPFNOSUPPORT */
97 						/* 47 - EAFNOSUPPORT */
98 	"Address family not supported by protocol family",
99 	"Address already in use",		/* 48 - EADDRINUSE */
100 	"Can't assign requested address",	/* 49 - EADDRNOTAVAIL */
101 
102 /* ipc/network software -- operational errors */
103 	"Network is down",			/* 50 - ENETDOWN */
104 	"Network is unreachable",		/* 51 - ENETUNREACH */
105 	"Network dropped connection on reset",	/* 52 - ENETRESET */
106 	"Software caused connection abort",	/* 53 - ECONNABORTED */
107 	"Connection reset by peer",		/* 54 - ECONNRESET */
108 	"No buffer space available",		/* 55 - ENOBUFS */
109 	"Socket is already connected",		/* 56 - EISCONN */
110 	"Socket is not connected",		/* 57 - ENOTCONN */
111 	"Can't send after socket shutdown",	/* 58 - ESHUTDOWN */
112 	"Too many references: can't splice",	/* 59 - ETOOMANYREFS */
113 	"Operation timed out",			/* 60 - ETIMEDOUT */
114 	"Connection refused",			/* 61 - ECONNREFUSED */
115 
116 	"Too many levels of symbolic links",	/* 62 - ELOOP */
117 	"File name too long",			/* 63 - ENAMETOOLONG */
118 
119 /* should be rearranged */
120 	"Host is down",				/* 64 - EHOSTDOWN */
121 	"No route to host",			/* 65 - EHOSTUNREACH */
122 	"Directory not empty",			/* 66 - ENOTEMPTY */
123 
124 /* quotas & mush */
125 	"Too many processes",			/* 67 - EPROCLIM */
126 	"Too many users",			/* 68 - EUSERS */
127 	"Disc quota exceeded",			/* 69 - EDQUOT */
128 
129 /* Network File System */
130 	"Stale NFS file handle",		/* 70 - ESTALE */
131 	"Too many levels of remote in path",	/* 71 - EREMOTE */
132 	"RPC struct is bad",			/* 72 - EBADRPC */
133 	"RPC version wrong",			/* 73 - ERPCMISMATCH */
134 	"RPC prog. not avail",			/* 74 - EPROGUNAVAIL */
135 	"Program version wrong",		/* 75 - EPROGMISMATCH */
136 	"Bad procedure for program",		/* 76 - EPROCUNAVAIL */
137 
138 	"No locks available",			/* 77 - ENOLCK */
139 	"Function not implemented",		/* 78 - ENOSYS */
140 	"Inappropriate file type or format",	/* 79 - EFTYPE */
141 	"Authentication error",			/* 80 - EAUTH */
142 	"Need authenticator",			/* 81 - ENEEDAUTH */
143 	"Identifier removed",			/* 82 - EIDRM */
144 	"No message of desired type",		/* 83 - ENOMSG */
145 	"Value too large to be stored in data type", /* 84 - EOVERFLOW */
146 	"Operation canceled",			/* 85 - ECANCELED */
147 	"Illegal byte sequence",		/* 86 - EILSEQ */
148 	"Attribute not found",			/* 87 - ENOATTR */
149 
150 /* General */
151 	"Programming error",			/* 88 - EDOOFUS */
152 
153 	"Bad message",				/* 89 - EBADMSG */
154 	"Multihop attempted",			/* 90 - EMULTIHOP */
155 	"Link has been severed",		/* 91 - ENOLINK */
156 	"Protocol error",			/* 92 - EPROTO */
157 	"Capabilities insufficient",		/* 93 - ENOTCAPABLE */
158 	"Not permitted in capability mode",	/* 94 - ECAPMODE */
159 	"State not recoverable",		/* 95 - ENOTRECOVERABLE */
160 	"Previous owner died",			/* 96 - EOWNERDEAD */
161 	"Integrity check failed",		/* 97 - EINTEGRITY */
162 
163 /*
164  * Reserved space in sys_errlist, take the next slot for a next error code.
165  * Reserve prevents the array size from changing for some time.
166  */
167 	__uprefix,				/* 98 */
168 	__uprefix,				/* 99 */
169 	__uprefix,				/* 100 */
170 	__uprefix,				/* 101 */
171 	__uprefix,				/* 102 */
172 	__uprefix,				/* 103 */
173 	__uprefix,				/* 104 */
174 	__uprefix,				/* 105 */
175 	__uprefix,				/* 106 */
176 	__uprefix,				/* 107 */
177 	__uprefix,				/* 108 */
178 	__uprefix,				/* 109 */
179 	__uprefix,				/* 110 */
180 	__uprefix,				/* 111 */
181 	__uprefix,				/* 112 */
182 	__uprefix,				/* 113 */
183 	__uprefix,				/* 114 */
184 	__uprefix,				/* 115 */
185 	__uprefix,				/* 116 */
186 	__uprefix,				/* 117 */
187 	__uprefix,				/* 118 */
188 	__uprefix,				/* 119 */
189 	__uprefix,				/* 120 */
190 	__uprefix,				/* 121 */
191 	__uprefix,				/* 122 */
192 	__uprefix,				/* 123 */
193 	__uprefix,				/* 124 */
194 	__uprefix,				/* 125 */
195 	__uprefix,				/* 126 */
196 	__uprefix,				/* 127 */
197 	__uprefix,				/* 128 */
198 	__uprefix,				/* 129 */
199 	__uprefix,				/* 130 */
200 	__uprefix,				/* 131 */
201 	__uprefix,				/* 132 */
202 	__uprefix,				/* 133 */
203 	__uprefix,				/* 134 */
204 	__uprefix,				/* 135 */
205 	__uprefix,				/* 136 */
206 	__uprefix,				/* 137 */
207 	__uprefix,				/* 138 */
208 	__uprefix,				/* 139 */
209 	__uprefix,				/* 140 */
210 	__uprefix,				/* 141 */
211 	__uprefix,				/* 142 */
212 	__uprefix,				/* 143 */
213 	__uprefix,				/* 144 */
214 	__uprefix,				/* 145 */
215 	__uprefix,				/* 146 */
216 	__uprefix,				/* 147 */
217 	__uprefix,				/* 148 */
218 	__uprefix,				/* 149 */
219 	__uprefix,				/* 150 */
220 };
221 const int sys_nerr = ELAST + 1;
222 
223 #ifdef PIC
224 __strong_reference(sys_errlist, __hidden_sys_errlist);
225 __strong_reference(sys_nerr, __hidden_sys_nerr);
226 #endif
227