Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/pgoyette-compat]: src Split the compat_sysv module into several version-...
details: https://anonhg.NetBSD.org/src/rev/beb64ebf12d0
branches: pgoyette-compat
changeset: 321161:beb64ebf12d0
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Tue Apr 17 23:06:11 2018 +0000
description:
Split the compat_sysv module into several version-specific modules,
similar to the compat module.
diffstat:
doc/COMPAT-branch-notes | 24 ++++----
sys/compat/common/compat_sysv_10_mod.c | 92 ++++++++++++++++++++++++++++++++
sys/compat/common/compat_sysv_14_mod.c | 90 +++++++++++++++++++++++++++++++
sys/compat/common/compat_sysv_50_mod.c | 96 ++++++++++++++++++++++++++++++++++
sys/compat/common/compat_sysv_mod.c | 17 +++--
sys/modules/Makefile | 6 +-
sys/modules/compat_sysv/Makefile | 4 +-
sys/modules/compat_sysv_10/Makefile | 21 +++++++
sys/modules/compat_sysv_14/Makefile | 19 ++++++
sys/modules/compat_sysv_50/Makefile | 18 ++++++
10 files changed, 364 insertions(+), 23 deletions(-)
diffs (truncated from 529 to 300 lines):
diff -r 2e455e73933b -r beb64ebf12d0 doc/COMPAT-branch-notes
--- a/doc/COMPAT-branch-notes Tue Apr 17 22:31:41 2018 +0000
+++ b/doc/COMPAT-branch-notes Tue Apr 17 23:06:11 2018 +0000
@@ -37,6 +37,9 @@
is still available, and uses the alias mechanism to "advertise"
that the component modules are available.
+ Similarly, the compat_sysv module has also been split into several
+ version-specific modules.
+
There are still several areas which are not complete - see the
TODO list below for more details.
@@ -47,46 +50,43 @@
COMPAT_xx. When found, move the actual compat code into the compat
hierarchy and replace originals with indirect (vectored) calls.
-2. Similar to the monolithic netbsd module, split the compat_sysv
- module into multiple version-specific modules.
-
-3. Update syscalls.master to reflect that modular syscalls are now
+2. Update syscalls.master to reflect that modular syscalls are now
provided by version-specific modules.
-4. The rtsock compat code is a disaster, with rtsock_50.c #include-ing
+3. The rtsock compat code is a disaster, with rtsock_50.c #include-ing
the main rtsock.c code with various manipulations of the COMPAT_50
macro.
-5. The compat_60 module still needs some work for XEN systems. We
+4. The compat_60 module still needs some work for XEN systems. We
probably need some build infrastructure changes to ensure that
XEN (and, for i386, XEN-PAE) modules are build with the correct
macros defined and with -I directories specified in the same order
as for building kernels.
-6. Update syscalls.master to point the compat calls at the specific
+5. Update syscalls.master to point the compat calls at the specific
modules rather than the monolithic compat module. Update the
"required" lists of other modules, too.
-7. The rtsock compatability code needs to be de-spaghetti'd and made
+6. The rtsock compatability code needs to be de-spaghetti'd and made
separable into rtsock_70 and rtsock_50 pieces.
8. Once rtsock is separated, compat_14 references to rtsock_50 routines
needs to be verified.
-9. For compat_60, still need to figure out what to do with BSDPTY and
+8. For compat_60, still need to figure out what to do with BSDPTY and
tty_ptm
-10. Also for compat_60, need to fix the building of XEN (and, for i386,
+9. Also for compat_60, need to fix the building of XEN (and, for i386,
XEN-PAE) module variants so that the obj-dir symlinks and the -I
include order match those present in a kernel build. See PR/53130
(Currently, this affects the compat_60 module and its implementation
of microcode updates for AMD processors - i386 and amd64.)
-11. For compat_50, in addition to rtsock there are some things in dev/vnd,
+10. For compat_50, in addition to rtsock there are some things in dev/vnd,
dev/gpio, and dev/wscons/wsmux that I haven't been able to cleanly
separate.
-12. There seems to be quite a bit of MD compat_xx code, in the various
+11. There seems to be quite a bit of MD compat_xx code, in the various
sys/arch/ directories. I haven't yet looked at any of this. But it
seems to me that the MI compat build infrastructure should have some
mechanism to "reach over" to the MD code, #include a Makefile.inc file,
diff -r 2e455e73933b -r beb64ebf12d0 sys/compat/common/compat_sysv_10_mod.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/compat_sysv_10_mod.c Tue Apr 17 23:06:11 2018 +0000
@@ -0,0 +1,92 @@
+/* $NetBSD: compat_sysv_10_mod.c,v 1.1.2.1 2018/04/17 23:06:11 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software developed for The NetBSD Foundation
+ * by Paul Goyette
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_sysv_10_mod.c,v 1.1.2.1 2018/04/17 23:06:11 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_sysv.h"
+#endif
+
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/syscall.h>
+#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
+#include <sys/sysctl.h>
+
+MODULE(MODULE_CLASS_EXEC, compat_sysv_10, "sysv_ipc,sysv_50,sysv_14");
+
+/* Build the syscall package based on options specified */
+
+static const struct syscall_package compat_sysv_10_syscalls[] = {
+#if !defined(_LP64)
+#ifdef SYSVSHM
+ { SYS_compat_10_oshmsys, 0, (sy_call_t *)compat_10_sys_shmsys },
+#endif
+#ifdef SYSVSEM
+ { SYS_compat_10_osemsys, 0, (sy_call_t *)compat_10_sys_semsys },
+#endif
+#ifdef SYSVMSG
+ { SYS_compat_10_omsgsys, 0, (sy_call_t *)compat_10_sys_msgsys },
+#endif
+#endif /* !defined(_LP64) */
+ { 0, 0, NULL }
+};
+
+static int
+compat_sysv_10_modcmd(modcmd_t cmd, void *arg)
+{
+
+ int error = 0;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ error = syscall_establish(NULL, compat_sysv_10_syscalls);
+ if (error != 0) {
+ break;
+ }
+ break;
+
+ case MODULE_CMD_FINI:
+ error = syscall_disestablish(NULL, compat_sysv_10_syscalls);
+ if (error != 0) {
+ break;
+ }
+ break;
+
+ default:
+ error = ENOTTY;
+ break;
+ }
+ return error;
+}
diff -r 2e455e73933b -r beb64ebf12d0 sys/compat/common/compat_sysv_14_mod.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/compat_sysv_14_mod.c Tue Apr 17 23:06:11 2018 +0000
@@ -0,0 +1,90 @@
+/* $NetBSD: compat_sysv_14_mod.c,v 1.1.2.1 2018/04/17 23:06:11 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software developed for The NetBSD Foundation
+ * by Paul Goyette
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_sysv_14_mod.c,v 1.1.2.1 2018/04/17 23:06:11 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_sysv.h"
+#endif
+
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/syscall.h>
+#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
+#include <sys/sysctl.h>
+
+MODULE(MODULE_CLASS_EXEC, compat_sysv_14, "sysv_ipc_50,sysv_ipc");
+
+/* Build the syscall package based on options specified */
+
+static const struct syscall_package compat_sysv_14_syscalls[] = {
+#ifdef SYSVSHM
+ { SYS_compat_14_shmctl, 0, (sy_call_t *)compat_14_sys_shmctl },
+#endif
+#ifdef SYSVSEM
+ { SYS_compat_14___semctl, 0, (sy_call_t *)compat_14_sys___semctl },
+#endif
+#ifdef SYSVMSG
+ { SYS_compat_14_msgctl, 0, (sy_call_t *)compat_14_sys_msgctl },
+#endif
+ { 0, 0, NULL }
+};
+
+static int
+compat_sysv_14_modcmd(modcmd_t cmd, void *arg)
+{
+
+ int error = 0;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ error = syscall_establish(NULL, compat_sysv_14_syscalls);
+ if (error != 0) {
+ break;
+ }
+ break;
+
+ case MODULE_CMD_FINI:
+ error = syscall_disestablish(NULL, compat_sysv_14_syscalls);
+ if (error != 0) {
+ break;
+ }
+ break;
+
+ default:
+ error = ENOTTY;
+ break;
+ }
+ return error;
+}
diff -r 2e455e73933b -r beb64ebf12d0 sys/compat/common/compat_sysv_50_mod.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/compat_sysv_50_mod.c Tue Apr 17 23:06:11 2018 +0000
@@ -0,0 +1,96 @@
+/* $NetBSD: compat_sysv_50_mod.c,v 1.1.2.1 2018/04/17 23:06:11 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software developed for The NetBSD Foundation
+ * by Paul Goyette
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_sysv_50_mod.c,v 1.1.2.1 2018/04/17 23:06:11 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_sysv.h"
Home |
Main Index |
Thread Index |
Old Index