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 371ac2776bSEd Maste */ 381ac2776bSEd Masteconst int linux_errtbl[ELAST + 1] = { 39*1701c69bSEdward Tomasz Napierala /* [0, 9] */ 40*1701c69bSEdward Tomasz Napierala [0] = -0, 41*1701c69bSEdward Tomasz Napierala [EPERM] = -1, 42*1701c69bSEdward Tomasz Napierala [ENOENT] = -2, 43*1701c69bSEdward Tomasz Napierala [ESRCH] = -3, 44*1701c69bSEdward Tomasz Napierala [EINTR] = -4, 45*1701c69bSEdward Tomasz Napierala [EIO] = -5, 46*1701c69bSEdward Tomasz Napierala [ENXIO] = -6, 47*1701c69bSEdward Tomasz Napierala [E2BIG] = -7, 48*1701c69bSEdward Tomasz Napierala [ENOEXEC] = -8, 49*1701c69bSEdward Tomasz Napierala [EBADF] = -9, 501ac2776bSEd Maste 51*1701c69bSEdward Tomasz Napierala /* [10, 19] */ 52*1701c69bSEdward Tomasz Napierala [ECHILD] = -10, 53*1701c69bSEdward Tomasz Napierala [EDEADLK] = -35, 54*1701c69bSEdward Tomasz Napierala [ENOMEM] = -12, 55*1701c69bSEdward Tomasz Napierala [EACCES] = -13, 56*1701c69bSEdward Tomasz Napierala [EFAULT] = -14, 57*1701c69bSEdward Tomasz Napierala [ENOTBLK] = -15, 58*1701c69bSEdward Tomasz Napierala [EBUSY] = -16, 59*1701c69bSEdward Tomasz Napierala [EEXIST] = -17, 60*1701c69bSEdward Tomasz Napierala [EXDEV] = -18, 61*1701c69bSEdward Tomasz Napierala [ENODEV] = -19, 621ac2776bSEd Maste 63*1701c69bSEdward Tomasz Napierala /* [20, 29] */ 64*1701c69bSEdward Tomasz Napierala [ENOTDIR] = -20, 65*1701c69bSEdward Tomasz Napierala [EISDIR] = -21, 66*1701c69bSEdward Tomasz Napierala [EINVAL] = -22, 67*1701c69bSEdward Tomasz Napierala [ENFILE] = -23, 68*1701c69bSEdward Tomasz Napierala [EMFILE] = -24, 69*1701c69bSEdward Tomasz Napierala [ENOTTY] = -25, 70*1701c69bSEdward Tomasz Napierala [ETXTBSY] = -26, 71*1701c69bSEdward Tomasz Napierala [EFBIG] = -27, 72*1701c69bSEdward Tomasz Napierala [ENOSPC] = -28, 73*1701c69bSEdward Tomasz Napierala [ESPIPE] = -29, 741ac2776bSEd Maste 75*1701c69bSEdward Tomasz Napierala /* [30, 39] */ 76*1701c69bSEdward Tomasz Napierala [EROFS] = -30, 77*1701c69bSEdward Tomasz Napierala [EMLINK] = -31, 78*1701c69bSEdward Tomasz Napierala [EPIPE] = -32, 79*1701c69bSEdward Tomasz Napierala [EDOM] = -33, 80*1701c69bSEdward Tomasz Napierala [ERANGE] = -34, 81*1701c69bSEdward Tomasz Napierala [EAGAIN] = -11, 82*1701c69bSEdward Tomasz Napierala [EINPROGRESS] = -115, 83*1701c69bSEdward Tomasz Napierala [EALREADY] = -114, 84*1701c69bSEdward Tomasz Napierala [ENOTSOCK] = -88, 85*1701c69bSEdward Tomasz Napierala [EDESTADDRREQ] = -89, 861ac2776bSEd Maste 87*1701c69bSEdward Tomasz Napierala /* [40, 49] */ 88*1701c69bSEdward Tomasz Napierala [EMSGSIZE] = -90, 89*1701c69bSEdward Tomasz Napierala [EPROTOTYPE] = -91, 90*1701c69bSEdward Tomasz Napierala [ENOPROTOOPT] = -92, 91*1701c69bSEdward Tomasz Napierala [EPROTONOSUPPORT] = -93, 92*1701c69bSEdward Tomasz Napierala [ESOCKTNOSUPPORT] = -94, 93*1701c69bSEdward Tomasz Napierala [EOPNOTSUPP] = -95, 94*1701c69bSEdward Tomasz Napierala [EPFNOSUPPORT] = -96, 95*1701c69bSEdward Tomasz Napierala [EAFNOSUPPORT] = -97, 96*1701c69bSEdward Tomasz Napierala [EADDRINUSE] = -98, 97*1701c69bSEdward Tomasz Napierala [EADDRNOTAVAIL] = -99, 981ac2776bSEd Maste 99*1701c69bSEdward Tomasz Napierala /* [50, 59] */ 100*1701c69bSEdward Tomasz Napierala [ENETDOWN] = -100, 101*1701c69bSEdward Tomasz Napierala [ENETUNREACH] = -101, 102*1701c69bSEdward Tomasz Napierala [ENETRESET] = -102, 103*1701c69bSEdward Tomasz Napierala [ECONNABORTED] = -103, 104*1701c69bSEdward Tomasz Napierala [ECONNRESET] = -104, 105*1701c69bSEdward Tomasz Napierala [ENOBUFS] = -105, 106*1701c69bSEdward Tomasz Napierala [EISCONN] = -106, 107*1701c69bSEdward Tomasz Napierala [ENOTCONN] = -107, 108*1701c69bSEdward Tomasz Napierala [ESHUTDOWN] = -108, 109*1701c69bSEdward Tomasz Napierala [ETOOMANYREFS] = -109, 1101ac2776bSEd Maste 111*1701c69bSEdward Tomasz Napierala /* [60, 69] */ 112*1701c69bSEdward Tomasz Napierala [ETIMEDOUT] = -110, 113*1701c69bSEdward Tomasz Napierala [ECONNREFUSED] = -111, 114*1701c69bSEdward Tomasz Napierala [ELOOP] = -40, 115*1701c69bSEdward Tomasz Napierala [ENAMETOOLONG] = -36, 116*1701c69bSEdward Tomasz Napierala [EHOSTDOWN] = -112, 117*1701c69bSEdward Tomasz Napierala [EHOSTUNREACH] = -113, 118*1701c69bSEdward Tomasz Napierala [ENOTEMPTY] = -39, 119*1701c69bSEdward Tomasz Napierala [EPROCLIM] = -11, 120*1701c69bSEdward Tomasz Napierala [EUSERS] = -87, 121*1701c69bSEdward Tomasz Napierala [EDQUOT] = -122, 1221ac2776bSEd Maste 123*1701c69bSEdward Tomasz Napierala /* [70, 79] */ 124*1701c69bSEdward Tomasz Napierala [ESTALE] = -116, 125*1701c69bSEdward Tomasz Napierala [EREMOTE] = -66, 126*1701c69bSEdward Tomasz Napierala [EBADRPC] = -6, /* EBADRPC -> ENXIO */ 127*1701c69bSEdward Tomasz Napierala [ERPCMISMATCH] = -6, /* ERPCMISMATCH -> ENXIO */ 128*1701c69bSEdward Tomasz Napierala [EPROGUNAVAIL] = -6, /* EPROGUNAVAIL -> ENXIO */ 129*1701c69bSEdward Tomasz Napierala [EPROGMISMATCH] = -6, /* EPROGMISMATCH -> ENXIO */ 130*1701c69bSEdward Tomasz Napierala [EPROCUNAVAIL] = -6, /* EPROCUNAVAIL -> ENXIO */ 131*1701c69bSEdward Tomasz Napierala [ENOLCK] = -37, 132*1701c69bSEdward Tomasz Napierala [ENOSYS] = -38, 133*1701c69bSEdward Tomasz Napierala [EFTYPE] = -9, 1341ac2776bSEd Maste 135*1701c69bSEdward Tomasz Napierala /* [80, 89] */ 136*1701c69bSEdward Tomasz Napierala [EAUTH] = -6, /* EAUTH -> ENXIO */ 137*1701c69bSEdward Tomasz Napierala [ENEEDAUTH] = -6, /* ENEEDAUTH -> ENXIO */ 138*1701c69bSEdward Tomasz Napierala [EIDRM] = -43, 139*1701c69bSEdward Tomasz Napierala [ENOMSG] = -42, 140*1701c69bSEdward Tomasz Napierala [EOVERFLOW] = -75, 141*1701c69bSEdward Tomasz Napierala [ECANCELED] = -125, 142*1701c69bSEdward Tomasz Napierala [EILSEQ] = -84, 143*1701c69bSEdward Tomasz Napierala [ENOATTR] = -61, 144*1701c69bSEdward Tomasz Napierala [EDOOFUS] = -22, /* EDOOFUS -> EINVAL */ 145*1701c69bSEdward Tomasz Napierala [EBADMSG] = -74, 1461ac2776bSEd Maste 147*1701c69bSEdward Tomasz Napierala /* [90, 99] */ 148*1701c69bSEdward Tomasz Napierala [EMULTIHOP] = -72, 149*1701c69bSEdward Tomasz Napierala [ENOLINK] = -67, 150*1701c69bSEdward Tomasz Napierala [EPROTO] = -71, 151*1701c69bSEdward Tomasz Napierala [ENOTCAPABLE] = -1, /* ENOTCAPABLE -> EPERM */ 152*1701c69bSEdward Tomasz Napierala [ECAPMODE] = -1, /* ECAPMODE -> EPERM */ 153*1701c69bSEdward Tomasz Napierala [ENOTRECOVERABLE] = -131, /* ENOTRECOVERABLE */ 154*1701c69bSEdward Tomasz Napierala [EOWNERDEAD] = -130, /* EOWNERDEAD */ 155*1701c69bSEdward Tomasz Napierala [EINTEGRITY] = -22, /* EINTEGRITY -> EINVAL */ 1561ac2776bSEd Maste}; 1571ac2776bSEd Maste 15888640c0eSKirk McKusick_Static_assert(ELAST == 97, 1591ac2776bSEd Maste "missing errno entries in linux_errtbl"); 160