Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Enhance debug message when autoloading a module. I...



details:   https://anonhg.NetBSD.org/src/rev/e9ce987afd74
branches:  trunk
changeset: 1006671:e9ce987afd74
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed Jan 22 22:39:27 2020 +0000

description:
Enhance debug message when autoloading a module.  Identify the pid
of the process that triggered the autoload, as well as its p_comm
and the status.

This is only triggered if you've requested DEBUG messages by setting
the kern.module.verbose sysctl(8) variable.

diffstat:

 sys/kern/kern_module.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (43 lines):

diff -r e38a57738fce -r e9ce987afd74 sys/kern/kern_module.c
--- a/sys/kern/kern_module.c    Wed Jan 22 22:29:28 2020 +0000
+++ b/sys/kern/kern_module.c    Wed Jan 22 22:39:27 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_module.c,v 1.145 2020/01/21 15:26:36 christos Exp $       */
+/*     $NetBSD: kern_module.c,v 1.146 2020/01/22 22:39:27 pgoyette 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.145 2020/01/21 15:26:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.146 2020/01/22 22:39:27 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -47,6 +47,7 @@
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
+#include <sys/lwp.h>
 #include <sys/kauth.h>
 #include <sys/kobj.h>
 #include <sys/kmem.h>
@@ -677,6 +678,7 @@
 module_autoload(const char *filename, modclass_t modclass)
 {
        int error;
+       struct proc *p = curlwp->l_proc;
 
        kernconfig_lock();
 
@@ -701,6 +703,8 @@
                error = module_do_load(filename, false, 0, NULL, NULL, modclass,
                    true);
 
+       module_print("Autoload for `%s' requested by pid %d (%s), status %d\n",
+           filename, p->p_pid, p->p_comm, error);
        kernconfig_unlock();
        return error;
 }



Home | Main Index | Thread Index | Old Index