Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/common Fix the #ifdef _MODULE stuff so that the s...



details:   https://anonhg.NetBSD.org/src/rev/79f95f80fe2d
branches:  trunk
changeset: 808263:79f95f80fe2d
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Mon May 11 10:32:13 2015 +0000

description:
Fix the #ifdef _MODULE stuff so that the syscall packages and sysctl stuff
gets handled properly even in built-in module case.

XXX
Whatever was I thinking when I put those conditionals in?  And wouldn't it
be a wonderful thing to have some atf regression tests to actually catch
errors in the compat{,_sysv} modules?   :)

diffstat:

 sys/compat/common/compat_mod.c      |  22 ++++------------------
 sys/compat/common/compat_sysv_mod.c |  10 ++--------
 2 files changed, 6 insertions(+), 26 deletions(-)

diffs (137 lines):

diff -r f1c7c9b85b50 -r 79f95f80fe2d sys/compat/common/compat_mod.c
--- a/sys/compat/common/compat_mod.c    Mon May 11 08:24:50 2015 +0000
+++ b/sys/compat/common/compat_mod.c    Mon May 11 10:32:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.c,v 1.21 2015/05/10 07:41:15 pgoyette Exp $ */
+/*     $NetBSD: compat_mod.c,v 1.22 2015/05/11 10:32:13 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.21 2015/05/10 07:41:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.22 2015/05/11 10:32:13 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -60,17 +60,15 @@
 #include <compat/common/compat_util.h>
 #include <compat/common/compat_mod.h>
 
-#ifdef _MODULE
 #if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_50)
 static struct sysctllog *compat_clog = NULL;
 #endif
-#endif
  
 MODULE(MODULE_CLASS_EXEC, compat, NULL);
 
-#ifdef _MODULE
 int    ttcompat(struct tty *, u_long, void *, int, struct lwp *);
 
+#ifdef _MODULE
 #ifdef COMPAT_16
 #if !defined(__amd64__) || defined(COMPAT_NETBSD32)
 #define COMPAT_SIGCONTEXT
@@ -78,6 +76,7 @@
 struct uvm_object *emul_netbsd_object;
 #endif
 #endif
+#endif /* _MODULE */
 
 extern krwlock_t exec_lock;
 extern krwlock_t ttcompat_lock;
@@ -230,12 +229,10 @@
 #endif
        { 0, 0, NULL },
 };
-#endif /* _MODULE */
 
 static int
 compat_modcmd(modcmd_t cmd, void *arg)
 {
-#ifdef _MODULE
 #ifdef COMPAT_16
        proc_t *p;
 #endif
@@ -326,18 +323,8 @@
        default:
                return ENOTTY;
        }
-#else /* _MODULE */
-       switch (cmd) {
-       case MODULE_CMD_INIT:
-       case MODULE_CMD_FINI:
-               return 0;
-       default:
-               return ENOTTY;
-       }
-#endif
 }
 
-#ifdef _MODULE
 void
 compat_sysctl_init(void)
 {
@@ -358,4 +345,3 @@
         sysctl_teardown(&compat_clog);
 #endif
 }
-#endif
diff -r f1c7c9b85b50 -r 79f95f80fe2d sys/compat/common/compat_sysv_mod.c
--- a/sys/compat/common/compat_sysv_mod.c       Mon May 11 08:24:50 2015 +0000
+++ b/sys/compat/common/compat_sysv_mod.c       Mon May 11 10:32:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_sysv_mod.c,v 1.1 2015/05/10 07:41:15 pgoyette Exp $     */
+/*     $NetBSD: compat_sysv_mod.c,v 1.2 2015/05/11 10:32:13 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_sysv_mod.c,v 1.1 2015/05/10 07:41:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_sysv_mod.c,v 1.2 2015/05/11 10:32:13 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -50,7 +50,6 @@
 
 MODULE(MODULE_CLASS_EXEC, compat_sysv, NULL);
 
-#ifdef _MODULE
 static const struct syscall_package compat_sysv_syscalls[] = {
 #if defined(COMPAT_10) && !defined(_LP64)
 # if defined(SYSVMSG)
@@ -89,7 +88,6 @@
 #endif
        { 0, 0, NULL },
 };
-#endif
 
 int sysctl_kern_sysvipc50(SYSCTLFN_ARGS);
 
@@ -100,20 +98,16 @@
 
        switch (cmd) {
        case MODULE_CMD_INIT:
-#ifdef _MODULE
                /* Link the system calls */
                error = syscall_establish(NULL, compat_sysv_syscalls);
-#endif
 #ifdef COMPAT_50
                sysvipc50_set_compat_sysctl(sysctl_kern_sysvipc50);
 #endif
                return error;
 
        case MODULE_CMD_FINI:
-#ifdef _MODULE
                /* Unlink the system calls. */
                error = syscall_disestablish(NULL, compat_sysv_syscalls);
-#endif
 #ifdef COMPAT_50
                sysvipc50_set_compat_sysctl(NULL);
 #endif



Home | Main Index | Thread Index | Old Index