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

2019-08-29 12:10发布

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.

标签: c linux inotify
1条回答
来,给爷笑一个
2楼-- · 2019-08-29 12:29

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.

查看更多
登录 后发表回答