Aug. 5, 2015
2:58 a.m.
In this case, no. But I’m curious if there’s a way to pull this off, or if it’s fundamentally impossible?
What happens 'after' __init gets called ? After boot, the kernel frees up a special section. All functions marked with __init and data structures marked with __initdata are dropped after boot is complete. Similarly 'modules' DISCARD this memory after initialization. So what is the workaround ? Write the module_init function without the __init attribute. ( They never read the documentation : /Documentation/DocBook/kernel-hacking.tmpl , I never used to read the documentation either :)