I'm trying to read from /proc/<PID>/maps
file. I ptrace(PTRACE_ATTACH, <PID>)
before reading (so, the process is supposed to be suspended).
The code that reads looks like this:
while(fgets(line_buf, BUFSIZ, maps_fd) != NULL){ ... }
but it's not ending (infinite loop). I did a printf line_buf
and in turns out fgets it reading lines that it has read already.
Questions: What could be changing my maps file? (if anything is changing it)
If the file ins't changed by something else, why is fgets reading lines that it has read already?