kernel-module/hello-2.c

18 lines
567 B
C

#include <linux/init.h> /* Needed for the __init, __initdata and __exit macros. */
#include <linux/module.h> /* for all kernel modules */
#include <linux/kernel.h> /* for KERN_INFO */
#include <linux/moduleparam.h> /* Needed for module_param() */
static int intParameter = 420;
module_param(intParameter, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(intParameter, "An integer");
static void __exit exit_module(void) /* module exit point */
{
printk(KERN_INFO "Goodbye , user param %d!\n", intParameter);
return;
}
module_exit(exit_module);