From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id E2ABA3858D37 for ; Sun, 23 Oct 2022 12:13:22 +0000 (GMT) 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 Received: by mail-pf1-x429.google.com with SMTP id b29so2389400pfp.13 for ; Sun, 23 Oct 2022 05:13:22 -0700 (PDT) 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: In-Reply-To: From: Kevin Connor Arpe Date: Sun, 23 Oct 2022 21:13:10 +0900 Message-ID: Subject: Re: inotify? To: Ken Brown Cc: cygwin@cygwin.com Content-Type: multipart/alternative; boundary="000000000000ddf03f05ebb2991e" 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 List-Id: --000000000000ddf03f05ebb2991e Content-Type: text/plain; charset="UTF-8" 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 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: < > 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 > --000000000000ddf03f05ebb2991e--