I have a program like below.
test_module.c:
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/delay.h>
int init_module(void)
{
while(1) {
pr_info("hello 4 sec\n");
msleep(4 * 1000);
}
return 0;
}
void cleanup_module(void)
{
pr_info("module removed successful\n");
}
When I load this module, my terminal become freeze/blocked. How to stop this program. I tried sudo rmmod test_module
, but no use. So I rebooted my system. How to break the init_module? In future, if something goes wrong and if my init_module
is not ending then what to do? And what happens if we don't stop init_module
?