On Tue, Aug 08, 2023 at 10:40:06AM -0500, Scott Cheloha wrote: > On Sat, Aug 05, 2023 at 01:33:05AM -0400, A Tammy wrote: > > > > On 8/5/23 00:49, Scott Cheloha wrote: > > > On Sat, Aug 05, 2023 at 12:17:48AM -0400, aisha wrote: > > >> On 22/09/10 01:53PM, Visa Hankala wrote: > > >>> On Wed, Aug 31, 2022 at 04:48:37PM -0400, aisha wrote: > > >>>> I've added a patch which adds support for NOTE_{,U,M,N}SECONDS for > > >>>> EVFILT_TIMER in the kqueue interface. > > >>> It sort of makes sense to add an option to specify timeouts in > > >>> sub-millisecond precision. It feels complete overengineering to add > > >>> multiple time units on the level of the kernel interface. However, > > >>> it looks that FreeBSD and NetBSD have already done this following > > >>> macOS' lead... > > >>> > > >>>> I've also added the NOTE_ABSTIME but haven't done any actual > > >>>> implementation > > >>>> there as I am not sure how the `data` field should be interpreted (is > > >>>> it > > >>>> absolute time in seconds since epoch?). > > >>> I think FreeBSD and NetBSD take NOTE_ABSTIME as time since the epoch. > > >>> > > >>> Below is a revised patch that takes into account some corner cases. > > >>> It tries to be API-compatible with FreeBSD and NetBSD. I have adjusted > > >>> the NOTE_{,M,U,N}SECONDS flags so that they are enum-like. > > >>> > > >>> The manual page bits are from NetBSD. > > >>> > > >>> It is quite late to introduce a feature like this within this release > > >>> cycle. Until now, the timer code has ignored the fflags field. There > > >>> might be pieces of software that are careless with struct kevent and > > >>> that would break as a result of this patch. Programs that are widely > > >>> used on different BSDs are probably fine already, though. > > >> > > >> Sorry, I had forgotten this patch for a long time!!! I've been running > > >> with this for a while now and it's been working nicely. > > > > > > Where is this being used in ports? I think having "one of each" for > > > seconds, milliseconds, microseconds, and nanoseconds is (as visa > > > noted) way, way over-the-top. > > > > I was using it with a port that I sent out a while ago but never got > > into tree (was before I joined the project) - > > https://marc.info/?l=openbsd-ports&m=165715874509440&w=2 > > If nothing in ports is using this I am squeamish about adding it. > Once we add it, we're stuck maintaining it, warts and all. > > If www/workflow were in the tree I could see the upside. Is it in > ports? > > It looks like workflow actually wants timerfd(2) from Linux and is > simulating timerfd(2) with EVFILT_TIMER and NOTE_NSECONDS: > > https://github.com/sogou/workflow/blob/80b3dfbad2264bcd79ba37811c66421490e337d2/src/kernel/poller.c#L227 > > I think timerfd(2) is the superior interface here. It keeps the POSIX > interval timer semantics without all the signal delivery baggage. It > also supports multiple clocks and starting a periodic timeout from an > absolute starting time. > > So, if the goal is "add www/workflow to ports", adding timerfd(2) might > be the right thing.
I don't think that this is a good move. Adding timerfd(2) will result in the need to add all those magic fd interfaces linux invents on a weekly basis. I would not go down that rabbit-hole unless there is realy realy no alternative. -- :wq Claudio