문제

Is there a way to tell if the contents of the stat/status file for a process has changed, without opening it?

I was thinking you could just check the last-modified time, however the timestamp almost never changes. I coded this using stat(), however it did not return the desired effect (same with ls under the shell.)

It's quite possible I'm looking about this the wrong way. I'm just wanting to be able to constantly probe the stat values of the process, similar to the top command (and no, taking data from top is nowhere near acceptable.)

도움이 되었습니까?

해결책

You can't do this using any normal I/O operations on stat/status because they're not true files.

https://unix.stackexchange.com/questions/90627/notify-of-changes-on-a-file-under-proc explains why you can't work with these files like with regular files.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top