Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

inotify

From Wikipedia, the free encyclopedia
Linux subsystem for filesystem monitoring

inotify (inode notify) is aLinux kernel subsystem created by John McCutchan, which monitors changes to thefilesystem, and reports those changes to applications. It can be used to automatically update directory views, reload configuration files, log changes, backup, synchronize, and upload. Theinotifywait andinotifywatch commands (maintained by Eric Curtin as part of the inotify-tools project) allow using the inotify subsystem from the command line.[1] One major use is indesktop search utilities likeBeagle, where its functionality permitsreindexing of changed files without scanning the filesystem for changes every few minutes, which would be very inefficient.

inotify replaced an earlier facility,dnotify, which had similar goals. Inotify was merged into theLinux kernel mainline in kernel version 2.6.13, released on August 29, 2005;[2] later kernel versions included further improvements. The required library interfaces were added into theGNU C Library (glibc) in its version 2.4, released in March 2006, while the support for inotify was completed in glibc version 2.5, released in September 2006.[3]

Limitations

[edit]

Limitations imposed by inotify include the following:

  • Inotify does not support recursively watching directories, meaning that a separate inotify watch must be created for every subdirectory.[4] In contrast, the commandinotifywait does provide recursive watching of directories.[5]
  • Inotify does report some but not all events insysfs andprocfs.
  • Notification via inotify requires the kernel to be aware of all relevant filesystem events, which is not always possible for networked filesystems such asNFS where changes made by one client are not immediately broadcast to other clients.
  • Rename events are not handled directly; i.e., inotify issues two separate events that must be examined and matched in a context of potential race conditions.

History

[edit]
  • July 2004: the first release announcement[6]
  • August 29, 2005: Linux kernel version 2.6.13 released, containing merged inotify code[2]
  • March 2006: GNU C Library (glibc) version 2.4 released, bringing initial inotify support[3]
  • September 2006: Glibc version 2.5 released, bringing complete inotify support[3]

Advantages over dnotify

[edit]

There are a number of advantages when using inotify when compared to the olderdnotify API that it replaced.[7][8][9] With dnotify, a program had to use onefile descriptor for each directory that it was monitoring. This can become a bottleneck since the limit of file descriptors per process could be reached. Later, fanotify was created to overcome this issue. The use of file descriptors along with dnotify also proved to be a problem when using removable media. Devices could not be unmounted since file descriptors kept the resource busy.

Another drawback of dnotify is the level of granularity, since programmers can only monitor changes at the directory level. To access detailed information about the environmental changes that occur when a notification message is sent, a stat structure must be used; this is considered a necessary evil in that a cache of stat structures has to be maintained, for every new stat structure generated a comparison is run against the cached one.

The inotify API uses fewer file descriptors, allowing programmers to use the established select and poll interface, rather than the signal notification system used bydnotify. This also makes integration with existing select- or poll-based libraries (likeGLib) easier.

See also

[edit]

References

[edit]
  1. ^inotify-tools wiki
  2. ^abLinux 2.6.13, kernelnewbies.org
  3. ^abcinotify man page
  4. ^Robert Love,Linux system programming. O'Reilly, p. 236
  5. ^inotifywait man page,[1]
  6. ^"fa.linux.kernel post [RFC][PATCH] inotify 0.8". 2004-07-29. Retrieved2013-08-19.
  7. ^Michael Kerrisk (14 July 2014)."Filesystem notification, part 2: A deeper investigation of inotify".LWN.net.
  8. ^Eli M. Dow (2005-05-31)."Monitor Linux File System Events with Inotify ; Why inotify?". Archived fromthe original on 2010-01-16.
  9. ^inotify README file

External links

[edit]
Linux kernel
Controversies
Distributions
Organizations
Adoption
Media
Security
certifications
Organization
Kernel
Support
People
Technical
Debugging
Startup
ABIs
APIs
Kernel
System Call
Interface
In-kernel
Userspace
Daemons,
File systems
Wrapper
libraries
Components
Variants
Virtualization
Adoption
Range
of use
Adopters
Retrieved from "https://en.wikipedia.org/w/index.php?title=Inotify&oldid=1239733747"
Category:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp