1 /* Must be included by every module. */
2 #include <linux/module.h>
4 /* Should be declared to not taint the kernel. */
8 #define SUBJECT "world"
11 /* Our init function: returns 0 if successfull, an error code, otherwise. */
12 static int hello_init(void)
14 /* printk is just like printf, but without floating point support. */
15 printk(KERN_ALERT "Hello, " SUBJECT "!\n");
19 /* Our exit function: static is good, so we do not pollute namespace. */
20 static void hello_exit(void)
22 /* KERN_ALERT is a string macro prepended to our message. */
23 printk(KERN_ALERT "Goodbye, cruel " SUBJECT "!\n");
26 /* Here, we declare our module init and exit functions. */
27 module_init(hello_init);
28 module_exit(hello_exit);