Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Move the listener plugging to module_init(), as it ...



details:   https://anonhg.NetBSD.org/src/rev/8e830592178f
branches:  trunk
changeset: 750390:8e830592178f
user:      elad <elad%NetBSD.org@localhost>
date:      Tue Dec 29 17:49:21 2009 +0000

description:
Move the listener plugging to module_init(), as it runs after kauth_init()
now. (Leaving only the module kthread creation in module_init2().)

diffstat:

 sys/kern/kern_module.c |  42 +++++++++++++++++++++---------------------
 1 files changed, 21 insertions(+), 21 deletions(-)

diffs (78 lines):

diff -r d7305709a232 -r 8e830592178f sys/kern/kern_module.c
--- a/sys/kern/kern_module.c    Tue Dec 29 17:32:18 2009 +0000
+++ b/sys/kern/kern_module.c    Tue Dec 29 17:49:21 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_module.c,v 1.54 2009/11/18 17:40:45 pooka Exp $   */
+/*     $NetBSD: kern_module.c,v 1.55 2009/12/29 17:49:21 elad Exp $    */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.54 2009/11/18 17:40:45 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.55 2009/12/29 17:49:21 elad Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -137,6 +137,23 @@
        }
 }
 
+static int
+module_listener_cb(kauth_cred_t cred, kauth_action_t action, void *cookie,
+    void *arg0, void *arg1, void *arg2, void *arg3)
+{
+       int result;
+
+       result = KAUTH_RESULT_DEFER;
+
+       if (action != KAUTH_SYSTEM_MODULE)
+               return result;
+
+       if ((uintptr_t)arg2 != 0)       /* autoload */
+               result = KAUTH_RESULT_ALLOW;
+
+       return result;
+}
+
 /*
  * module_init:
  *
@@ -165,23 +182,9 @@
            machine, __NetBSD_Version__ / 100000000,
            __NetBSD_Version__ / 1000000 % 100);
 #endif
-}
 
-static int
-module_listener_cb(kauth_cred_t cred, kauth_action_t action, void *cookie,
-    void *arg0, void *arg1, void *arg2, void *arg3)
-{
-       int result;
-
-       result = KAUTH_RESULT_DEFER;
-
-       if (action != KAUTH_SYSTEM_MODULE)
-               return result;
-
-       if ((uintptr_t)arg2 != 0)       /* autoload */
-               result = KAUTH_RESULT_ALLOW;
-
-       return result;
+       module_listener = kauth_listen_scope(KAUTH_SCOPE_SYSTEM,
+           module_listener_cb, NULL);
 }
 
 /*
@@ -198,9 +201,6 @@
            NULL, NULL, "modunload");
        if (error != 0)
                panic("module_init: %d", error);
-
-       module_listener = kauth_listen_scope(KAUTH_SCOPE_SYSTEM,
-           module_listener_cb, NULL);
 }
 
 SYSCTL_SETUP(sysctl_module_setup, "sysctl module setup")



Home | Main Index | Thread Index | Old Index