-2

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!

2
  • Could you try to prepare some example(s) and ask more specific question please? Commented Oct 10, 2018 at 13:42
  • Possible duplicate question. But can't you get the cpu info directly from the processor itself? Commented Oct 10, 2018 at 13:52

1 Answer 1

0

/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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.