From: Kevin Connor Arpe <kevinarpe@gmail.com>
To: Ken Brown <kbrown@cornell.edu>
Cc: cygwin@cygwin.com
Subject: Re: inotify?
Date: Sun, 23 Oct 2022 21:13:10 +0900 [thread overview]
Message-ID: <CAFMYRRNmUKcBTmSCj_48PWQ_+ML5Ls69cF8jTKdfKuASKbV+-g@mail.gmail.com> (raw)
In-Reply-To: <f56e88a5-9168-e2ca-7b50-cc9419ba1cc0@cornell.edu>
[-- Attachment #1: Type: text/plain, Size: 2476 bytes --]
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 <kbrown@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 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.
>
> 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
>
next prev parent reply other threads:[~2022-10-23 12:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-06 16:29 inotify? Kevin Connor Arpe
2022-10-06 19:58 ` inotify? Ken Brown
2022-10-23 12:13 ` Kevin Connor Arpe [this message]
-- 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=CAFMYRRNmUKcBTmSCj_48PWQ_+ML5Ls69cF8jTKdfKuASKbV+-g@mail.gmail.com \
--to=kevinarpe@gmail.com \
--cc=cygwin@cygwin.com \
--cc=kbrown@cornell.edu \
/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).