//------------------------------------------------------------------- // jiffies.c // // This module creates a pseudo-file (named '/proc/jiffies') in // order to give users a way to obtain the current value of the // kernel's 'jiffies' global variable. That variable is set to // zero during system startup, and thereafter is incremented by // the Interrupt Service Routine for the system timer, which is // programmed on x86 systems to generate periodic interrupts at // the rate of 1000-per-second (Linux kernels prior to 2.6 used // the slower rate of 100-per-second). // // NOTE: Developed and tested with Linux kernel version 2.6.10. // // programmer: ALLAN CRUSE // written on: 27 JAN 2005 //------------------------------------------------------------------- #include // for init_module() #include // for create_proc_info_entry() static char modname[] = "jiffies"; static int my_get_info( char *buf, char **start, off_t off, int count ) { int len; len = 0; len += sprintf( buf+len, " jiffies = %lu ", jiffies ); len += sprintf( buf+len, "\n" ); return len; } int init_module( void ) { printk( "<1>\nInstalling \'%s\' module\n", modname ); create_proc_info_entry( modname, 0, NULL, my_get_info ); return 0; //SUCCESS } void cleanup_module( void ) { remove_proc_entry( modname, NULL ); printk( "<1>Removing \'%s\' module\n", modname ); } MODULE_LICENSE("GPL");