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