€•vPŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ'/translations/zh_CN/filesystems/inotify”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/zh_TW/filesystems/inotify”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/it_IT/filesystems/inotify”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/ja_JP/filesystems/inotify”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/ko_KR/filesystems/inotify”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/pt_BR/filesystems/inotify”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/sp_SP/filesystems/inotify”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒA/var/lib/git/docbuild/linux/Documentation/filesystems/inotify.rst”h´KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ?Inotify - A Powerful yet Simple File Change Notification System”h]”hŒ?Inotify - A Powerful yet Simple File Change Notification System”…””}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhŒ paragraph”“”)”}”(hŒ”h]”(hŒ-Document started 15 Mar 2005 by Robert Love <”…””}”(hhßh²hh³Nh´NubhŒ reference”“”)”}”(hŒrml@novell.com”h]”hŒrml@novell.com”…””}”(hhéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:rml@novell.com”uh1hçhhßubhŒ>”…””}”(hhßh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K hhÊh²hubhÞ)”}”(hŒFDocument updated 4 Jan 2015 by Zhang Zhen ”h]”(hŒ+Document updated 4 Jan 2015 by Zhang Zhen <”…””}”(hjh²hh³Nh´Nubhè)”}”(hŒzhenzhang.zhang@huawei.com”h]”hŒzhenzhang.zhang@huawei.com”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œ!mailto:zhenzhang.zhang@huawei.com”uh1hçhjubhŒ>”…””}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K hhÊh²hubhŒ block_quote”“”)”}”(hŒJ- Deleted obsoleted interface, just refer to manpages for user interface. ”h]”hŒ bullet_list”“”)”}”(hhh]”hŒ list_item”“”)”}”(hŒHDeleted obsoleted interface, just refer to manpages for user interface. ”h]”hÞ)”}”(hŒGDeleted obsoleted interface, just refer to manpages for user interface.”h]”hŒGDeleted obsoleted interface, just refer to manpages for user interface.”…””}”(hj6h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K hj2ubah}”(h]”h ]”h"]”h$]”h&]”uh1j0hj-ubah}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1j+h³hÇh´K hj'ubah}”(h]”h ]”h"]”h$]”h&]”uh1j%h³hÇh´K hhÊh²hubhŒenumerated_list”“”)”}”(hhh]”j1)”}”(hŒ Rationale ”h]”hÞ)”}”(hŒ Rationale”h]”hŒ Rationale”…””}”(hjah²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khj]ubah}”(h]”h ]”h"]”h$]”h&]”uh1j0hjZh²hh³hÇh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œ lowerroman”Œprefix”Œ(”Œsuffix”Œ)”uh1jXhhÊh²hh³hÇh´KubhŒdefinition_list”“”)”}”(hhh]”(hŒdefinition_list_item”“”)”}”(hŒ`Q: What is the design decision behind not tying the watch to the open fd of the watched object? ”h]”(hŒterm”“”)”}”(hŒQ:”h]”hŒQ:”…””}”(hjŽh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒh³hÇh´KhjˆubhŒ definition”“”)”}”(hhh]”hÞ)”}”(hŒ\What is the design decision behind not tying the watch to the open fd of the watched object?”h]”hŒ\What is the design decision behind not tying the watch to the open fd of the watched object?”…””}”(hj¡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjžubah}”(h]”h ]”h"]”h$]”h&]”uh1jœhjˆubeh}”(h]”h ]”h"]”h$]”h&]”uh1j†h³hÇh´Khjƒubj‡)”}”(hXeA: Watches are associated with an open inotify device, not an open file. This solves the primary problem with dnotify: keeping the file open pins the file and thus, worse, pins the mount. Dnotify is therefore infeasible for use on a desktop system with removable media as the media cannot be unmounted. Watching a file should not require that it be open. ”h]”(j)”}”(hŒA:”h]”hŒA:”…””}”(hj¿h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒh³hÇh´Khj»ubj)”}”(hhh]”hÞ)”}”(hXaWatches are associated with an open inotify device, not an open file. This solves the primary problem with dnotify: keeping the file open pins the file and thus, worse, pins the mount. Dnotify is therefore infeasible for use on a desktop system with removable media as the media cannot be unmounted. Watching a file should not require that it be open.”h]”hXaWatches are associated with an open inotify device, not an open file. This solves the primary problem with dnotify: keeping the file open pins the file and thus, worse, pins the mount. Dnotify is therefore infeasible for use on a desktop system with removable media as the media cannot be unmounted. Watching a file should not require that it be open.”…””}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhjÍubah}”(h]”h ]”h"]”h$]”h&]”uh1jœhj»ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j†h³hÇh´Khjƒh²hubj‡)”}”(hŒ^Q: What is the design decision behind using an-fd-per-instance as opposed to an fd-per-watch? ”h]”(j)”}”(hŒQ:”h]”hŒQ:”…””}”(hjîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒh³hÇh´Khjêubj)”}”(hhh]”hÞ)”}”(hŒZWhat is the design decision behind using an-fd-per-instance as opposed to an fd-per-watch?”h]”hŒZWhat is the design decision behind using an-fd-per-instance as opposed to an fd-per-watch?”…””}”(hjÿh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjüubah}”(h]”h ]”h"]”h$]”h&]”uh1jœhjêubeh}”(h]”h ]”h"]”h$]”h&]”uh1j†h³hÇh´Khjƒh²hubj‡)”}”(hX¥A: An fd-per-watch quickly consumes more file descriptors than are allowed, more fd's than are feasible to manage, and more fd's than are optimally select()-able. Yes, root can bump the per-process fd limit and yes, users can use epoll, but requiring both is a silly and extraneous requirement. A watch consumes less memory than an open file, separating the number spaces is thus sensible. The current design is what user-space developers want: Users initialize inotify, once, and add n watches, requiring but one fd and no twiddling with fd limits. Initializing an inotify instance two thousand times is silly. If we can implement user-space's preferences cleanly--and we can, the idr layer makes stuff like this trivial--then we should. There are other good arguments. With a single fd, there is a single item to block on, which is mapped to a single queue of events. The single fd returns all watch events and also any potential out-of-band data. If every fd was a separate watch, - There would be no way to get event ordering. Events on file foo and file bar would pop poll() on both fd's, but there would be no way to tell which happened first. A single queue trivially gives you ordering. Such ordering is crucial to existing applications such as Beagle. Imagine "mv a b ; mv b a" events without ordering. - We'd have to maintain n fd's and n internal queues with state, versus just one. It is a lot messier in the kernel. A single, linear queue is the data structure that makes sense. - User-space developers prefer the current API. The Beagle guys, for example, love it. Trust me, I asked. It is not a surprise: Who'd want to manage and block on 1000 fd's via select? - No way to get out of band data. - 1024 is still too low. ;-) When you talk about designing a file change notification system that scales to 1000s of directories, juggling 1000s of fd's just does not seem the right interface. It is too heavy. Additionally, it _is_ possible to more than one instance and juggle more than one queue and thus more than one associated fd. There need not be a one-fd-per-process mapping; it is one-fd-per-queue and a process can easily want more than one queue. ”h]”(j)”}”(hŒA:”h]”hŒA:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒh³hÇh´KKhjubj)”}”(hhh]”(hÞ)”}”(hXãAn fd-per-watch quickly consumes more file descriptors than are allowed, more fd's than are feasible to manage, and more fd's than are optimally select()-able. Yes, root can bump the per-process fd limit and yes, users can use epoll, but requiring both is a silly and extraneous requirement. A watch consumes less memory than an open file, separating the number spaces is thus sensible. The current design is what user-space developers want: Users initialize inotify, once, and add n watches, requiring but one fd and no twiddling with fd limits. Initializing an inotify instance two thousand times is silly. If we can implement user-space's preferences cleanly--and we can, the idr layer makes stuff like this trivial--then we should.”h]”hXéAn fd-per-watch quickly consumes more file descriptors than are allowed, more fd’s than are feasible to manage, and more fd’s than are optimally select()-able. Yes, root can bump the per-process fd limit and yes, users can use epoll, but requiring both is a silly and extraneous requirement. A watch consumes less memory than an open file, separating the number spaces is thus sensible. The current design is what user-space developers want: Users initialize inotify, once, and add n watches, requiring but one fd and no twiddling with fd limits. Initializing an inotify instance two thousand times is silly. If we can implement user-space’s preferences cleanly--and we can, the idr layer makes stuff like this trivial--then we should.”…””}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K!hj+ubhÞ)”}”(hŒ÷There are other good arguments. With a single fd, there is a single item to block on, which is mapped to a single queue of events. The single fd returns all watch events and also any potential out-of-band data. If every fd was a separate watch,”h]”hŒ÷There are other good arguments. With a single fd, there is a single item to block on, which is mapped to a single queue of events. The single fd returns all watch events and also any potential out-of-band data. If every fd was a separate watch,”…””}”(hj<h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K-hj+ubj,)”}”(hhh]”(j1)”}”(hXJThere would be no way to get event ordering. Events on file foo and file bar would pop poll() on both fd's, but there would be no way to tell which happened first. A single queue trivially gives you ordering. Such ordering is crucial to existing applications such as Beagle. Imagine "mv a b ; mv b a" events without ordering. ”h]”hÞ)”}”(hXIThere would be no way to get event ordering. Events on file foo and file bar would pop poll() on both fd's, but there would be no way to tell which happened first. A single queue trivially gives you ordering. Such ordering is crucial to existing applications such as Beagle. Imagine "mv a b ; mv b a" events without ordering.”h]”hXOThere would be no way to get event ordering. Events on file foo and file bar would pop poll() on both fd’s, but there would be no way to tell which happened first. A single queue trivially gives you ordering. Such ordering is crucial to existing applications such as Beagle. Imagine “mv a b ; mv b a†events without ordering.”…””}”(hjQh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K2hjMubah}”(h]”h ]”h"]”h$]”h&]”uh1j0hjJubj1)”}”(hŒ´We'd have to maintain n fd's and n internal queues with state, versus just one. It is a lot messier in the kernel. A single, linear queue is the data structure that makes sense. ”h]”hÞ)”}”(hŒ³We'd have to maintain n fd's and n internal queues with state, versus just one. It is a lot messier in the kernel. A single, linear queue is the data structure that makes sense.”h]”hŒ·We’d have to maintain n fd’s and n internal queues with state, versus just one. It is a lot messier in the kernel. A single, linear queue is the data structure that makes sense.”…””}”(hjih²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K8hjeubah}”(h]”h ]”h"]”h$]”h&]”uh1j0hjJubj1)”}”(hŒ¹User-space developers prefer the current API. The Beagle guys, for example, love it. Trust me, I asked. It is not a surprise: Who'd want to manage and block on 1000 fd's via select? ”h]”hÞ)”}”(hŒ¸User-space developers prefer the current API. The Beagle guys, for example, love it. Trust me, I asked. It is not a surprise: Who'd want to manage and block on 1000 fd's via select?”h]”hŒ¼User-space developers prefer the current API. The Beagle guys, for example, love it. Trust me, I asked. It is not a surprise: Who’d want to manage and block on 1000 fd’s via select?”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K