]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/compat/linux/linux_errno.c
unbound: Vendor import 1.19.0
[FreeBSD/FreeBSD.git] / sys / compat / linux / linux_errno.c
1
2 #include <sys/param.h>
3 #include <sys/systm.h>
4 #include <sys/errno.h>
5
6 #include <compat/linux/linux.h>
7 #include <compat/linux/linux_errno.h>
8 #include <compat/linux/linux_errno.inc>
9
10 int
11 bsd_to_linux_errno(int error)
12 {
13
14         KASSERT(error >= 0 && error <= ELAST,
15             ("%s: bad error %d", __func__, error));
16
17         return (linux_errtbl[error]);
18 }
19
20 #ifdef INVARIANTS
21 void
22 linux_check_errtbl(void)
23 {
24         int i;
25
26         for (i = 1; i < nitems(linux_errtbl); i++) {
27                 KASSERT(linux_errtbl[i] != 0,
28                     ("%s: linux_errtbl[%d] == 0", __func__, i));
29         }
30
31         for (i = 1; i < nitems(linux_to_bsd_errtbl); i++) {
32                 KASSERT(linux_to_bsd_errtbl[i] != 0,
33                     ("%s: linux_to_bsd_errtbl[%d] == 0", __func__, i));
34         }
35
36 }
37 #endif