test_module.c 753 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * This module emits "Hello, world" on printk when loaded.
  3. *
  4. * It is designed to be used for basic evaluation of the module loading
  5. * subsystem (for example when validating module signing/verification). It
  6. * lacks any extra dependencies, and will not normally be loaded by the
  7. * system unless explicitly requested by name.
  8. */
  9. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  10. #include <linux/init.h>
  11. #include <linux/module.h>
  12. #include <linux/printk.h>
  13. static int __init test_module_init(void)
  14. {
  15. pr_warn("Hello, world\n");
  16. return 0;
  17. }
  18. module_init(test_module_init);
  19. static void __exit test_module_exit(void)
  20. {
  21. pr_warn("Goodbye\n");
  22. }
  23. module_exit(test_module_exit);
  24. MODULE_AUTHOR("Kees Cook <keescook@chromium.org>");
  25. MODULE_LICENSE("GPL");