xref: /netbsd-src/lib/libc/compat/gen/compat_errlist.c (revision ace5b9b5feb0e7608bd2da7a617428d2e1cf8aa3)
1*ace5b9b5Schristos /*	$NetBSD: compat_errlist.c,v 1.3 2024/01/20 14:52:45 christos Exp $	*/
25b84b398Schristos 
35b84b398Schristos /*
45b84b398Schristos  * Copyright (c) 1982, 1985, 1993
55b84b398Schristos  *	The Regents of the University of California.  All rights reserved.
65b84b398Schristos  *
75b84b398Schristos  * Redistribution and use in source and binary forms, with or without
85b84b398Schristos  * modification, are permitted provided that the following conditions
95b84b398Schristos  * are met:
105b84b398Schristos  * 1. Redistributions of source code must retain the above copyright
115b84b398Schristos  *    notice, this list of conditions and the following disclaimer.
125b84b398Schristos  * 2. Redistributions in binary form must reproduce the above copyright
135b84b398Schristos  *    notice, this list of conditions and the following disclaimer in the
145b84b398Schristos  *    documentation and/or other materials provided with the distribution.
155b84b398Schristos  * 3. Neither the name of the University nor the names of its contributors
165b84b398Schristos  *    may be used to endorse or promote products derived from this software
175b84b398Schristos  *    without specific prior written permission.
185b84b398Schristos  *
195b84b398Schristos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
205b84b398Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
215b84b398Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
225b84b398Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
235b84b398Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
245b84b398Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
255b84b398Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
265b84b398Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
275b84b398Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
285b84b398Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
295b84b398Schristos  * SUCH DAMAGE.
305b84b398Schristos  */
315b84b398Schristos 
325b84b398Schristos #include <sys/cdefs.h>
335b84b398Schristos #if defined(LIBC_SCCS) && !defined(lint)
345b84b398Schristos #if 0
355b84b398Schristos static char sccsid[] = "@(#)errlst.c	8.2 (Berkeley) 11/16/93";
365b84b398Schristos #else
37*ace5b9b5Schristos __RCSID("$NetBSD: compat_errlist.c,v 1.3 2024/01/20 14:52:45 christos Exp $");
385b84b398Schristos #endif
395b84b398Schristos #endif /* LIBC_SCCS and not lint */
405b84b398Schristos 
415b84b398Schristos #include "namespace.h"
425b84b398Schristos 
43*ace5b9b5Schristos #include <compat/include/errno.h>
445b84b398Schristos #ifdef __weak_alias
455b84b398Schristos __weak_alias(sys_errlist, _sys_errlist)
465b84b398Schristos __weak_alias(__sys_errlist, _sys_errlist)
475b84b398Schristos __weak_alias(sys_nerr, _sys_nerr)
485b84b398Schristos __weak_alias(__sys_nerr, _sys_nerr)
495b84b398Schristos #endif
505b84b398Schristos 
515b84b398Schristos const char *const sys_errlist[] = {
525b84b398Schristos 	"Undefined error: 0",			/*  0 - ENOERROR */
535b84b398Schristos 	"Operation not permitted",		/*  1 - EPERM */
545b84b398Schristos 	"No such file or directory",		/*  2 - ENOENT */
555b84b398Schristos 	"No such process",			/*  3 - ESRCH */
565b84b398Schristos 	"Interrupted system call",		/*  4 - EINTR */
575b84b398Schristos 	"Input/output error",			/*  5 - EIO */
585b84b398Schristos 	"Device not configured",		/*  6 - ENXIO */
595b84b398Schristos 	"Argument list too long",		/*  7 - E2BIG */
605b84b398Schristos 	"Exec format error",			/*  8 - ENOEXEC */
615b84b398Schristos 	"Bad file descriptor",			/*  9 - EBADF */
625b84b398Schristos 	"No child processes",			/* 10 - ECHILD */
635b84b398Schristos 	"Resource deadlock avoided",		/* 11 - EDEADLK */
645b84b398Schristos 	"Cannot allocate memory",		/* 12 - ENOMEM */
655b84b398Schristos 	"Permission denied",			/* 13 - EACCES */
665b84b398Schristos 	"Bad address",				/* 14 - EFAULT */
675b84b398Schristos 	"Block device required",		/* 15 - ENOTBLK */
685b84b398Schristos 	"Device busy",				/* 16 - EBUSY */
695b84b398Schristos 	"File exists",				/* 17 - EEXIST */
705b84b398Schristos 	"Cross-device link",			/* 18 - EXDEV */
715b84b398Schristos 	"Operation not supported by device",	/* 19 - ENODEV */
725b84b398Schristos 	"Not a directory",			/* 20 - ENOTDIR */
735b84b398Schristos 	"Is a directory",			/* 21 - EISDIR */
745b84b398Schristos 	"Invalid argument",			/* 22 - EINVAL */
755b84b398Schristos 	"Too many open files in system",	/* 23 - ENFILE */
765b84b398Schristos 	"Too many open files",			/* 24 - EMFILE */
775b84b398Schristos 	"Inappropriate ioctl for device",	/* 25 - ENOTTY */
785b84b398Schristos 	"Text file busy",			/* 26 - ETXTBSY */
795b84b398Schristos 	"File too large",			/* 27 - EFBIG */
805b84b398Schristos 	"No space left on device",		/* 28 - ENOSPC */
815b84b398Schristos 	"Illegal seek",				/* 29 - ESPIPE */
825b84b398Schristos 	"Read-only file system",		/* 30 - EROFS */
835b84b398Schristos 	"Too many links",			/* 31 - EMLINK */
845b84b398Schristos 	"Broken pipe",				/* 32 - EPIPE */
855b84b398Schristos 
865b84b398Schristos /* math software */
875b84b398Schristos 	"Numerical argument out of domain",	/* 33 - EDOM */
885b84b398Schristos 	"Result too large or too small",	/* 34 - ERANGE */
895b84b398Schristos 
905b84b398Schristos /* non-blocking and interrupt i/o */
915b84b398Schristos 	"Resource temporarily unavailable",	/* 35 - EAGAIN */
925b84b398Schristos 						/* 35 - EWOULDBLOCK */
935b84b398Schristos 	"Operation now in progress",		/* 36 - EINPROGRESS */
945b84b398Schristos 	"Operation already in progress",	/* 37 - EALREADY */
955b84b398Schristos 
965b84b398Schristos /* ipc/network software -- argument errors */
975b84b398Schristos 	"Socket operation on non-socket",	/* 38 - ENOTSOCK */
985b84b398Schristos 	"Destination address required",		/* 39 - EDESTADDRREQ */
995b84b398Schristos 	"Message too long",			/* 40 - EMSGSIZE */
1005b84b398Schristos 	"Protocol wrong type for socket",	/* 41 - EPROTOTYPE */
1014b14bb63Scbiere 	"Protocol option not available",	/* 42 - ENOPROTOOPT */
1025b84b398Schristos 	"Protocol not supported",		/* 43 - EPROTONOSUPPORT */
1035b84b398Schristos 	"Socket type not supported",		/* 44 - ESOCKTNOSUPPORT */
1045b84b398Schristos 	"Operation not supported",		/* 45 - EOPNOTSUPP */
1055b84b398Schristos 	"Protocol family not supported",	/* 46 - EPFNOSUPPORT */
1065b84b398Schristos 						/* 47 - EAFNOSUPPORT */
1075b84b398Schristos 	"Address family not supported by protocol family",
1085b84b398Schristos 	"Address already in use",		/* 48 - EADDRINUSE */
1095b84b398Schristos 	"Can't assign requested address",	/* 49 - EADDRNOTAVAIL */
1105b84b398Schristos 
1115b84b398Schristos /* ipc/network software -- operational errors */
1125b84b398Schristos 	"Network is down",			/* 50 - ENETDOWN */
1135b84b398Schristos 	"Network is unreachable",		/* 51 - ENETUNREACH */
1145b84b398Schristos 	"Network dropped connection on reset",	/* 52 - ENETRESET */
1155b84b398Schristos 	"Software caused connection abort",	/* 53 - ECONNABORTED */
1165b84b398Schristos 	"Connection reset by peer",		/* 54 - ECONNRESET */
1175b84b398Schristos 	"No buffer space available",		/* 55 - ENOBUFS */
1185b84b398Schristos 	"Socket is already connected",		/* 56 - EISCONN */
1195b84b398Schristos 	"Socket is not connected",		/* 57 - ENOTCONN */
1205b84b398Schristos 	"Can't send after socket shutdown",	/* 58 - ESHUTDOWN */
1215b84b398Schristos 	"Too many references: can't splice",	/* 59 - ETOOMANYREFS */
1225b84b398Schristos 	"Operation timed out",			/* 60 - ETIMEDOUT */
1235b84b398Schristos 	"Connection refused",			/* 61 - ECONNREFUSED */
1245b84b398Schristos 
1255b84b398Schristos 	"Too many levels of symbolic links",	/* 62 - ELOOP */
1265b84b398Schristos 	"File name too long",			/* 63 - ENAMETOOLONG */
1275b84b398Schristos 
1285b84b398Schristos /* should be rearranged */
1295b84b398Schristos 	"Host is down",				/* 64 - EHOSTDOWN */
1305b84b398Schristos 	"No route to host",			/* 65 - EHOSTUNREACH */
1315b84b398Schristos 	"Directory not empty",			/* 66 - ENOTEMPTY */
1325b84b398Schristos 
1335b84b398Schristos /* quotas & mush */
1345b84b398Schristos 	"Too many processes",			/* 67 - EPROCLIM */
1355b84b398Schristos 	"Too many users",			/* 68 - EUSERS */
1365b84b398Schristos 	"Disc quota exceeded",			/* 69 - EDQUOT */
1375b84b398Schristos 
1385b84b398Schristos /* Network File System */
1395b84b398Schristos 	"Stale NFS file handle",		/* 70 - ESTALE */
1405b84b398Schristos 	"Too many levels of remote in path",	/* 71 - EREMOTE */
1415b84b398Schristos 	"RPC struct is bad",			/* 72 - EBADRPC */
1425b84b398Schristos 	"RPC version wrong",			/* 73 - ERPCMISMATCH */
1435b84b398Schristos 	"RPC prog. not avail",			/* 74 - EPROGUNAVAIL */
1445b84b398Schristos 	"Program version wrong",		/* 75 - EPROGMISMATCH */
1455b84b398Schristos 	"Bad procedure for program",		/* 76 - EPROCUNAVAIL */
1465b84b398Schristos 
1475b84b398Schristos 	"No locks available",			/* 77 - ENOLCK */
1485b84b398Schristos 	"Function not implemented",		/* 78 - ENOSYS */
1495b84b398Schristos 
1505b84b398Schristos 	"Inappropriate file type or format",	/* 79 - EFTYPE */
1515b84b398Schristos };
1525b84b398Schristos const int sys_nerr = { sizeof(sys_errlist) / sizeof(sys_errlist[0]) };
153