1
I need to make a System Call that receives a PID as parameter and returns the number of bytes that this process read from the standard input, disk, and how many bytes it wrote on the USB port. As I am a little new in programming for Linux, I’m a little lost, but researching a lot I discovered the System Call "ptrace" and I think it can help a lot. I am using the Ubuntu Kernel 4.3 environment. If anyone can give a light I really appreciate it.
I think ptrace does not allow to monitor an already active process, at least, every time I had to use it was necessary to start the process with trace. Did you ever look at the /proc' directory documentation? All statistics of a process are in the directory /proc/[PID]; that would be my starting point.
– PerryWerneck
Your question is with 4 votes to close as too wide at this time (with 5 it closes). However, reading your question carefully, it seems to me to be a valid question. What you want is to use C on Ubuntu, find out what is the IO data of a particular process for which you have PID. Is that it? If yes, your question is perfectly valid and should not be closed.
– Victor Stafusa