xref: /freebsd/lib/libc/gen/errlst.c (revision cd49e866fcf9b07db5e0e79c2ed8b07e4e21a9c1)
18a16b7a1SPedro F. Giffuni /*-
28a16b7a1SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
38a16b7a1SPedro F. Giffuni  *
458f0484fSRodney W. Grimes  * Copyright (c) 1982, 1985, 1993
558f0484fSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
658f0484fSRodney W. Grimes  *
758f0484fSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
858f0484fSRodney W. Grimes  * modification, are permitted provided that the following conditions
958f0484fSRodney W. Grimes  * are met:
1058f0484fSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
1158f0484fSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
1258f0484fSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
1358f0484fSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
1458f0484fSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
15fbbd9655SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
1658f0484fSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
1758f0484fSRodney W. Grimes  *    without specific prior written permission.
1858f0484fSRodney W. Grimes  *
1958f0484fSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2058f0484fSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2158f0484fSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2258f0484fSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2358f0484fSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2458f0484fSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2558f0484fSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2658f0484fSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2758f0484fSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2858f0484fSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2958f0484fSRodney W. Grimes  * SUCH DAMAGE.
3058f0484fSRodney W. Grimes  */
3158f0484fSRodney W. Grimes 
32333fc21eSDavid E. O'Brien #include <sys/cdefs.h>
33c1920558SJohn Baldwin __SCCSID("@(#)errlst.c	8.2 (Berkeley) 11/16/93");
34333fc21eSDavid E. O'Brien __FBSDID("$FreeBSD$");
3558f0484fSRodney W. Grimes 
36*cd49e866SKonstantin Belousov #include <errno.h>
3758f0484fSRodney W. Grimes #include <stdio.h>
38e73151ebSJilles Tjoelker #include "errlst.h"
3958f0484fSRodney W. Grimes 
40*cd49e866SKonstantin Belousov const char __uprefix[] = "Unknown error";
41*cd49e866SKonstantin Belousov 
4258f0484fSRodney W. Grimes const char *const sys_errlist[] = {
4329730574SJilles Tjoelker 	"No error: 0",				/*  0 - ENOERROR */
4458f0484fSRodney W. Grimes 	"Operation not permitted",		/*  1 - EPERM */
4558f0484fSRodney W. Grimes 	"No such file or directory",		/*  2 - ENOENT */
4658f0484fSRodney W. Grimes 	"No such process",			/*  3 - ESRCH */
4758f0484fSRodney W. Grimes 	"Interrupted system call",		/*  4 - EINTR */
4858f0484fSRodney W. Grimes 	"Input/output error",			/*  5 - EIO */
4958f0484fSRodney W. Grimes 	"Device not configured",		/*  6 - ENXIO */
5058f0484fSRodney W. Grimes 	"Argument list too long",		/*  7 - E2BIG */
5158f0484fSRodney W. Grimes 	"Exec format error",			/*  8 - ENOEXEC */
5258f0484fSRodney W. Grimes 	"Bad file descriptor",			/*  9 - EBADF */
5358f0484fSRodney W. Grimes 	"No child processes",			/* 10 - ECHILD */
5458f0484fSRodney W. Grimes 	"Resource deadlock avoided",		/* 11 - EDEADLK */
5558f0484fSRodney W. Grimes 	"Cannot allocate memory",		/* 12 - ENOMEM */
5658f0484fSRodney W. Grimes 	"Permission denied",			/* 13 - EACCES */
5758f0484fSRodney W. Grimes 	"Bad address",				/* 14 - EFAULT */
5858f0484fSRodney W. Grimes 	"Block device required",		/* 15 - ENOTBLK */
5958f0484fSRodney W. Grimes 	"Device busy",				/* 16 - EBUSY */
6058f0484fSRodney W. Grimes 	"File exists",				/* 17 - EEXIST */
6158f0484fSRodney W. Grimes 	"Cross-device link",			/* 18 - EXDEV */
6258f0484fSRodney W. Grimes 	"Operation not supported by device",	/* 19 - ENODEV */
6358f0484fSRodney W. Grimes 	"Not a directory",			/* 20 - ENOTDIR */
6458f0484fSRodney W. Grimes 	"Is a directory",			/* 21 - EISDIR */
6558f0484fSRodney W. Grimes 	"Invalid argument",			/* 22 - EINVAL */
6658f0484fSRodney W. Grimes 	"Too many open files in system",	/* 23 - ENFILE */
6758f0484fSRodney W. Grimes 	"Too many open files",			/* 24 - EMFILE */
6858f0484fSRodney W. Grimes 	"Inappropriate ioctl for device",	/* 25 - ENOTTY */
6958f0484fSRodney W. Grimes 	"Text file busy",			/* 26 - ETXTBSY */
7058f0484fSRodney W. Grimes 	"File too large",			/* 27 - EFBIG */
7158f0484fSRodney W. Grimes 	"No space left on device",		/* 28 - ENOSPC */
7258f0484fSRodney W. Grimes 	"Illegal seek",				/* 29 - ESPIPE */
7358f0484fSRodney W. Grimes 	"Read-only file system",		/* 30 - EROFS */
7458f0484fSRodney W. Grimes 	"Too many links",			/* 31 - EMLINK */
7558f0484fSRodney W. Grimes 	"Broken pipe",				/* 32 - EPIPE */
7658f0484fSRodney W. Grimes 
7758f0484fSRodney W. Grimes /* math software */
7858f0484fSRodney W. Grimes 	"Numerical argument out of domain",	/* 33 - EDOM */
7958f0484fSRodney W. Grimes 	"Result too large",			/* 34 - ERANGE */
8058f0484fSRodney W. Grimes 
8158f0484fSRodney W. Grimes /* non-blocking and interrupt i/o */
8258f0484fSRodney W. Grimes 	"Resource temporarily unavailable",	/* 35 - EAGAIN */
8358f0484fSRodney W. Grimes 						/* 35 - EWOULDBLOCK */
8458f0484fSRodney W. Grimes 	"Operation now in progress",		/* 36 - EINPROGRESS */
8558f0484fSRodney W. Grimes 	"Operation already in progress",	/* 37 - EALREADY */
8658f0484fSRodney W. Grimes 
8758f0484fSRodney W. Grimes /* ipc/network software -- argument errors */
8858f0484fSRodney W. Grimes 	"Socket operation on non-socket",	/* 38 - ENOTSOCK */
8958f0484fSRodney W. Grimes 	"Destination address required",		/* 39 - EDESTADDRREQ */
9058f0484fSRodney W. Grimes 	"Message too long",			/* 40 - EMSGSIZE */
9158f0484fSRodney W. Grimes 	"Protocol wrong type for socket",	/* 41 - EPROTOTYPE */
9258f0484fSRodney W. Grimes 	"Protocol not available",		/* 42 - ENOPROTOOPT */
9358f0484fSRodney W. Grimes 	"Protocol not supported",		/* 43 - EPROTONOSUPPORT */
9458f0484fSRodney W. Grimes 	"Socket type not supported",		/* 44 - ESOCKTNOSUPPORT */
9558f0484fSRodney W. Grimes 	"Operation not supported",		/* 45 - EOPNOTSUPP */
9658f0484fSRodney W. Grimes 	"Protocol family not supported",	/* 46 - EPFNOSUPPORT */
9758f0484fSRodney W. Grimes 						/* 47 - EAFNOSUPPORT */
9858f0484fSRodney W. Grimes 	"Address family not supported by protocol family",
9958f0484fSRodney W. Grimes 	"Address already in use",		/* 48 - EADDRINUSE */
10058f0484fSRodney W. Grimes 	"Can't assign requested address",	/* 49 - EADDRNOTAVAIL */
10158f0484fSRodney W. Grimes 
10258f0484fSRodney W. Grimes /* ipc/network software -- operational errors */
10358f0484fSRodney W. Grimes 	"Network is down",			/* 50 - ENETDOWN */
10458f0484fSRodney W. Grimes 	"Network is unreachable",		/* 51 - ENETUNREACH */
10558f0484fSRodney W. Grimes 	"Network dropped connection on reset",	/* 52 - ENETRESET */
10658f0484fSRodney W. Grimes 	"Software caused connection abort",	/* 53 - ECONNABORTED */
10758f0484fSRodney W. Grimes 	"Connection reset by peer",		/* 54 - ECONNRESET */
10858f0484fSRodney W. Grimes 	"No buffer space available",		/* 55 - ENOBUFS */
10958f0484fSRodney W. Grimes 	"Socket is already connected",		/* 56 - EISCONN */
11058f0484fSRodney W. Grimes 	"Socket is not connected",		/* 57 - ENOTCONN */
11158f0484fSRodney W. Grimes 	"Can't send after socket shutdown",	/* 58 - ESHUTDOWN */
11258f0484fSRodney W. Grimes 	"Too many references: can't splice",	/* 59 - ETOOMANYREFS */
11358f0484fSRodney W. Grimes 	"Operation timed out",			/* 60 - ETIMEDOUT */
11458f0484fSRodney W. Grimes 	"Connection refused",			/* 61 - ECONNREFUSED */
11558f0484fSRodney W. Grimes 
11658f0484fSRodney W. Grimes 	"Too many levels of symbolic links",	/* 62 - ELOOP */
11758f0484fSRodney W. Grimes 	"File name too long",			/* 63 - ENAMETOOLONG */
11858f0484fSRodney W. Grimes 
11958f0484fSRodney W. Grimes /* should be rearranged */
12058f0484fSRodney W. Grimes 	"Host is down",				/* 64 - EHOSTDOWN */
12158f0484fSRodney W. Grimes 	"No route to host",			/* 65 - EHOSTUNREACH */
12258f0484fSRodney W. Grimes 	"Directory not empty",			/* 66 - ENOTEMPTY */
12358f0484fSRodney W. Grimes 
12458f0484fSRodney W. Grimes /* quotas & mush */
12558f0484fSRodney W. Grimes 	"Too many processes",			/* 67 - EPROCLIM */
12658f0484fSRodney W. Grimes 	"Too many users",			/* 68 - EUSERS */
12758f0484fSRodney W. Grimes 	"Disc quota exceeded",			/* 69 - EDQUOT */
12858f0484fSRodney W. Grimes 
12958f0484fSRodney W. Grimes /* Network File System */
13058f0484fSRodney W. Grimes 	"Stale NFS file handle",		/* 70 - ESTALE */
13158f0484fSRodney W. Grimes 	"Too many levels of remote in path",	/* 71 - EREMOTE */
13258f0484fSRodney W. Grimes 	"RPC struct is bad",			/* 72 - EBADRPC */
13358f0484fSRodney W. Grimes 	"RPC version wrong",			/* 73 - ERPCMISMATCH */
13458f0484fSRodney W. Grimes 	"RPC prog. not avail",			/* 74 - EPROGUNAVAIL */
13558f0484fSRodney W. Grimes 	"Program version wrong",		/* 75 - EPROGMISMATCH */
13658f0484fSRodney W. Grimes 	"Bad procedure for program",		/* 76 - EPROCUNAVAIL */
13758f0484fSRodney W. Grimes 
13858f0484fSRodney W. Grimes 	"No locks available",			/* 77 - ENOLCK */
13958f0484fSRodney W. Grimes 	"Function not implemented",		/* 78 - ENOSYS */
14058f0484fSRodney W. Grimes 	"Inappropriate file type or format",	/* 79 - EFTYPE */
14100c7dcf6SPoul-Henning Kamp 	"Authentication error",			/* 80 - EAUTH */
14200c7dcf6SPoul-Henning Kamp 	"Need authenticator",			/* 81 - ENEEDAUTH */
14300c7dcf6SPoul-Henning Kamp 	"Identifier removed",			/* 82 - EIDRM */
14400c7dcf6SPoul-Henning Kamp 	"No message of desired type",		/* 83 - ENOMSG */
14500c7dcf6SPoul-Henning Kamp 	"Value too large to be stored in data type", /* 84 - EOVERFLOW */
14600c7dcf6SPoul-Henning Kamp 	"Operation canceled",			/* 85 - ECANCELED */
14700c7dcf6SPoul-Henning Kamp 	"Illegal byte sequence",		/* 86 - EILSEQ */
1489d9737ecSBrian Feldman 	"Attribute not found",			/* 87 - ENOATTR */
1499d6d1ee6SPoul-Henning Kamp 
1509d6d1ee6SPoul-Henning Kamp /* General */
151bb7d71b9SPoul-Henning Kamp 	"Programming error",			/* 88 - EDOOFUS */
1525e9b87a8SDavid Schultz 
1535e9b87a8SDavid Schultz 	"Bad message",				/* 89 - EBADMSG */
1545e9b87a8SDavid Schultz 	"Multihop attempted",			/* 90 - EMULTIHOP */
1555e9b87a8SDavid Schultz 	"Link has been severed",		/* 91 - ENOLINK */
1565e9b87a8SDavid Schultz 	"Protocol error",			/* 92 - EPROTO */
15744a43f00SRobert Watson 	"Capabilities insufficient",		/* 93 - ENOTCAPABLE */
158b70ad7a8SRobert Watson 	"Not permitted in capability mode",	/* 94 - ECAPMODE */
159e0906c9aSSergey Kandaurov 	"State not recoverable",		/* 95 - ENOTRECOVERABLE */
160e0906c9aSSergey Kandaurov 	"Previous owner died",			/* 96 - EOWNERDEAD */
161*cd49e866SKonstantin Belousov 
162*cd49e866SKonstantin Belousov /*
163*cd49e866SKonstantin Belousov  * Reserved space in sys_errlist, take the next slot for a next error code.
164*cd49e866SKonstantin Belousov  * Reserve prevents the array size from changing for some time.
165*cd49e866SKonstantin Belousov  */
166*cd49e866SKonstantin Belousov 	__uprefix,				/* 97 */
167*cd49e866SKonstantin Belousov 	__uprefix,				/* 98 */
168*cd49e866SKonstantin Belousov 	__uprefix,				/* 99 */
169*cd49e866SKonstantin Belousov 	__uprefix,				/* 100 */
170*cd49e866SKonstantin Belousov 	__uprefix,				/* 101 */
171*cd49e866SKonstantin Belousov 	__uprefix,				/* 102 */
172*cd49e866SKonstantin Belousov 	__uprefix,				/* 103 */
173*cd49e866SKonstantin Belousov 	__uprefix,				/* 104 */
174*cd49e866SKonstantin Belousov 	__uprefix,				/* 105 */
175*cd49e866SKonstantin Belousov 	__uprefix,				/* 106 */
176*cd49e866SKonstantin Belousov 	__uprefix,				/* 107 */
177*cd49e866SKonstantin Belousov 	__uprefix,				/* 108 */
178*cd49e866SKonstantin Belousov 	__uprefix,				/* 109 */
179*cd49e866SKonstantin Belousov 	__uprefix,				/* 110 */
180*cd49e866SKonstantin Belousov 	__uprefix,				/* 111 */
181*cd49e866SKonstantin Belousov 	__uprefix,				/* 112 */
182*cd49e866SKonstantin Belousov 	__uprefix,				/* 113 */
183*cd49e866SKonstantin Belousov 	__uprefix,				/* 114 */
184*cd49e866SKonstantin Belousov 	__uprefix,				/* 115 */
185*cd49e866SKonstantin Belousov 	__uprefix,				/* 116 */
186*cd49e866SKonstantin Belousov 	__uprefix,				/* 117 */
187*cd49e866SKonstantin Belousov 	__uprefix,				/* 118 */
188*cd49e866SKonstantin Belousov 	__uprefix,				/* 119 */
189*cd49e866SKonstantin Belousov 	__uprefix,				/* 120 */
190*cd49e866SKonstantin Belousov 	__uprefix,				/* 121 */
191*cd49e866SKonstantin Belousov 	__uprefix,				/* 122 */
192*cd49e866SKonstantin Belousov 	__uprefix,				/* 123 */
193*cd49e866SKonstantin Belousov 	__uprefix,				/* 124 */
194*cd49e866SKonstantin Belousov 	__uprefix,				/* 125 */
195*cd49e866SKonstantin Belousov 	__uprefix,				/* 126 */
196*cd49e866SKonstantin Belousov 	__uprefix,				/* 127 */
197*cd49e866SKonstantin Belousov 	__uprefix,				/* 128 */
198*cd49e866SKonstantin Belousov 	__uprefix,				/* 129 */
199*cd49e866SKonstantin Belousov 	__uprefix,				/* 130 */
200*cd49e866SKonstantin Belousov 	__uprefix,				/* 131 */
201*cd49e866SKonstantin Belousov 	__uprefix,				/* 132 */
202*cd49e866SKonstantin Belousov 	__uprefix,				/* 133 */
203*cd49e866SKonstantin Belousov 	__uprefix,				/* 134 */
204*cd49e866SKonstantin Belousov 	__uprefix,				/* 135 */
205*cd49e866SKonstantin Belousov 	__uprefix,				/* 136 */
206*cd49e866SKonstantin Belousov 	__uprefix,				/* 137 */
207*cd49e866SKonstantin Belousov 	__uprefix,				/* 138 */
208*cd49e866SKonstantin Belousov 	__uprefix,				/* 139 */
209*cd49e866SKonstantin Belousov 	__uprefix,				/* 140 */
210*cd49e866SKonstantin Belousov 	__uprefix,				/* 141 */
211*cd49e866SKonstantin Belousov 	__uprefix,				/* 142 */
212*cd49e866SKonstantin Belousov 	__uprefix,				/* 143 */
213*cd49e866SKonstantin Belousov 	__uprefix,				/* 144 */
214*cd49e866SKonstantin Belousov 	__uprefix,				/* 145 */
215*cd49e866SKonstantin Belousov 	__uprefix,				/* 146 */
216*cd49e866SKonstantin Belousov 	__uprefix,				/* 147 */
217*cd49e866SKonstantin Belousov 	__uprefix,				/* 148 */
218*cd49e866SKonstantin Belousov 	__uprefix,				/* 149 */
219*cd49e866SKonstantin Belousov 	__uprefix,				/* 150 */
22058f0484fSRodney W. Grimes };
221*cd49e866SKonstantin Belousov const int sys_nerr = ELAST + 1;
222e73151ebSJilles Tjoelker 
223294246bbSEd Maste #ifdef PIC
224e73151ebSJilles Tjoelker __strong_reference(sys_errlist, __hidden_sys_errlist);
225e73151ebSJilles Tjoelker __strong_reference(sys_nerr, __hidden_sys_nerr);
226e73151ebSJilles Tjoelker #endif
227