Linux: FS: inotify

这个和网卡的event-notify是一样的逻辑,内核看到有什么事情发生,可以通知到用户,然后用户可以根据自己的需求做一些处理。第一次看到,记录一下算是可以日后可以用到的功能。
man inotify。

inotify - monitoring filesystem events
描述: The inotify API provides a mechanism for monitoring filesystem events. Inotify can be used to monitor individual files, or to monitor directories. When a directory is monitored, inotify will return events for the directory itself, and for files inside the directory.

The following system calls are used with this API:
* inotify_init(2) creates an inotify instance and returns a file descriptor referring to the inotify instance. The more recent inotify_init1(2) is like inotify_init(2), but has a flags argument that provides access to some extra functionality.

  • inotify_add_watch(2) manipulates the “watch list” associated with an inotify instance. Each item (“watch”) in the watch list specifies the pathname of a file or directory, along with some set of events th

你可能感兴趣的:(kernel,linux,运维,inotify)