Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/pgoyette-compat]: src Add compat_13 module



details:   https://anonhg.NetBSD.org/src/rev/95e2ebb2b743
branches:  pgoyette-compat
changeset: 321131:95e2ebb2b743
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Mar 30 11:18:34 2018 +0000

description:
Add compat_13 module

diffstat:

 distrib/sets/lists/modules/mi     |   4 +-
 sys/compat/common/compat_13_mod.c |  97 +++++++++++++++++++++++++++++++++++++++
 sys/compat/common/compat_mod.c    |  21 +-------
 sys/compat/common/compat_mod.h    |  11 ++++-
 sys/compat/common/files.common    |   3 +-
 sys/compat/common/kern_sig_13.c   |  36 +++++++++++++-
 sys/modules/Makefile              |   4 +-
 sys/modules/compat_13/Makefile    |  16 ++++++
 8 files changed, 167 insertions(+), 25 deletions(-)

diffs (truncated from 331 to 300 lines):

diff -r 770f3842c958 -r 95e2ebb2b743 distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi     Fri Mar 30 11:15:25 2018 +0000
+++ b/distrib/sets/lists/modules/mi     Fri Mar 30 11:18:34 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.11 2018/03/30 10:09:07 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.12 2018/03/30 11:18:34 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -68,6 +68,8 @@
 ./@MODULEDIR@/coda5/coda5.kmod                 base-kernel-modules     kmod
 ./@MODULEDIR@/compat                           base-kernel-modules     kmod
 ./@MODULEDIR@/compat/compat.kmod               base-kernel-modules     kmod
+./@MODULEDIR@/compat_13                                base-kernel-modules     kmod
+./@MODULEDIR@/compat_13/compat_13.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_14                                base-kernel-modules     kmod
 ./@MODULEDIR@/compat_14/compat_14.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_16                                base-kernel-modules     kmod
diff -r 770f3842c958 -r 95e2ebb2b743 sys/compat/common/compat_13_mod.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/compat_13_mod.c Fri Mar 30 11:18:34 2018 +0000
@@ -0,0 +1,97 @@
+/*     $NetBSD: compat_13_mod.c,v 1.1.2.1 2018/03/30 11:18:34 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.
+ */
+
+/*
+ * Linkage for the compat module: spaghetti.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_13_mod.c,v 1.1.2.1 2018/03/30 11:18:34 pgoyette Exp $");
+
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/sysctl.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
+#include <sys/syscallargs.h>
+
+#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
+
+int
+compat_13_init(void)
+{
+       int error;
+
+       error = kern_sig_13_init();
+       if (error != 0)
+               return error;
+
+       uvm_13_init();
+       return 0;
+}
+
+int
+compat_13_fini(void)
+{
+       int error;
+
+       uvm_13_fini();
+       error = kern_sig_13_fini();
+       if (error != 0) {
+               uvm_13_init();
+               return error;
+       }
+
+       return 0;
+}
+
+#ifdef _MODULE
+
+#define REQD_13_1      "compat_70,compat_60,compat_50,compat_40,"
+#define REQD_13_2      "compat_30,compat_20,compat_16,compat_14"
+
+MODULE(MODULE_CLASS_EXEC, compat_13, REQD_13_1 REQD_13_2);
+
+static int
+compat_13_modcmd(modcmd_t cmd, void *arg)
+{
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+               return compat_13_init();
+       case MODULE_CMD_FINI:
+               return compat_13_init();
+       default:
+               return ENOTTY;
+       }
+}
+#endif
diff -r 770f3842c958 -r 95e2ebb2b743 sys/compat/common/compat_mod.c
--- a/sys/compat/common/compat_mod.c    Fri Mar 30 11:15:25 2018 +0000
+++ b/sys/compat/common/compat_mod.c    Fri Mar 30 11:18:34 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.c,v 1.24.14.27 2018/03/30 10:09:07 pgoyette Exp $   */
+/*     $NetBSD: compat_mod.c,v 1.24.14.28 2018/03/30 11:18:34 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.27 2018/03/30 10:09:07 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.28 2018/03/30 11:18:34 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -140,15 +140,6 @@
        { SYS_compat_12_stat12, 0, (sy_call_t *)compat_12_sys_stat },
 #endif
 
-#if defined(COMPAT_13)
-       { SYS_compat_13_sigaction13, 0, (sy_call_t *)compat_13_sys_sigaction },
-       { SYS_compat_13_sigaltstack13, 0, (sy_call_t *)compat_13_sys_sigaltstack },
-       { SYS_compat_13_sigpending13, 0, (sy_call_t *)compat_13_sys_sigpending },
-       { SYS_compat_13_sigprocmask13, 0, (sy_call_t *)compat_13_sys_sigprocmask },
-       { SYS_compat_13_sigreturn13, 0, (sy_call_t *)compat_13_sys_sigreturn },
-       { SYS_compat_13_sigsuspend13, 0, (sy_call_t *)compat_13_sys_sigsuspend },
-#endif
-
        { 0, 0, NULL },
 };
 
@@ -180,10 +171,10 @@
 #ifdef COMPAT_14
        { compat_14_init, compat_14_fini },
 #endif
-#if 0  /* NOT YET */
 #ifdef COMPAT_13
        { compat_13_init, compat_13_fini },
 #endif
