/* hellomod.c * From Linux Kernel Module Programmer's Guide for 2.4 Kernel. * The simplest kernel module called hello-1 in LKMPG. */ /* kernel module programming */ #ifndef MODULE #define MODULE #endif #ifndef LINUX #define LINUX #endif #ifndef __KERNEL__ #define __KERNEL__ #endif #include /* needed by all modules */ #include /* needed for KERN_ALERT */ /* prototypes */ int init_module(void); void cleanup_module(void); int init_module(void) { printk("<1>Hello module loaded\n"); /* A non-zero return means init_module failed; module can't be loaded */ return 0; } void cleanup_module(void) { printk(KERN_ALERT "Hello module unloaded\n"); } MODULE_LICENSE("GPL");