//------------------------------------------------------------------- // jiffies.c // // This simple module create a 'pseudo' file (named 'jiffies') // in the system's '/proc' directory. Then a user can look at // the current value of the kernel's global 'jiffies' variable // just by typing the command: // // $ cat /proc/jiffies // // programmer: ALLAN CRUSE // written on: 24 JAN 2003 //------------------------------------------------------------------- #define __KERNEL__ #define MODULE #include // for init_module() #include // for create_proc_read_entry() #define SUCCESS 0 static char modname[] = "jiffies"; static int my_proc_read( char *buf, char **start, off_t off, int count, int *eof, void *data ) { return sprintf( buf, "\n\tjiffies = %d\n\n", jiffies ); } int init_module( void ) { create_proc_read_entry( modname, 0, NULL, my_proc_read, NULL ); return SUCCESS; } void cleanup_module( void ) { remove_proc_entry( modname, NULL ); } MODULE_LICENSE("GPL");