summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2018-03-22 12:58:49 +0000
committerEd Maste <emaste@FreeBSD.org>2018-03-22 12:58:49 +0000
commit1ac2776bbb79d5a653d62a1db6ae67cd8ddc909d (patch)
treedf7dc732901f7e73e9d14e52fd5cb1677130f754 /sys
parente1992aa14269215d7fd76eaef994e07866c70be2 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/linux/linux_sysvec.c2
-rw-r--r--sys/amd64/linux32/linux32_sysvec.c2
-rw-r--r--sys/compat/linux/linux_emul.h2
-rw-r--r--sys/compat/linux/linux_errno.c149
-rw-r--r--sys/compat/linux/linux_errno.inc148
-rw-r--r--sys/i386/linux/linux_sysvec.c4
-rw-r--r--sys/modules/linux_common/Makefile2
7 files changed, 156 insertions, 153 deletions
diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c
index 0217abb08b85..93990d961f6f 100644
--- a/sys/amd64/linux/linux_sysvec.c
+++ b/sys/amd64/linux/linux_sysvec.c
@@ -752,7 +752,7 @@ struct sysentvec elf_linux_sysvec = {
.sv_table = linux_sysent,
.sv_mask = 0,
.sv_errsize = ELAST + 1,
- .sv_errtbl = bsd_to_linux_errno_generic,
+ .sv_errtbl = linux_errtbl,
.sv_transtrap = linux_translate_traps,
.sv_fixup = linux_fixup_elf,
.sv_sendsig = linux_rt_sendsig,
diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c
index ee8e8a0ae652..a2000aadc751 100644
--- a/sys/amd64/linux32/linux32_sysvec.c
+++ b/sys/amd64/linux32/linux32_sysvec.c
@@ -952,7 +952,7 @@ struct sysentvec elf_linux_sysvec = {
.sv_table = linux32_sysent,
.sv_mask = 0,
.sv_errsize = ELAST + 1,
- .sv_errtbl = bsd_to_linux_errno_generic,
+ .sv_errtbl = linux_errtbl,
.sv_transtrap = linux_translate_traps,
.sv_fixup = linux_fixup_elf,
.sv_sendsig = linux_sendsig,
diff --git a/sys/compat/linux/linux_emul.h b/sys/compat/linux/linux_emul.h
index cfe0f2db4b77..7764c6ac52e4 100644
--- a/sys/compat/linux/linux_emul.h
+++ b/sys/compat/linux/linux_emul.h
@@ -77,6 +77,6 @@ struct linux_pemuldata {
struct linux_pemuldata *pem_find(struct proc *);
-extern const int bsd_to_linux_errno_generic[];
+extern const int linux_errtbl[];
#endif /* !_LINUX_EMUL_H_ */
diff --git a/sys/compat/linux/linux_errno.c b/sys/compat/linux/linux_errno.c
index 002d25929741..72304dc5caf6 100644
--- a/sys/compat/linux/linux_errno.c
+++ b/sys/compat/linux/linux_errno.c
@@ -1,151 +1,6 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 1994-1996 Søren Schmidt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
+/* $FreeBSD$ */
#include <sys/cdefs.h>
#include <sys/errno.h>
-/*
- * Linux syscalls return negative errno's, we do positive and map them
- * Reference:
- * FreeBSD: src/sys/sys/errno.h
- * Linux: include/uapi/asm-generic/errno-base.h
- * include/uapi/asm-generic/errno.h
- */
-const int bsd_to_linux_errno_generic[ELAST + 1] = {
- -0,
- -1,
- -2,
- -3,
- -4,
- -5,
- -6,
- -7,
- -8,
- -9,
-
- -10,
- -35, /* EDEADLK */
- -12,
- -13,
- -14,
- -15,
- -16,
- -17,
- -18,
- -19,
-
- -20,
- -21,
- -22,
- -23,
- -24,
- -25,
- -26,
- -27,
- -28,
- -29,
-
- -30,
- -31,
- -32,
- -33,
- -34,
- -11, /* EAGAIN */
- -115,
- -114,
- -88,
- -89,
-
- -90,
- -91,
- -92,
- -93,
- -94,
- -95,
- -96,
- -97,
- -98,
- -99,
-
- -100,
- -101,
- -102,
- -103,
- -104,
- -105,
- -106,
- -107,
- -108,
- -109,
-
- -110,
- -111,
- -40,
- -36,
- -112,
- -113,
- -39,
- -11,
- -87,
- -122,
-
- -116,
- -66,
- -6, /* EBADRPC -> ENXIO */
- -6, /* ERPCMISMATCH -> ENXIO */
- -6, /* EPROGUNAVAIL -> ENXIO */
- -6, /* EPROGMISMATCH -> ENXIO */
- -6, /* EPROCUNAVAIL -> ENXIO */
- -37,
- -38,
- -9,
-
- -6, /* EAUTH -> ENXIO */
- -6, /* ENEEDAUTH -> ENXIO */
- -43,
- -42,
- -75,
- -125,
- -84,
- -61,
- -16, /* EDOOFUS -> EBUSY */
- -74,
-
- -72,
- -67,
- -71,
- -1, /* ENOTCAPABLE -> EPERM */
- -1, /* ECAPMODE -> EPERM */
- -131, /* ENOTRECOVERABLE */
- -130, /* EOWNERDEAD */
-};
-
-_Static_assert(ELAST == 96,
- "missing errno entries in bsd_to_linux_errno_generic");
+#include <compat/linux/linux_errno.inc>
diff --git a/sys/compat/linux/linux_errno.inc b/sys/compat/linux/linux_errno.inc
new file mode 100644
index 000000000000..b30ce1ff9866
--- /dev/null
+++ b/sys/compat/linux/linux_errno.inc
@@ -0,0 +1,148 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 1994-1996 Søren Schmidt
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Linux syscalls return negative errno's, we do positive and map them
+ * Reference:
+ * FreeBSD: src/sys/sys/errno.h
+ * Linux: include/uapi/asm-generic/errno-base.h
+ * include/uapi/asm-generic/errno.h
+ */
+const int linux_errtbl[ELAST + 1] = {
+ -0,
+ -1,
+ -2,
+ -3,
+ -4,
+ -5,
+ -6,
+ -7,
+ -8,
+ -9,
+
+ -10,
+ -35, /* EDEADLK */
+ -12,
+ -13,
+ -14,
+ -15,
+ -16,
+ -17,
+ -18,
+ -19,
+
+ -20,
+ -21,
+ -22,
+ -23,
+ -24,
+ -25,
+ -26,
+ -27,
+ -28,
+ -29,
+
+ -30,
+ -31,
+ -32,
+ -33,
+ -34,
+ -11, /* EAGAIN */
+ -115,
+ -114,
+ -88,
+ -89,
+
+ -90,
+ -91,
+ -92,
+ -93,
+ -94,
+ -95,
+ -96,
+ -97,
+ -98,
+ -99,
+
+ -100,
+ -101,
+ -102,
+ -103,
+ -104,
+ -105,
+ -106,
+ -107,
+ -108,
+ -109,
+
+ -110,
+ -111,
+ -40,
+ -36,
+ -112,
+ -113,
+ -39,
+ -11,
+ -87,
+ -122,
+
+ -116,
+ -66,
+ -6, /* EBADRPC -> ENXIO */
+ -6, /* ERPCMISMATCH -> ENXIO */
+ -6, /* EPROGUNAVAIL -> ENXIO */
+ -6, /* EPROGMISMATCH -> ENXIO */
+ -6, /* EPROCUNAVAIL -> ENXIO */
+ -37,
+ -38,
+ -9,
+
+ -6, /* EAUTH -> ENXIO */
+ -6, /* ENEEDAUTH -> ENXIO */
+ -43,
+ -42,
+ -75,
+ -125,
+ -84,
+ -61,
+ -16, /* EDOOFUS -> EBUSY */
+ -74,
+
+ -72,
+ -67,
+ -71,
+ -1, /* ENOTCAPABLE -> EPERM */
+ -1, /* ECAPMODE -> EPERM */
+ -131, /* ENOTRECOVERABLE */
+ -130, /* EOWNERDEAD */
+};
+
+_Static_assert(ELAST == 96,
+ "missing errno entries in linux_errtbl");
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c
index e96720e1b787..dfa057a1164d 100644
--- a/sys/i386/linux/linux_sysvec.c
+++ b/sys/i386/linux/linux_sysvec.c
@@ -893,7 +893,7 @@ struct sysentvec linux_sysvec = {
.sv_table = linux_sysent,
.sv_mask = 0,
.sv_errsize = ELAST + 1,
- .sv_errtbl = bsd_to_linux_errno_generic,
+ .sv_errtbl = linux_errtbl,
.sv_transtrap = linux_translate_traps,
.sv_fixup = linux_fixup,
.sv_sendsig = linux_sendsig,
@@ -930,7 +930,7 @@ struct sysentvec elf_linux_sysvec = {
.sv_table = linux_sysent,
.sv_mask = 0,
.sv_errsize = ELAST + 1,
- .sv_errtbl = bsd_to_linux_errno_generic,
+ .sv_errtbl = linux_errtbl,
.sv_transtrap = linux_translate_traps,
.sv_fixup = linux_fixup_elf,
.sv_sendsig = linux_sendsig,
diff --git a/sys/modules/linux_common/Makefile b/sys/modules/linux_common/Makefile
index 1583e88f7040..87db489fdd9a 100644
--- a/sys/modules/linux_common/Makefile
+++ b/sys/modules/linux_common/Makefile
@@ -8,8 +8,8 @@ SRCS= linux_common.c linux_mib.c linux_mmap.c linux_util.c linux_emul.c \
linux.c opt_compat.h device_if.h vnode_if.h bus_if.h
EXPORT_SYMS=
-EXPORT_SYMS+= bsd_to_linux_errno_generic
EXPORT_SYMS+= linux_emul_path
+EXPORT_SYMS+= linux_errtbl
EXPORT_SYMS+= linux_ioctl_register_handler
EXPORT_SYMS+= linux_ioctl_unregister_handler
EXPORT_SYMS+= linux_get_osname