Re: git: 8935a3993219 - main - daemon: use kqueue for all events
Date: Fri, 14 Apr 2023 13:33:42 UTC
On Fri, Apr 14, 2023 at 2:43 AM Konstantin Belousov <kostikbel@gmail.com> wrote: > > On Fri, Apr 14, 2023 at 05:13:54AM +0000, Kyle Evans 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 > > > + /* Signals are processed via kqueue */ > > + signal(SIGHUP, SIG_IGN); > > + signal(SIGTERM, SIG_IGN); > Are you sure that this works? When a signal disposition is set to 'ignore', > the signal delivery drops the signal immediately without queuing/notifying > the victim. I very much doubt that you would get any kqueue event for HUP > or TERM after the calls. The manpage, at least, specifically calls this out: The filter will record all attempts to deliver a signal to a process, even if the signal has been marked as SIG_IGN, except for the SIGCHLD signal, which, if ignored, will not be recorded by the filter. The tests should at least test SIGHUP, maybe not the others. Thanks, Kyle Evans