Why can't I monitor /proc using the inotify C API? Is it special?

徘徊边缘 提交于 2019-12-13 05:18:31

问题


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.



来源:https://stackoverflow.com/questions/24897799/why-cant-i-monitor-proc-using-the-inotify-c-api-is-it-special

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!