On Sat, Oct 23, 2021 at 10:40:56AM +0100, Martin Pieuchot wrote:
> Diff below switches both poll(2) and select(2) to the kqueue-based
> implementation.

Passed regress on i386.

> In addition it switches libevent(3) to use poll(2) by default for
> testing purposes.

It created some test failures in syslogd regress as it could not
see kqueue in ktrace.  This is an expected failure.

> I don't have any open bug left with this diff and I'm happily running
> GNOME with it.  So I'd be happy if you could try to break it and report
> back.

I think we should give it a try.

> +#ifdef DIAGNOSTIC
> +     /*
> +      * Lazily delete spurious events.
> +      *
> +      * This should not happen as long as kqueue_purge() is called
> +      * at the end of every syscall.  It migh be interesting to do
> +      * like DragonFlyBSD and not always allocated a new knote in
> +      * kqueue_register() with that lazy removal makes sense.
> +      */
> +     if (i >= nfds) {
> +             DPRINTFN(0, "poll get out of range udata %lu vs serial %lu\n",
> +                 (unsigned long)kevp->udata, p->p_kq_serial);
> +             kevp->flags = EV_DISABLE|EV_DELETE;
> +             kqueue_register(p->p_kq, kevp, p);
> +             return (0);
> +     }
> +     if ((int)kevp->ident != pl[i].fd) {
> +             DPRINTFN(0, "poll get %lu/%d mismatch fd %u!=%d serial %lu\n",
> +                 i+1, nfds, (int)kevp->ident, pl[i].fd, p->p_kq_serial);
> +             return (0);
> +     }
> +#endif

DIAGNOSTIC should not change behavior by returning 0.

> +             /* NOTE: POLLHUP and POLLOUT/POLLWRNORM are mutually exclusive*/

Remove "NOTE:" and the comment will fit into the line.

> +#if 1
> +                     if (pl[i].events != 0 && pl[i].events != POLLOUT)
> +                             DPRINTFN(0, "weird events %x\n", pl[i].events);
> +#endif

Why #if 1, should it be DIAGNOSTIC ?

> +                     /* Tell uper layer to ask for POLLUP only */

upper

Reply via email to