+#if 0  /* NOT YET */
 #ifdef COMPAT_12
        { compat_12_init, compat_12_fini },
 #endif
@@ -242,9 +233,6 @@
  * XXX */
 #endif
 #endif /* XXX NOTYET */
-#ifdef COMPAT_13
-               uvm_13_init();
-#endif
 #ifdef COMPAT_10
                vfs_syscalls_10_init();
 #endif
@@ -255,9 +243,6 @@
 #ifdef COMPAT_10
                vfs_syscalls_10_fini();
 #endif
-#ifdef COMPAT_13
-               uvm_13_fini();
-#endif
                /* Unlink the system calls. */
                error = syscall_disestablish(NULL, compat_syscalls);
                if (error != 0) {
diff -r 770f3842c958 -r 95e2ebb2b743 sys/compat/common/compat_mod.h
--- a/sys/compat/common/compat_mod.h    Fri Mar 30 11:15:25 2018 +0000
+++ b/sys/compat/common/compat_mod.h    Fri Mar 30 11:18:34 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.h,v 1.1.42.15 2018/03/30 10:09:07 pgoyette Exp $    */
+/*     $NetBSD: compat_mod.h,v 1.1.42.16 2018/03/30 11:18:34 pgoyette Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -130,4 +130,13 @@
 void rtsock_14_fini(void);
 #endif
 
+#ifdef COMPAT_13
+int compat_13_init(void);
+int compat_13_fini(void);
+int kern_sig_13_init(void);
+int kern_sig_13_fini(void);
+void uvm_13_init(void);
+void uvm_13_fini(void);
+#endif
+
 #endif /* !_COMPAT_MOD_H_ */
diff -r 770f3842c958 -r 95e2ebb2b743 sys/compat/common/files.common
--- a/sys/compat/common/files.common    Fri Mar 30 11:15:25 2018 +0000
+++ b/sys/compat/common/files.common    Fri Mar 30 11:18:34 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.common,v 1.1.2.27 2018/03/30 10:09:07 pgoyette Exp $
+#      $NetBSD: files.common,v 1.1.2.28 2018/03/30 11:18:34 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -34,6 +34,7 @@
 file   compat/common/vm_12.c                   compat_12
 
 # Compatibility code for NetBSD 1.3
+file   compat/common/compat_13_mod.c           compat_13
 file   compat/common/kern_sig_13.c             compat_13
 file   compat/common/uvm_13.c                  compat_13
 
diff -r 770f3842c958 -r 95e2ebb2b743 sys/compat/common/kern_sig_13.c
--- a/sys/compat/common/kern_sig_13.c   Fri Mar 30 11:15:25 2018 +0000
+++ b/sys/compat/common/kern_sig_13.c   Fri Mar 30 11:18:34 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig_13.c,v 1.20 2011/01/19 10:21:16 tsutsui Exp $ */
+/*     $NetBSD: kern_sig_13.c,v 1.20.56.1 2018/03/30 11:18:34 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig_13.c,v 1.20 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig_13.c,v 1.20.56.1 2018/03/30 11:18:34 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -38,6 +38,8 @@
 #include <sys/signalvar.h>
 #include <sys/systm.h>
 
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
 #include <sys/syscallargs.h>
 
 #include <machine/limits.h>
@@ -46,6 +48,22 @@
 #include <compat/sys/signalvar.h>
 #include <compat/common/compat_util.h>
 #include <compat/common/compat_sigaltstack.h>
+#include <compat/common/compat_mod.h>
+
+static const struct syscall_package kern_sig_13_syscalls[] = {
+        { SYS_compat_13_sigaction13, 0, (sy_call_t *)compat_13_sys_sigaction },
+        { SYS_compat_13_sigaltstack13, 0,
+           (sy_call_t *)compat_13_sys_sigaltstack },
+        { SYS_compat_13_sigpending13, 0,
+           (sy_call_t *)compat_13_sys_sigpending },
+        { SYS_compat_13_sigprocmask13, 0,
+           (sy_call_t *)compat_13_sys_sigprocmask },
+        { SYS_compat_13_sigsuspend13, 0,
+           (sy_call_t *)compat_13_sys_sigsuspend },
+       /* compat_13_sigreturn13 is in MD code! */
+        { SYS_compat_13_sigreturn13, 0, (sy_call_t *)compat_13_sys_sigreturn },
+       { 0, 0, NULL }
+};
 
 void
 native_sigset13_to_sigset(const sigset13_t *oss, sigset_t *ss)
@@ -173,3 +191,17 @@
        native_sigset13_to_sigset(&ess, &bss);
        return (sigsuspend1(l, &bss));
 }
+
+int
+kern_sig_13_init(void)
+{
+
+       return syscall_establish(NULL, kern_sig_13_syscalls);
+}
+
+int
+kern_sig_13_fini(void)
+{
+
+       return syscall_disestablish(NULL, kern_sig_13_syscalls);
+}
diff -r 770f3842c958 -r 95e2ebb2b743 sys/modules/Makefile
--- a/sys/modules/Makefile      Fri Mar 30 11:15:25 2018 +0000
+++ b/sys/modules/Makefile      Fri Mar 30 11:18:34 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.202.2.15 2018/03/30 10:09:08 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.202.2.16 2018/03/30 11:18:34 pgoyette Exp $
 



Home | Main Index | Thread Index | Old Index