public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Kevin Connor Arpe <kevinarpe@gmail.com>
To: cygwin@cygwin.com
Subject: Re: inotify?
Date: Fri, 7 Oct 2022 01:29:40 +0900	[thread overview]
Message-ID: <CAFMYRRNfM8AOD26q3UbHmwpGyG=WnE7LM8cYJt3=V5Tjfm7vRw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2585 bytes --]

Hi,

Sorry, I am a GMail user, so I am unable to reply to the original email
from Eric Blake eblake@redhat.com on Thu May 3 14:03:00 GMT 2018:
https://cygwin.com/pipermail/cygwin/2018-May/237069.html

Eric wrote: <<And patches to make Cygwin support inotify_init() and
friends implemented
on top of the Windows native API are certainly welcome.>>

First, please correct me if Linux-style inotify is already supported in
Cygwin.  As I understand, it is not.  To be clear, when I say "inotify", I
mean this Linux kernel API:
https://man7.org/linux/man-pages/man7/inotify.7.html

Second, I am interested in exploring this feature as a personal project.
After some research, I found two different solutions on Windows:

   1. FindNextChangeNotification() and friends explained here:
   https://learn.microsoft.com/en-us/windows/win32/fileio/obtaining-directory-change-notifications
   2. (NTFS) Change Journals explained here:
   https://learn.microsoft.com/en-us/windows/win32/fileio/change-journals

There is some discussion about both approaches on StackOverflow.com here:
https://stackoverflow.com/questions/3517460/is-there-anything-like-inotify-on-windows

In short, it sounds like #1 (above) is unreliable and can drop/miss file
system events if too fast and/or the kernel notification queue is
full/overloaded.

However, #2 (above) requires journalling to be enabled on an NTFS volume.
And, it sounds like this feature is *only* available on NTFS volumes.
(FAT/32 & friends would need to use #1.)

My thoughts & concerns:

   - #1 might be easier to program but if dropped events are a reality,
   then ... meh, not such a great feature!
   - #2 is restricted to NTFS, but sounds very reliable ("rock solid", one
   person said).  However, journalling needs to be enabled.  I guess the
   inotify API can just return an error if journaling is disabled for an NTFS
   volume.  And, I see two solutions for non-NTFS volumes: inotify API returns
   error, or fall-back to #2.

More: It sounds like journaling might be disabled by default.

   -
   https://stackoverflow.com/questions/27184283/is-the-usn-journal-disabled-by-default
   - https://devblogs.microsoft.com/oldnewthing/20130101-00/?p=5673

And enabling probably requires local admin access.  Maybe some kind of flag
can choose #1 or #2?

I would appreciate it if people could share their thoughts and advice.

The Linux inotify API is an excellent feature.  I have used it a few times
with great success.  It would be nice to have this feature on Cygwin.

Kind regards,
Kevin ARPE
Tokyo, Japan
https://github.com/kevinarpe

             reply	other threads:[~2022-10-06 16:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 16:29 Kevin Connor Arpe [this message]
2022-10-06 19:58 ` inotify? Ken Brown
2022-10-23 12:13   ` inotify? Kevin Connor Arpe
  -- strict thread matches above, loose matches on Subject: below --
2018-05-03  9:35 inotify? Ulli Horlacher
2018-05-03 10:37 ` inotify? Richard H Lee
2018-05-03 14:03   ` inotify? Eric Blake
2018-05-03 21:47   ` inotify? Ulli Horlacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFMYRRNfM8AOD26q3UbHmwpGyG=WnE7LM8cYJt3=V5Tjfm7vRw@mail.gmail.com' \
    --to=kevinarpe@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).