Jiffies is a global variable defined in Linux header linux/jiffies.h, it represents the number of ticks of system clock from system boot till the time it's value is read. We'll display it's value in a proc file
- Finish workspace setup
- Understand workflow
- Download the folder
jiffiesto local workspace
Almost similar to hello module, just we output current value of jiffies.
- Navigate to Project directory
cd jiffies
- compile Module
sudo make
- Look for
jiffiesin loaded Modules
sudo lsmod | grep jiffies
You will get no results
- Look for file
jiffiesin proc fs
cat /proc/jiffies
you will see :
cat: proc/jiffies: No such file or directory
- Insert Module
sudo insmod jiffies.ko
- Again check for jiffies in module list
sudo lsmod | grep jiffies
- Check the proc file again
cat /proc/jiffies
Now we can see
Current Jiffies value = 4299321332!
- Remove the Module and verify it's gone
sudo rmmod jiffies
sudo lsmod | grep jiffies
No output means module is removed
- Check for proc file again
cat /proc/jiffies
- Additional Header(s)
#include <linux/jiffies.h>
- Inside proc_read modified
sprintf
rv = sprintf(buffer,"Current Jiffies value = %lu\n" ,jiffies);
Note : We declare custom functions and variable as static, this is to limit their scope to current module,otherwise they would be accessible in whole of Kernel and pollute global namespace!
Next up : seconds Module


