监视linux中文件系统更改的最佳方法 [英] Best way to monitor file system changes in linux

查看:179
本文介绍了监视linux中文件系统更改的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究构建一个监视文件系统活动的文件系统同步实用程序,但看起来Linux内核中的一些文件系统监视功能已经过时或者没有完全显示。



我的研究结果发现

dnotify第一个通知具有通知删除,修改,访问,属性,创建,移动的功能确定文件描述符,但现在过时inotify和fanotify inotify出来第二个通知具有通知访问,修改,attrib,关闭,移动,删除的功能,创建等等,但它不会给你一个文件描述符或进程,并会过时fanotify

fanotify是最新的通知访问,修改,关闭,但不通知删除或属性,但确实提供文件描述符

我需要一种确定过程(例如从fd)和删除,修改,属性,等等,以便同步每一个东西,有什么建议?不幸的是,dnotify似乎是最好的,但也是最新的。 和朋友 - 像 FAM Gamin (两者都是相同的API)。这将使您的程序可以移植到其他Unix。


I'm looking at building a file system sync utility that monitors file system activity, but it appears that some of the file system monitoring features in the linux kernel are obsolete or not fully featured.

What my research as found

dnotify came first with notification has the features of notifying for delete,modify,access,attribs,create,move can determine file descriptor, however is now out dated by inotify and fanotify

inotify came out second with notification has the features of notifying access, modify, attrib, close, move, delete, create, etc however it does not give you a file descriptor or process and will be outdated by fanotify

fanotify is the latest which informs of access, modify, close, but does not inform of delete or attribs, but does provide file descriptor

I need a way of determining the process (e.g. from fd) and things like delete, modify, attribs, etc in order to sync everything, any suggestions? Unfortunately dnotify seems the best but most out-dated

解决方案

You should use a library instead of inotify and friends - something like FAM or Gamin (it's the same API for both). This will make your program portable to other Unixes.

这篇关于监视linux中文件系统更改的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