1331056Semaste/*-
2331056Semaste * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3331056Semaste *
4331056Semaste * Copyright (c) 1994-1996 Sren Schmidt
5331056Semaste * All rights reserved.
6331056Semaste *
7331056Semaste * Redistribution and use in source and binary forms, with or without
8331056Semaste * modification, are permitted provided that the following conditions
9331056Semaste * are met:
10331056Semaste * 1. Redistributions of source code must retain the above copyright
11331056Semaste *    notice, this list of conditions and the following disclaimer.
12331056Semaste * 2. Redistributions in binary form must reproduce the above copyright
13331056Semaste *    notice, this list of conditions and the following disclaimer in the
14331056Semaste *    documentation and/or other materials provided with the distribution.
15331056Semaste *
16331056Semaste * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17331056Semaste * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18331056Semaste * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19331056Semaste * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20331056Semaste * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21331056Semaste * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22331056Semaste * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23331056Semaste * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24331056Semaste * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25331056Semaste * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26331056Semaste * SUCH DAMAGE.
27331056Semaste *
28331056Semaste * $FreeBSD: stable/11/sys/compat/linux/linux_errno.inc 346830 2019-04-28 13:43:58Z dchagin $
29331056Semaste */
30331056Semaste
31331056Semaste/*
32331056Semaste * Linux syscalls return negative errno's, we do positive and map them
33331056Semaste * Reference:
34331056Semaste *   FreeBSD: src/sys/sys/errno.h
35331057Semaste *   Linux:   include/uapi/asm-generic/errno-base.h
36331057Semaste *            include/uapi/asm-generic/errno.h
37331056Semaste */
38331356Semasteconst int linux_errtbl[ELAST + 1] = {
39331056Semaste	-0,
40331056Semaste	-1,
41331056Semaste	-2,
42331056Semaste	-3,
43331056Semaste	-4,
44331056Semaste	-5,
45331056Semaste	-6,
46331056Semaste	-7,
47331056Semaste	-8,
48331056Semaste	-9,
49331056Semaste
50331056Semaste	-10,
51331056Semaste	-35,	/* EDEADLK */
52331056Semaste	-12,
53331056Semaste	-13,
54331056Semaste	-14,
55331056Semaste	-15,
56331056Semaste	-16,
57331056Semaste	-17,
58331056Semaste	-18,
59331056Semaste	-19,
60331056Semaste
61331056Semaste	-20,
62331056Semaste	-21,
63331056Semaste	-22,
64331056Semaste	-23,
65331056Semaste	-24,
66331056Semaste	-25,
67331056Semaste	-26,
68331056Semaste	-27,
69331056Semaste	-28,
70331056Semaste	-29,
71331056Semaste
72331056Semaste	-30,
73331056Semaste	-31,
74331056Semaste	-32,
75331056Semaste	-33,
76331056Semaste	-34,
77331056Semaste	-11,	/* EAGAIN */
78331056Semaste	-115,
79331056Semaste	-114,
80331056Semaste	-88,
81331056Semaste	-89,
82331056Semaste
83331056Semaste	-90,
84331056Semaste	-91,
85331056Semaste	-92,
86331056Semaste	-93,
87331056Semaste	-94,
88331056Semaste	-95,
89331056Semaste	-96,
90331056Semaste	-97,
91331056Semaste	-98,
92331056Semaste	-99,
93331056Semaste
94331056Semaste	-100,
95331056Semaste	-101,
96331056Semaste	-102,
97331056Semaste	-103,
98331056Semaste	-104,
99331056Semaste	-105,
100331056Semaste	-106,
101331056Semaste	-107,
102331056Semaste	-108,
103331056Semaste	-109,
104331056Semaste
105331056Semaste	-110,
106331056Semaste	-111,
107331056Semaste	-40,
108331056Semaste	-36,
109331056Semaste	-112,
110331056Semaste	-113,
111331056Semaste	-39,
112331056Semaste	-11,
113331056Semaste	-87,
114331056Semaste	-122,
115331056Semaste
116331056Semaste	-116,
117331056Semaste	-66,
118331056Semaste	-6,	/* EBADRPC -> ENXIO */
119331056Semaste	-6,	/* ERPCMISMATCH -> ENXIO */
120331056Semaste	-6,	/* EPROGUNAVAIL -> ENXIO */
121331056Semaste	-6,	/* EPROGMISMATCH -> ENXIO */
122331056Semaste	-6,	/* EPROCUNAVAIL -> ENXIO */
123331056Semaste	-37,
124331056Semaste	-38,
125331056Semaste	-9,
126331056Semaste
127331056Semaste	-6,	/* EAUTH -> ENXIO */
128331056Semaste	-6,	/* ENEEDAUTH -> ENXIO */
129331056Semaste	-43,
130331056Semaste	-42,
131331056Semaste	-75,
132331056Semaste	-125,
133331056Semaste	-84,
134331056Semaste	-61,
135346830Sdchagin	-22,	/* EDOOFUS -> EINVAL */
136331056Semaste	-74,
137331056Semaste
138331056Semaste	-72,
139331056Semaste	-67,
140331056Semaste	-71,
141331057Semaste	-1,	/* ENOTCAPABLE -> EPERM */
142331057Semaste	-1,	/* ECAPMODE -> EPERM */
143331057Semaste	-131,	/* ENOTRECOVERABLE */
144331057Semaste	-130,	/* EOWNERDEAD */
145331056Semaste};
146331057Semaste
147331057Semaste_Static_assert(ELAST == 96,
148331356Semaste    "missing errno entries in linux_errtbl");
149