-
A Stupid Question
Ok I have just started reading how to program kernel modules from a really really old source, my question is why the static __init and static __exit aren't needed any more ?? i am using fedora 12 and they are caught as errors. According to that source the syntax of init_module and cleanup_module should be:
Code:
static __init int init_module(void){
// ...
return 0 ;
}
static __exit void cleanup_module(void){
// ...
}
But they just work fine without the static __init and static __exit. Could someone plz explain ??
-
Older kernels used this form so that the kernel knew what functions to call when loading or unloading a kernel module (driver). More current Linux kernels use the macros module_init(init_func_name) and module_exit(exit_func_name) to inform the kernel of that same information. You can download free a copy of "Linux Device Drivers, 3rd Edition" as a single PDF from here: http://www.davehylands.com/Misc/Linu...rd-Edition.pdf
It is also available in pdf-per-chapter form officially from here: Linux Device Drivers, Third Edition [LWN.net]
-
Thank u. And thank u for the pdf. :D :D U rock.