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