module_init.c 607 B

12345678910111213141516171819202122232425262728
  1. /*
  2. https://stackoverflow.com/questions/3218320/what-is-the-difference-between-module-init-and-init-module-in-a-linux-kernel-mod
  3. Hello world with direct init_module and cleantup_module.
  4. This appears to be an older method that still works but has some drawbacks.
  5. vs module_init and module_exit?
  6. - modprobe only works with the module_init / module_exit. Try "modprobe module_init".
  7. */
  8. #include <linux/module.h>
  9. #include <linux/kernel.h>
  10. MODULE_LICENSE("GPL");
  11. int init_module(void)
  12. {
  13. printk(KERN_INFO "init_module\n");
  14. return 0;
  15. }
  16. void cleanup_module(void)
  17. {
  18. printk(KERN_INFO "cleanup_module\n");
  19. }