Re: git: 8935a3993219 - main - daemon: use kqueue for all events

From: Kyle Evans <kevans_at_freebsd.org>
Date: Fri, 05 May 2023 15:00:04 UTC
On Fri, May 5, 2023 at 3:59 AM Emmanuel Vadot <manu@bidouilliste.com> wrote:
>
>
>  Hello,
>
> On Fri, 14 Apr 2023 05:13:54 GMT
> Kyle Evans <kevans@FreeBSD.org> wrote:
>
> > The branch main has been updated by kevans:
> >
> > URL: https://cgit.FreeBSD.org/src/commit/?id=8935a3993219be76c7ea03e9ad4509657d08af6c
> >
> > commit 8935a3993219be76c7ea03e9ad4509657d08af6c
> > Author:     Ihor Antonov <ihor@antonovs.family>
> > AuthorDate: 2023-04-14 05:10:29 +0000
> > Commit:     Kyle Evans <kevans@FreeBSD.org>
> > CommitDate: 2023-04-14 05:12:21 +0000
> >
> >     daemon: use kqueue for all events
> >
> >     Refactor daemon to use kqueue/kevent instead of signals.
> >
> >     This changes allows to simplify the code in several ways:
> >     - the execution flow is now linear, no async events.
> >     - several variables became redundant and got removed.
> >     - all event handling is now concentrated inside of the event loop, which
> >       makes code reading and comprehension easier.
> >     - new kqueuex(2) call is used for CLOEXEC, but maintained closing the
> >       kq fd prior to execve() to ease later MFC
> >
> >     No UX/API changes are intended.
> >
> >     Reviewed by:    kevans
> >     Pull Request:   https://github.com/freebsd/freebsd-src/pull/701
>
>  This break sysutils/seatd when we resume and leaves the console is a
> really sad state (impossible to use, keystroke don't match).
>  Don't really know how to properly debug but :
>
>  1/ Reverting the commit make seatd not exiting on resume (and so sway
> doesn't exit).
>  2/ If I start seatd without daemon it works
>  3/ If I manually start saetd with daemon in tmux with
>  "daemon -s debug -T seatd -p /var/run/seatd.pid /usr/local/bin/seatd
> -g video" (so same thing as the rc script) I see
>  "daemon: kevent wait: Interrupted system call" printed when I get back
> network.
>
>  Feel free to ask me any test you want to debug further ;)
>

Can you check if this is sufficient?
https://people.freebsd.org/~kevans/daemon-kq.diff

We shouldn't bail out if were simply interrupted, presumably we just
want to resume waiting for an event.

Thanks,

Kyle Evans