Module Name: src
Committed By: pgoyette
Date: Wed Jan 22 22:39:27 UTC 2020
Modified Files:
src/sys/kern: kern_module.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/kern/kern_module.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.145 src/sys/kern/kern_module.c:1.146
--- src/sys/kern/kern_module.c:1.145 Tue Jan 21 15:26:36 2020
+++ src/sys/kern/kern_module.c Wed Jan 22 22:39:27 2020
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: kern_module.
#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 @@ int
module_autoload(const char *filename, modclass_t modclass)
{
int error;
+ struct proc *p = curlwp->l_proc;
kernconfig_lock();
@@ -701,6 +703,8 @@ module_autoload(const char *filename, mo
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;
}