delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/10/23/08:14:48

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E2ABA3858D37
Authentication-Results: sourceware.org;
dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=+pdYHZOg9rTkyYNfXcocTeDgbSkQjHHYGOvhCbi6phw=;
b=FzOZI3rwkuMIIQhSaDLKLwjL8TQUPhYmBOolNzXsxQB3hkwq+EmlwBJEeRKh02B94i
osE9x2l75JXKunpgbHXErwBSYWDG07HayB+MXWLwnaSmGIFtNoWGQM4ZqcqU2uUcEUT+
brqrFmXnNoIY2W5ngVlkArK/ev9UhBlQXD1RNeRGxCQD+NaN2k45/g/lFN22hJSuVszo
xnCCTd1KuwoM2MgirOLDg1LZXXmHUgy0IFzLCDzFJtlrONs4Y2IVfy3c4IpLzyPldIox
mM+bHWFhO2Oq/vHLxxcvDhPckbX3jgfJXXeWKSDkjno6SGMQnAHE97Ms7DAIuPUSzNl2
km/A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=+pdYHZOg9rTkyYNfXcocTeDgbSkQjHHYGOvhCbi6phw=;
b=Q6FfQYhDZcLf0ADNrLIUAWgCeqM2m0Ejo5qdNTQpiNIqYV3/syj0O2Wxp7Twf3hQMT
LFM7dKVhp0rLxqJJD9UnhjjNuSF5DAYDwudsVjyK5GhOoH5FnuS8kssB6P54fOLMcWf7
Tmr0gU+vTLzo4nW+7XUP9hQJl/siBCNeDVAytw0aPoKVLFKINOiP4HrBC378gC5Ahllm
Id7rJWOym6mn6GtsaCvINModXbKtLra/ux+yP9x6OYUm8IY4sXqqB+dc3mTOf6CUjpLl
Qk3GoXf0fbJd2tVRqwuJG/1q5z+TICC1Yem92n8IiHPTCgdlEBGMHOZSwKvfIQ8RQPXa
PJVA==
X-Gm-Message-State: ACrzQf2sd5ckNkeVkqZkitSJ3hKOXUvx+2xEoqoy1guognyiqwR9MZj7
DvsWugw2th44mUnEuvVZP7HNrQsytkCRsgMcFpw=
X-Google-Smtp-Source: AMsMyM50+099snFprd/bU4WMVELjYGaMkzNv7K6WAOQUO2A92Rp6KWVbtEfhCipSk3r/6iKvkUjsKGrZhvtTULsD4aU=
X-Received: by 2002:a63:2b53:0:b0:439:34d9:5d47 with SMTP id
r80-20020a632b53000000b0043934d95d47mr23571183pgr.283.1666527201717; Sun, 23
Oct 2022 05:13:21 -0700 (PDT)
MIME-Version: 1.0
References: <CAFMYRRNfM8AOD26q3UbHmwpGyG=WnE7LM8cYJt3=V5Tjfm7vRw AT mail DOT gmail DOT com>
<f56e88a5-9168-e2ca-7b50-cc9419ba1cc0 AT cornell DOT edu>
In-Reply-To: <f56e88a5-9168-e2ca-7b50-cc9419ba1cc0@cornell.edu>
From: Kevin Connor Arpe <kevinarpe AT gmail DOT com>
Date: Sun, 23 Oct 2022 21:13:10 +0900
Message-ID: <CAFMYRRNmUKcBTmSCj_48PWQ_+ML5Ls69cF8jTKdfKuASKbV+-g@mail.gmail.com>
Subject: Re: inotify?
To: Ken Brown <kbrown AT cornell DOT edu>
X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE,
RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS,
TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Cc: cygwin AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

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 AT cornell DOT 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 AT redhat DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019