X-Git-Url: https://www.hackdaworld.org/gitweb/?a=blobdiff_plain;f=hello%2Fhello.c;h=3b236b8e85aaf25eb208cfefe7370bc9ba7be687;hb=HEAD;hp=cf6bd93155f292c0aa78b06e4dce4eea841ae75d;hpb=03c307fe6b73ddf913a16e30c517c25bfa91a2f4;p=my-code%2Fkernel.git diff --git a/hello/hello.c b/hello/hello.c index cf6bd93..3b236b8 100644 --- a/hello/hello.c +++ b/hello/hello.c @@ -1,17 +1,22 @@ -/* my first kernel driver :-) */ +/* + * hello world kernel module + * + */ #include -#include -#include +#include +#include -int init_module(void) { - printk(KERN_ALERT "hi hackbard, here is your kernel speaking! :)\n"); - printk(KERN_ALERT "some info : %s has process id %i\n",current->comm, - current->pid); - return 0; +//MODULE_LICENSE("GPL"); + +static int __init name_of_initialization_routine(void) { + printk(KERN_INFO "hello world, this is your kernel speaking\n"); + return 0; } -void cleanup_module(void) { - printk(KERN_ALERT "bye hackbard ...\n"); +static void __exit name_of_cleanup_routine(void) { + printk(KERN_INFO "good bye world!\n"); } +module_init(name_of_initialization_routine); +module_exit(name_of_cleanup_routine);