Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * This module emits "Hello, world" on printk when loaded.
0004  *
0005  * It is designed to be used for basic evaluation of the module loading
0006  * subsystem (for example when validating module signing/verification). It
0007  * lacks any extra dependencies, and will not normally be loaded by the
0008  * system unless explicitly requested by name.
0009  */
0010 
0011 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
0012 
0013 #include <linux/init.h>
0014 #include <linux/module.h>
0015 #include <linux/printk.h>
0016 
0017 static int __init test_module_init(void)
0018 {
0019     pr_warn("Hello, world\n");
0020 
0021     return 0;
0022 }
0023 
0024 module_init(test_module_init);
0025 
0026 static void __exit test_module_exit(void)
0027 {
0028     pr_warn("Goodbye\n");
0029 }
0030 
0031 module_exit(test_module_exit);
0032 
0033 MODULE_AUTHOR("Kees Cook <keescook@chromium.org>");
0034 MODULE_LICENSE("GPL");