kernelmod_demo/demo_module.c

28 lines
556 B
C
Raw Permalink Normal View History

2024-06-12 12:30:17 +02:00
#include <linux/module.h>
2024-06-12 12:31:30 +02:00
#include <linux/kernel.h>
2024-06-12 12:30:17 +02:00
#include <linux/init.h>
/* Meta Info */
MODULE_DESCRIPTION("Demo kernel module.");
MODULE_VERSION("0.0.1");
MODULE_AUTHOR("Imbus");
MODULE_LICENSE("GPL");
/**
* @brief Called on load
*/
static int __init demo_mod_init(void) {
2024-06-12 12:31:30 +02:00
printk(KERN_INFO "Demo module loaded successfully...");
2024-06-12 12:30:17 +02:00
return 0;
}
/**
* @brief Called on unload
*/
static void __exit demo_mod_exit(void) {
2024-06-12 12:31:30 +02:00
printk(KERN_INFO "Demo module unloaded successfully...");
2024-06-12 12:30:17 +02:00
}
module_init(demo_mod_init);
module_exit(demo_mod_exit);