xref: /freebsd/sys/compat/linux/linux_errno.inc (revision 7abf30d339336cef02a293352e0a82181e75c2fb)
11ac2776bSEd Maste/*-
21ac2776bSEd Maste * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
31ac2776bSEd Maste *
41ac2776bSEd Maste * Copyright (c) 1994-1996 Søren Schmidt
51ac2776bSEd Maste * All rights reserved.
61ac2776bSEd Maste *
71ac2776bSEd Maste * Redistribution and use in source and binary forms, with or without
81ac2776bSEd Maste * modification, are permitted provided that the following conditions
91ac2776bSEd Maste * are met:
101ac2776bSEd Maste * 1. Redistributions of source code must retain the above copyright
111ac2776bSEd Maste *    notice, this list of conditions and the following disclaimer.
121ac2776bSEd Maste * 2. Redistributions in binary form must reproduce the above copyright
131ac2776bSEd Maste *    notice, this list of conditions and the following disclaimer in the
141ac2776bSEd Maste *    documentation and/or other materials provided with the distribution.
151ac2776bSEd Maste *
161ac2776bSEd Maste * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
171ac2776bSEd Maste * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
181ac2776bSEd Maste * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
191ac2776bSEd Maste * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
201ac2776bSEd Maste * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
211ac2776bSEd Maste * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
221ac2776bSEd Maste * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
231ac2776bSEd Maste * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
241ac2776bSEd Maste * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
251ac2776bSEd Maste * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
261ac2776bSEd Maste * SUCH DAMAGE.
271ac2776bSEd Maste *
281ac2776bSEd Maste * $FreeBSD$
291ac2776bSEd Maste */
301ac2776bSEd Maste
311ac2776bSEd Maste/*
321ac2776bSEd Maste * Linux syscalls return negative errno's, we do positive and map them
331ac2776bSEd Maste * Reference:
341ac2776bSEd Maste *   FreeBSD: src/sys/sys/errno.h
351ac2776bSEd Maste *   Linux:   include/uapi/asm-generic/errno-base.h
361ac2776bSEd Maste *            include/uapi/asm-generic/errno.h
371a8577faSEdward Tomasz Napierala *
381a8577faSEdward Tomasz Napierala * XXX: The "XXX" comments below should be replaced with rationale
391a8577faSEdward Tomasz Napierala *      for the errno value chosen.
401ac2776bSEd Maste */
41*7abf30d3SEdward Tomasz Napieralastatic const int linux_errtbl[ELAST + 1] = {
421701c69bSEdward Tomasz Napierala	/* [0, 9] */
431701c69bSEdward Tomasz Napierala	[0] = -0,
441a8577faSEdward Tomasz Napierala	[EPERM] = -LINUX_EPERM,
451a8577faSEdward Tomasz Napierala	[ENOENT] = -LINUX_ENOENT,
461a8577faSEdward Tomasz Napierala	[ESRCH] = -LINUX_ESRCH,
471a8577faSEdward Tomasz Napierala	[EINTR] = -LINUX_EINTR,
481a8577faSEdward Tomasz Napierala	[EIO] = -LINUX_EIO,
491a8577faSEdward Tomasz Napierala	[ENXIO] = -LINUX_ENXIO,
501a8577faSEdward Tomasz Napierala	[E2BIG] = -LINUX_E2BIG,
511a8577faSEdward Tomasz Napierala	[ENOEXEC] = -LINUX_ENOEXEC,
521a8577faSEdward Tomasz Napierala	[EBADF] = -LINUX_EBADF,
531ac2776bSEd Maste
541701c69bSEdward Tomasz Napierala	/* [10, 19] */
551a8577faSEdward Tomasz Napierala	[ECHILD] = -LINUX_ECHILD,
561a8577faSEdward Tomasz Napierala	[EDEADLK] = -LINUX_EDEADLK,
571a8577faSEdward Tomasz Napierala	[ENOMEM] = -LINUX_ENOMEM,
581a8577faSEdward Tomasz Napierala	[EACCES] = -LINUX_EACCES,
591a8577faSEdward Tomasz Napierala	[EFAULT] = -LINUX_EFAULT,
601a8577faSEdward Tomasz Napierala	[ENOTBLK] = -LINUX_ENOTBLK,
611a8577faSEdward Tomasz Napierala	[EBUSY] = -LINUX_EBUSY,
621a8577faSEdward Tomasz Napierala	[EEXIST] = -LINUX_EEXIST,
631a8577faSEdward Tomasz Napierala	[EXDEV] = -LINUX_EXDEV,
641a8577faSEdward Tomasz Napierala	[ENODEV] = -LINUX_ENODEV,
651ac2776bSEd Maste
661701c69bSEdward Tomasz Napierala	/* [20, 29] */
671a8577faSEdward Tomasz Napierala	[ENOTDIR] = -LINUX_ENOTDIR,
681a8577faSEdward Tomasz Napierala	[EISDIR] = -LINUX_EISDIR,
691a8577faSEdward Tomasz Napierala	[EINVAL] = -LINUX_EINVAL,
701a8577faSEdward Tomasz Napierala	[ENFILE] = -LINUX_ENFILE,
711a8577faSEdward Tomasz Napierala	[EMFILE] = -LINUX_EMFILE,
721a8577faSEdward Tomasz Napierala	[ENOTTY] = -LINUX_ENOTTY,
731a8577faSEdward Tomasz Napierala	[ETXTBSY] = -LINUX_ETXTBSY,
741a8577faSEdward Tomasz Napierala	[EFBIG] = -LINUX_EFBIG,
751a8577faSEdward Tomasz Napierala	[ENOSPC] = -LINUX_ENOSPC,
761a8577faSEdward Tomasz Napierala	[ESPIPE] = -LINUX_ESPIPE,
771ac2776bSEd Maste
781701c69bSEdward Tomasz Napierala	/* [30, 39] */
791a8577faSEdward Tomasz Napierala	[EROFS] = -LINUX_EROFS,
801a8577faSEdward Tomasz Napierala	[EMLINK] = -LINUX_EMLINK,
811a8577faSEdward Tomasz Napierala	[EPIPE] = -LINUX_EPIPE,
821a8577faSEdward Tomasz Napierala	[EDOM] = -LINUX_EDOM,
831a8577faSEdward Tomasz Napierala	[ERANGE] = -LINUX_ERANGE,
841a8577faSEdward Tomasz Napierala	[EAGAIN] = -LINUX_EAGAIN,
851a8577faSEdward Tomasz Napierala	[EINPROGRESS] = -LINUX_EINPROGRESS,
861a8577faSEdward Tomasz Napierala	[EALREADY] = -LINUX_EALREADY,
871a8577faSEdward Tomasz Napierala	[ENOTSOCK] = -LINUX_ENOTSOCK,
881a8577faSEdward Tomasz Napierala	[EDESTADDRREQ] = -LINUX_EDESTADDRREQ,
891ac2776bSEd Maste
901701c69bSEdward Tomasz Napierala	/* [40, 49] */
911a8577faSEdward Tomasz Napierala	[EMSGSIZE] = -LINUX_EMSGSIZE,
921a8577faSEdward Tomasz Napierala	[EPROTOTYPE] = -LINUX_EPROTOTYPE,
931a8577faSEdward Tomasz Napierala	[ENOPROTOOPT] = -LINUX_ENOPROTOOPT,
941a8577faSEdward Tomasz Napierala	[EPROTONOSUPPORT] = -LINUX_EPROTONOTSUPPORT,
951a8577faSEdward Tomasz Napierala	[ESOCKTNOSUPPORT] = -LINUX_ESOCKNOTSUPPORT,
961a8577faSEdward Tomasz Napierala	[EOPNOTSUPP] = -LINUX_EOPNOTSUPPORT,
971a8577faSEdward Tomasz Napierala	[EPFNOSUPPORT] = -LINUX_EPFNOTSUPPORT,
981a8577faSEdward Tomasz Napierala	[EAFNOSUPPORT] = -LINUX_EAFNOTSUPPORT,
991a8577faSEdward Tomasz Napierala	[EADDRINUSE] = -LINUX_EADDRINUSE,
1001a8577faSEdward Tomasz Napierala	[EADDRNOTAVAIL] = -LINUX_EADDRNOTAVAIL,
1011ac2776bSEd Maste
1021701c69bSEdward Tomasz Napierala	/* [50, 59] */
1031a8577faSEdward Tomasz Napierala	[ENETDOWN] = -LINUX_ENETDOWN,
1041a8577faSEdward Tomasz Napierala	[ENETUNREACH] = -LINUX_ENETUNREACH,
1051a8577faSEdward Tomasz Napierala	[ENETRESET] = -LINUX_ENETRESET,
1061a8577faSEdward Tomasz Napierala	[ECONNABORTED] = -LINUX_ECONNABORTED,
1071a8577faSEdward Tomasz Napierala	[ECONNRESET] = -LINUX_ECONNRESET,
1081a8577faSEdward Tomasz Napierala	[ENOBUFS] = -LINUX_ENOBUFS,
1091a8577faSEdward Tomasz Napierala	[EISCONN] = -LINUX_EISCONN,
1101a8577faSEdward Tomasz Napierala	[ENOTCONN] = -LINUX_ENOTCONN,
1111a8577faSEdward Tomasz Napierala	[ESHUTDOWN] = -LINUX_ESHUTDOWN,
1121a8577faSEdward Tomasz Napierala	[ETOOMANYREFS] = -LINUX_ETOOMANYREFS,
1131ac2776bSEd Maste
1141701c69bSEdward Tomasz Napierala	/* [60, 69] */
1151a8577faSEdward Tomasz Napierala	[ETIMEDOUT] = -LINUX_ETIMEDOUT,
1161a8577faSEdward Tomasz Napierala	[ECONNREFUSED] = -LINUX_ECONNREFUSED,
1171a8577faSEdward Tomasz Napierala	[ELOOP] = -LINUX_ELOOP,
1181a8577faSEdward Tomasz Napierala	[ENAMETOOLONG] = -LINUX_ENAMETOOLONG,
1191a8577faSEdward Tomasz Napierala	[EHOSTDOWN] = -LINUX_EHOSTDOWN,
1201a8577faSEdward Tomasz Napierala	[EHOSTUNREACH] = -LINUX_EHOSTUNREACH,
1211a8577faSEdward Tomasz Napierala	[ENOTEMPTY] = -LINUX_ENOTEMPTY,
1221a8577faSEdward Tomasz Napierala	[EPROCLIM] = -LINUX_EAGAIN,	/* XXX */
1231a8577faSEdward Tomasz Napierala	[EUSERS] = -LINUX_EUSERS,
1241a8577faSEdward Tomasz Napierala	[EDQUOT] = -LINUX_EDQUOT,
1251ac2776bSEd Maste
1261701c69bSEdward Tomasz Napierala	/* [70, 79] */
1271a8577faSEdward Tomasz Napierala	[ESTALE] = -LINUX_ESTALE,
1281a8577faSEdward Tomasz Napierala	[EREMOTE] = -LINUX_EREMOTE,
1291a8577faSEdward Tomasz Napierala	[EBADRPC] = -LINUX_ENXIO,	/* XXX */
1301a8577faSEdward Tomasz Napierala	[ERPCMISMATCH] = -LINUX_ENXIO,	/* XXX */
1311a8577faSEdward Tomasz Napierala	[EPROGUNAVAIL] = -LINUX_ENXIO,	/* XXX */
1321a8577faSEdward Tomasz Napierala	[EPROGMISMATCH] = -LINUX_ENXIO,	/* XXX */
1331a8577faSEdward Tomasz Napierala	[EPROCUNAVAIL] = -LINUX_ENXIO,	/* XXX */
1341a8577faSEdward Tomasz Napierala	[ENOLCK] = -LINUX_ENOLCK,
1351a8577faSEdward Tomasz Napierala	[ENOSYS] = -LINUX_ENOSYS,
1361a8577faSEdward Tomasz Napierala	[EFTYPE] = -LINUX_EBADF,	/* XXX */
1371ac2776bSEd Maste
1381701c69bSEdward Tomasz Napierala	/* [80, 89] */
1391a8577faSEdward Tomasz Napierala	[EAUTH] = -LINUX_ENXIO,		/* XXX */
1401a8577faSEdward Tomasz Napierala	[ENEEDAUTH] = -LINUX_ENXIO,	/* XXX */
1411a8577faSEdward Tomasz Napierala	[EIDRM] = -LINUX_EIDRM,
1421a8577faSEdward Tomasz Napierala	[ENOMSG] = -LINUX_ENOMSG,
1431a8577faSEdward Tomasz Napierala	[EOVERFLOW] = -LINUX_EOVERFLOW,
1441a8577faSEdward Tomasz Napierala	[ECANCELED] = -LINUX_ECANCELED,
1451a8577faSEdward Tomasz Napierala	[EILSEQ] = -LINUX_EILSEQ,
1461a8577faSEdward Tomasz Napierala	[ENOATTR] = -LINUX_ENODATA,	/* XXX */
1471a8577faSEdward Tomasz Napierala	[EDOOFUS] = -LINUX_EINVAL,	/* XXX */
1481a8577faSEdward Tomasz Napierala	[EBADMSG] = -LINUX_EBADMSG,
1491ac2776bSEd Maste
1501701c69bSEdward Tomasz Napierala	/* [90, 99] */
1511a8577faSEdward Tomasz Napierala	[EMULTIHOP] = -LINUX_EMULTIHOP,
1521a8577faSEdward Tomasz Napierala	[ENOLINK] = -LINUX_ENOLINK,
1531a8577faSEdward Tomasz Napierala	[EPROTO] = -LINUX_EPROTO,
1541a8577faSEdward Tomasz Napierala	[ENOTCAPABLE] = -LINUX_EPERM,	/* XXX */
1551a8577faSEdward Tomasz Napierala	[ECAPMODE] = -LINUX_EPERM,	/* XXX */
1561a8577faSEdward Tomasz Napierala	[ENOTRECOVERABLE] = -LINUX_ENOTRECOVERABLE,
1571a8577faSEdward Tomasz Napierala	[EOWNERDEAD] = -LINUX_EOWNERDEAD,
1581a8577faSEdward Tomasz Napierala	[EINTEGRITY] = -LINUX_EINVAL,	/* XXX */
1591ac2776bSEd Maste};
1601ac2776bSEd Maste
16188640c0eSKirk McKusick_Static_assert(ELAST == 97,
1621ac2776bSEd Maste    "missing errno entries in linux_errtbl");
163