<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 3, 2022, at 6:46 AM, Vladimir Kempik <<a href="mailto:vkempik@openjdk.org" class="">vkempik@openjdk.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">2) this modifier StandardWatchEventKinds.ENTRY_MODIFY says to monitor changes of individual files in the dir, but kevent on the dir only reports changes to the dir itself</span></div></blockquote><br class=""></div><div>Seems somewhat off-topic to FSEvents implementation but it got me to look at some of my old attempt.</div><div><br class=""></div><div>You could just add all the files in the directory.</div><div><br class=""></div><div>[self addChildren:[NSURL fileURLWithPath:path] notifyingAbout:fflags withWatchKey:watchKey];</div><div><br class=""></div><div>This of course does nothing for the possible file descriptor issues. As near as I can tell on a quick look the only time I freed up a descriptor was if the file was deleted.</div><div><br class=""></div><div>My implementation however, usually did no polling. I only added some polling when I ran into what seemed like deadlock issues to make sure the thread wasn’t itself deadlocked somehow. As an ‘alive’ test.</div><div><br class=""></div><div>I did a lot of googling on this but never hit on mention of descriptors. I don’t think I’ll go over the code too much more though.</div><div><br class=""></div><div>The current FSEvents implementation looks fine to me. Based on a officially Apple supported API and extension I think to kqueue? If I remember right they had a couple different file monitoring extensions that differed in granularity. One less granular I think could watch for any file changes on the machine. </div><div><br class=""></div><div>Callbacks are fairly common in Apple OS/X code aren’t they? </div><div> </div><div><br class=""></div><div><br class=""></div></body></html>