Results 1 to 3 of 3
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 ...
- 04-12-2011 #1Just Joined!
- Join Date
- Dec 2009
- Location
- Rajshahi || Dhaka, Bangladesh
- Posts
- 11
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:
But they just work fine without the static __init and static __exit. Could someone plz explain ??Code:static __init int init_module(void){ // ... return 0 ; } static __exit void cleanup_module(void){ // ... }
- 04-13-2011 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,961
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]Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 04-13-2011 #3Just Joined!
- Join Date
- Dec 2009
- Location
- Rajshahi || Dhaka, Bangladesh
- Posts
- 11
Thank u. And thank u for the pdf.
U rock.


Reply With Quote
