Hello All,
Suppose we have a kernel module that has in it a while(1) loop which simply prints e.g something like this at module initialisation
while(1)
printk("Hello World\n");
There are two problems coming
(1) When I insert the module e.g insmod foo.ko
the system hangs. What may be the causes of this hang. Is this is due to stack overflow etc.
(2) Suppose the above lines in the module begin executing and we are getting a long list of Hello World on our screen, then how can I interrupt this module or in other words break out of while(1) loop.
e.g. in userspace we do CTRL+C etc but in kernel space CTRL+C is not working.
Thanks,
Uzair Lakhani,
Karachi, Pakistan.
while (1) , this is an infina
while (1) , this is an infinate loop so it will print "hello World" until the system is rebooted. The reason being is the module is not releasing the processor to do any meaningful work, it is busy printing your message. You cannot break out of this loop, as it is being run in kernel space.
And, in fact, you may never s
And, in fact, you may never see these messages in the syslog either, because your module never sleeps allowing the userspace syslog to get a chance to run.