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