linux-dev/hello.c

26 lines
569 B
C
Raw Normal View History

2023-03-21 08:19:59 +00:00
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Inex Code");
MODULE_DESCRIPTION("A hello world");
MODULE_VERSION("0.0.2");
static char *whom = "world";
module_param(whom, charp, 0);
static int howmany = 1;
module_param(howmany, int, 0);
static int __init hello_init(void) {
int i;
for (i = 0; i < howmany; i++)
printk(KERN_INFO "Hello %s.\n", whom);
return 1;
}
static void __exit hello_goodbye(void) {
printk(KERN_INFO "Goodbye cruel %s.\n", whom);
}
module_init(hello_init);
module_exit(hello_goodbye);