Why can't I monitor /proc using the inotify C

2019-08-29 11:49发布

问题:

I've written a few lines of C code using the inotify API. When I monitor for IN_CREATE and IN_DELETE for /tmp it works no problem. I can detect when I add or delete folders in /tmp.

When I change the monitored folder to /proc, I do not get notified when a new directory is created in /proc due to a process launch.

I assume this is because /proc is special in some way. Can anyone explain why this is the case or what I might do to allow inotify to watch that folder?

Thanks.

回答1:

The stuff in /proc is a pseudo-filesystem, they aren't actually files. The purpose of the interface is to allow userland processes to read or set kernel parameters with a familiar interface.



标签: c linux inotify