2010.01.12 Added two test programs to read the /proc/xtime procfile with an fgets and compare the times with what gettimeofday system call returns. insmod ./procfsreadxtime.o insert the module lsmod see if the modules has loaded ./procfsreadxtime read the /proc/xtime and display ./comparetimeofday compare /proc/xtime with gettimeofday rmmod procfsreadxtime unload module lsmod see if the modules has unloaded 2010.01.12 Revised to pass back xtime.tv_sec and xtime.tv_usec together as a string. Change the test sequence below to insmod ./procfsreadxtime.o insert the module lsmod see if the modules has loaded tail /var/log/syslog see module load message ls /proc/xtime see if the file /proc/test is there cat /proc/xtime read the procfile, watch count go up. cat /proc/xtime read the procfile, watch count go up again. cat /proc/xtime read the procfile, watch count go up again. tail /var/log/syslog see module read messages rmmod procfsreadxtime unload module lsmod see if the modules has unloaded less /var/log/syslog see module unload message. Read all the messages produced by this module. 2010.01.12 Note that "leaving via shortcut" is not really what is happening. The early return test is simulating an end of file. File IO system calls keep reading until an EOF is encountered, which is interpreted as a zero length is returned. The test just makes sure that after exactly one read the proc file read function returns zero so the file IO system function gets the EOF that it is looking for. 2009.07.27 Seems to work OK, but does two "leaving via shortcut" calls instead of one. Why is that? This needs to be explained and then fixed. insmod ./procfsread.o insert the module lsmod see if the modules has loaded tail /var/log/syslog see module load message ls /proc/test see if the file /proc/test is there cat /proc/test read the procfile, watch count go up. cat /proc/test read the procfile, watch count go up again. cat /proc/test read the procfile, watch count go up again. tail /var/log/syslog see module read messages rmmod procfsread unload module lsmod see if the modules has unloaded less /var/log/syslog see module unload message. Read all the messages produced by this module.