Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Apr 2023 08:33:42 -0500
From:      Kyle Evans <kevans@freebsd.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Kyle Evans <kevans@freebsd.org>, src-committers@freebsd.org,  dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 8935a3993219 - main - daemon: use kqueue for all events
Message-ID:  <CACNAnaFKnvpKFdkEnC=GcKhkc9BXycetCRYA-ySqrCTQurRMWw@mail.gmail.com>
In-Reply-To: <ZDkEF3ODocUAmKQL@kib.kiev.ua>
References:  <202304140513.33E5DsXL019547@gitrepo.freebsd.org> <ZDkEF3ODocUAmKQL@kib.kiev.ua>

index | next in thread | previous in thread | raw e-mail

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


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaFKnvpKFdkEnC=GcKhkc9BXycetCRYA-ySqrCTQurRMWw>