0

I am trying to write my own system call in linux kernel version 2.6.32.60. I have added several syscalls, and rebuild the kernel successfully. Also, I've build a module to read and write files to the proc file system.

For the next step, I was wondering if it is possible to add a system call to the kernel to read files in /proc, such as /proc/stat, and show the information?

Thank you.

Nick Wu
  • 1
  • 1
  • What would that system call look like, and how would it differ from existing file operations? `open()` and `read()` already exist, after all… –  Mar 19 '17 at 05:02
  • If you wonder about possibility of reading files from the kernel, then yes, you can, and [that question](http://stackoverflow.com/questions/1184274/how-to-read-write-files-within-a-linux-kernel-module) describes how to do that. Otherwise... what is the **concrete problem** then? – Tsyvarev Mar 19 '17 at 15:30
  • Originally, I would like to implement a system call to calculate and show the CPU usage from the /proc/stat file. Now I found another way to directly get the cpu time information without reading the file. Anyway, thank you guys for answering! – Nick Wu Mar 20 '17 at 15:48

0 Answers0