mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-13 20:12:26 +00:00
delay attempt 2
This commit is contained in:
@ -31,6 +31,10 @@ When your kernel starts crashing, get the full trace with:
|
||||
|
||||
./run -n
|
||||
|
||||
See also: <https://unix.stackexchange.com/questions/208260/how-to-scroll-up-after-a-kernel-panic>
|
||||
|
||||
Then if you want your terminal back, hit `Ctrl + C, A` and type `quit`. See also: <http://stackoverflow.com/questions/14165158/how-to-switch-to-qemu-monitor-console-when-running-with-curses>
|
||||
|
||||
1. [Introduction](introduction.md)
|
||||
1. [Build](build.md)
|
||||
1. [kmod](kmod.md)
|
||||
|
||||
@ -7,8 +7,6 @@ Usage:
|
||||
dmesg prints an integer every second until rmmod.
|
||||
|
||||
Since insmod returns, this Illustrates how the work queues are asynchronous.
|
||||
|
||||
TODO: insmod not returning...
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
@ -43,6 +41,9 @@ int init_module(void)
|
||||
|
||||
void cleanup_module(void)
|
||||
{
|
||||
/* This waits for the work to finish. From docstring: */
|
||||
/* > Cancel @work and wait for its execution to finish. */
|
||||
cancel_work_sync(&work);
|
||||
|
||||
destroy_workqueue(queue);
|
||||
}
|
||||
|
||||
@ -9,6 +9,10 @@ Creates a separate thread. So init_module can return, but some work will still g
|
||||
|
||||
Can't call this just workqueue.c because there is already a built-in with that name:
|
||||
https://unix.stackexchange.com/questions/364956/how-can-insmod-fail-with-kernel-module-is-already-loaded-even-is-lsmod-does-not
|
||||
|
||||
Bibliography:
|
||||
|
||||
- https://www.ibm.com/developerworks/library/l-tasklets/
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
||||
Reference in New Issue
Block a user