Elements of an LKM
Each module object comprises of the init(constructor) and exit(destructor) routines. The init routine is invoked when a module is deployed into kernel address space, and the exit routine is called while the module is being removed. As the name innately suggests, the init routine is usually programmed to carry out operations and actions which are essential to set up the module body: such as registering with a specific kernel subsystem or allocating resources that are essential for the functionality being loaded. However, specific operations programmed within the init and exit routines depend on what the module is designed for and the functionality it brings to the kernel. The following code excerpt shows template of the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access