Ken,

Sorry for my late reply.  Your hint to read the Emacs source code was
incredibly helpful.
This line:
https://github.com/jwiegley/emacs-release/blob/master/src/w32notify.c#L255
calls ReadDirectoryChangesW().
Reading the Win32 API docs very closely, I discovered that I can pass a
large(r) buffer to this function.  This can greatly reduce the chance of
lost events.
(Oddly, in *all* code samples that I found, all of them used relatively
small buffers.  Even the Emacs code uses a tiny 16kb buffer.)
I wrote a test driver for ReadDirectoryChangesW() to better understand
the API.
I did some analysis to map the Linux API to Win32 capabilities.  As
expected, there isn't a perfect 1:1 match, but there is significant overlap
-- enough (IMHO) to make inotify useful on Cygwin.
I also started reading the Cygwin source code.  It seems possible to impl
inotify functionality by creating a new subclass of fhandler_base, e.g.,
fhandler_inotify.

I will reply to this thread when/if I have questions in the future.

Thanks,
Arpe

On Fri, Oct 7, 2022 at 4:59 AM Ken Brown <kbr...@cornell.edu> wrote:

> On 10/6/2022 12:29 PM, Kevin Connor Arpe wrote:
> > Hi,
> >
> > Sorry, I am a GMail user, so I am unable to reply to the original email
> > from Eric Blake ebl...@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.
>
> That's correct.
>
> [...]
>
> > I would appreciate it if people could share their thoughts and advice.
>
> I don't know if this will help, but Emacs has a filenotify feature which,
> on
> Linux, is based on inotify.  In the native Windows build of Emacs,
> filenotify is
> implemented in the file src/w32notify.c in the Emacs source tree.  Looking
> at
> how this is done might give you some ideas.
>
> > 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.
>
> Agreed.  Good luck.
>
> Ken
>
> --
> Problem reports:      https://cygwin.com/problems.html
> FAQ:                  https://cygwin.com/faq/
> Documentation:        https://cygwin.com/docs.html
> Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to