Inotify 监控多个目录会丢失事件

内核编译和嵌入式产品的设计与开发
回复
feizhijiang
帖子: 10
注册时间: 2011-03-04 15:21

Inotify 监控多个目录会丢失事件

#1

帖子 feizhijiang » 2013-11-05 16:00

最近有用Inotify做项目,但是发现当Inotify监控的目录比较多时,不能监控到所有的事件,会丢失掉一些事件。
大神们知道原因吗?或是有什么解决方法?
头像
zhw2101024
帖子: 1849
注册时间: 2009-03-28 16:10
系统: Arch debian win7
联系:

Re: Inotify 监控多个目录会丢失事件

#2

帖子 zhw2101024 » 2013-11-05 16:45

增加inotify等待队列的最大长度
具体改哪个文件忘记了
头像
adam8157
帖子: 2794
注册时间: 2009-03-05 16:31
联系:

Re: Inotify 监控多个目录会丢失事件

#3

帖子 adam8157 » 2013-11-05 17:31

/proc/sys/fs/inotify (since Linux 2.6.13)
This directory contains files max_queued_events, max_user_instances, and max_user_watches, that can be used to limit the amount of kernel memory consumed by the inotify interface. For further
details, see inotify(7).
feizhijiang
帖子: 10
注册时间: 2011-03-04 15:21

Re: Inotify 监控多个目录会丢失事件

#4

帖子 feizhijiang » 2013-11-05 17:32

zhw2101024 写了:增加inotify等待队列的最大长度
具体改哪个文件忘记了

能说的具体一些吗?到底在哪改?
feizhijiang
帖子: 10
注册时间: 2011-03-04 15:21

Re: Inotify 监控多个目录会丢失事件

#5

帖子 feizhijiang » 2013-12-26 16:01

已经找到原因和解决方法,测试有效

附上链接
http://blog.csdn.net/feizhijiang/articl ... s/14228845
回复