"insmod inserted the LKM into the kernel, But rmmod not removing it back"
I am learning Kernel module programming and so have tried for the simple example.
#include <asm/current.h>
#include <linux/sched.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static void pro_init(void)
{
printk (KERN_ALERT "The process is \"%s\" (pid %i)\n",current->comm, current->pid);
}
static void pro_exit(void)
{
printk (KERN_ALERT "The process has exited\n");
}
module_init(pro_init);
module_exit(pro_exit);
The program worked with no problems. But when i removed off the last 2 lines of kernel_macros, recompiled the module and inserted it back to the kernel, The module was successfully inserted. lsmod shows the inserted module. Now when i try to unlink the module by 'rmmod' it says 'device/resource busy'.
How come the kernel now is in need of clean_up (module_exit) macro where it didn't bother of 'module_init' macro when i used insmod to insert the module....???
|