1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 1994-1996 Søren Schmidt 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 31/* 32 * Linux syscalls return negative errno's, we do positive and map them 33 * Reference: 34 * FreeBSD: src/sys/sys/errno.h 35 * Linux: include/uapi/asm-generic/errno-base.h 36 * include/uapi/asm-generic/errno.h 37 */ 38const int linux_errtbl[ELAST + 1] = { 39 -0, 40 -1, 41 -2, 42 -3, 43 -4, 44 -5, 45 -6, 46 -7, 47 -8, 48 -9, 49 50 -10, 51 -35, /* EDEADLK */ 52 -12, 53 -13, 54 -14, 55 -15, 56 -16, 57 -17, 58 -18, 59 -19, 60 61 -20, 62 -21, 63 -22, 64 -23, 65 -24, 66 -25, 67 -26, 68 -27, 69 -28, 70 -29, 71 72 -30, 73 -31, 74 -32, 75 -33, 76 -34, 77 -11, /* EAGAIN */ 78 -115, 79 -114, 80 -88, 81 -89, 82 83 -90, 84 -91, 85 -92, 86 -93, 87 -94, 88 -95, 89 -96, 90 -97, 91 -98, 92 -99, 93 94 -100, 95 -101, 96 -102, 97 -103, 98 -104, 99 -105, 100 -106, 101 -107, 102 -108, 103 -109, 104 105 -110, 106 -111, 107 -40, 108 -36, 109 -112, 110 -113, 111 -39, 112 -11, 113 -87, 114 -122, 115 116 -116, 117 -66, 118 -6, /* EBADRPC -> ENXIO */ 119 -6, /* ERPCMISMATCH -> ENXIO */ 120 -6, /* EPROGUNAVAIL -> ENXIO */ 121 -6, /* EPROGMISMATCH -> ENXIO */ 122 -6, /* EPROCUNAVAIL -> ENXIO */ 123 -37, 124 -38, 125 -9, 126 127 -6, /* EAUTH -> ENXIO */ 128 -6, /* ENEEDAUTH -> ENXIO */ 129 -43, 130 -42, 131 -75, 132 -125, 133 -84, 134 -61, 135 -22, /* EDOOFUS -> EINVAL */ 136 -74, 137 138 -72, 139 -67, 140 -71, 141 -1, /* ENOTCAPABLE -> EPERM */ 142 -1, /* ECAPMODE -> EPERM */ 143 -131, /* ENOTRECOVERABLE */ 144 -130, /* EOWNERDEAD */ 145}; 146 147_Static_assert(ELAST == 96, 148 "missing errno entries in linux_errtbl"); 149