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