• «
  • 1
  • 2
  • »
  • Pages: 1/2     Go
主题 : 想实现linux下对文件系统的监控… 复制链接 | 浏览器收藏 | 打印
级别: 侠客
UID: 5071
精华: 0
发帖: 50
金钱: 390 两
威望: 297 点
综合积分: 100 分
注册时间: 2009-04-09
最后登录: 2013-12-20
楼主  发表于: 2009-05-18 13:07

 想实现linux下对文件系统的监控…

如题,想实现对文件系统的监控,比如有创建文件、修改、打开、删除啦,都会记录下。该怎么做呢?
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2009-05-18 13:29
inotify是一个目前比较主流的选择
http://www.linuxjournal.com/article/8478
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 侠客
UID: 5071
精华: 0
发帖: 50
金钱: 390 两
威望: 297 点
综合积分: 100 分
注册时间: 2009-04-09
最后登录: 2013-12-20
2楼  发表于: 2009-05-18 13:55
http://www.ibm.com/developerworks/cn/linux/l-inotify.html
这个暂没成功,手动创建的设备,使用它那个sample去测试,报错。
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2009-05-18 15:28
楼主加油...
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 侠客
UID: 5071
精华: 0
发帖: 50
金钱: 390 两
威望: 297 点
综合积分: 100 分
注册时间: 2009-04-09
最后登录: 2013-12-20
4楼  发表于: 2009-05-18 15:35
arm-linux-gcc缺少inotify.h怎么弄?
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
5楼  发表于: 2009-05-18 15:39
没有?不会吧,至少4.3.2的toolchain里肯定有:

alex@alex-desktop:~$ find /usr/local/arm/4.3.2/arm-none-linux-gnueabi/ -name "inotify*"
/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include/linux/inotify.h
/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include/sys/inotify.h
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
6楼  发表于: 2009-05-18 15:41
你的toolchain里没有的话就从你用的开发板内核源代码目录下拷吧,应该在include/linux/inotify.h
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 侠客
UID: 5071
精华: 0
发帖: 50
金钱: 390 两
威望: 297 点
综合积分: 100 分
注册时间: 2009-04-09
最后登录: 2013-12-20
7楼  发表于: 2009-05-18 15:42
我用的是3.4.1……
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
8楼  发表于: 2009-05-18 15:44
大哥,那篇IBM DW上的文章早过时了,参考我上面贴的链接吧
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 侠客
UID: 5071
精华: 0
发帖: 50
金钱: 390 两
威望: 297 点
综合积分: 100 分
注册时间: 2009-04-09
最后登录: 2013-12-20
9楼  发表于: 2009-05-18 15:48
拷过去的貌似没用……
  • «
  • 1
  • 2
  • »
  • Pages: 1/2     Go