mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 10:15:57 +01:00
readme: more info on kernel panics, oops an backtraces.
myinsmod: use either finit or init
This commit is contained in:
23
kernel_module/warn_on.c
Normal file
23
kernel_module/warn_on.c
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Prints a backtrace.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
static int myinit(void)
|
||||
{
|
||||
pr_info("warn_on init\n");
|
||||
WARN_ON("warn_on do it");
|
||||
pr_info("warn_on after\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void myexit(void)
|
||||
{
|
||||
pr_info("warn_on cleanup\n");
|
||||
}
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
Reference in New Issue
Block a user