I've recently learned about kernel modules and I was thinking on how to create one that does what cat /proc/cpuinfo
does.
Is it possible to do this without opening/reading the file directly (fread)?
Thanks in advance!
I've recently learned about kernel modules and I was thinking on how to create one that does what cat /proc/cpuinfo
does.
Is it possible to do this without opening/reading the file directly (fread)?
Thanks in advance!
/proc/cpuinfo output is generated by kernel code; you can check that code and do the same in your kernel module.
Code is located in fs/proc/cpuinfo.c
It references 'cpuinfo_op' object that is provided by architecture-dependent code, try 'grep cpuinfo_op arch' from toplevel directory of kernel source to locate it.