I wrote small kernel module code as mentioned below,
I am testing it in ubuntu 14.04
#include
#include
#include
#include
int init_mod_func(void)
{
printk(KERN_INFO "My module inserted\n ");
return 0;
}
void cleanup_mod_func(void)
{
printk(KERN_INFO "My module removed\n ");
}
module_init(init_mod_func);
module_exit(cleanup_mod_func);
MODULE_AUTHOR("Ankur");
MODULE_DESCRIPTION("TEST MODULE");
MODULE_LICENSE("GPL");
Now when I compile and insert above module using insmod I don't see printk message in the dmesg. However after module removal using rmmod I see both the printk messages.
With closure look, I found out that it is happening because of space after \n i