How to tell which path a fanotify event refers to

天大地大妈咪最大 提交于 2019-12-12 13:27:09

问题


I'd like to find out which files are opened on my system in which order, in order to prefetch them from disk. It seems that fanotify should be well suited to monitor the whole system for open events. But as far as I can tell, the fanotify_event_metadata structure does not have a field to contain the path. So how can I tell which path a given event refers to? Or is fanotify the wrong approach to find path names, and do I have to recursively register watches for the whole tree using inotify?


回答1:


You can use readlink on /proc/self/fd/<fdnum>, where fdnum refers to the fd member of the struct fanotify_event_metadata for the event.



来源:https://stackoverflow.com/questions/13379632/how-to-tell-which-path-a-fanotify-event-refers-to

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