Date: Wed, 22 Apr 2020 01:06:30 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 229741] kevent is not properly adding EVFILT_READ and EVFILT_WRITE for unix sockets when used in one call Message-ID: <bug-229741-227-JjiFFNHKHW@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-229741-227@https.bugs.freebsd.org/bugzilla/> References: <bug-229741-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D229741 Kyle Evans <kevans@freebsd.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kevans@freebsd.org Resolution|--- |Works As Intended Status|New |Closed --- Comment #2 from Kyle Evans <kevans@freebsd.org> --- The root of the problem here is that EV_RECEIPT on the first event will halt processing because nevents =3D=3D 0; this is common amongst {Net,Free,Open}= BSD, at least. EV_RECEIPT should only be set on the last event you're passing in to get the semantics you're wanting; if an error happens on any event before that one you'll get the same EV_ERROR return (if feasible) and will not drain the qu= eue. If no error happens, you'll hit that one and still not drain the queue beca= use EV_RECEIPT is set. Here's the diff I applied to your example: <<<EOF --- kq.c.orig 2020-04-21 20:02:08.123750000 -0500 +++ kq.c 2020-04-21 20:02:24.577357000 -0500 @@ -108,7 +108,7 @@ kq =3D kqueue(); - EV_SET(kev, client, EVFILT_READ, EV_ADD | EV_CLEAR | EV_RECEIPT, 0, 0, 0); + EV_SET(kev, client, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0= ); EV_SET(kev + 1, client, EVFILT_WRITE, EV_ADD | EV_CLEAR | EV_RECEIPT, 0, 0, 0); kevent(kq, kev, 2, NULL, 0, NULL); @@ -131,7 +131,7 @@ kq =3D kqueue(); - EV_SET(kev, client, EVFILT_WRITE, EV_ADD | EV_CLEAR | EV_RECEIPT, 0, 0, 0); + EV_SET(kev, client, EVFILT_WRITE, EV_ADD | EV_CLEAR, 0, 0, = 0); EV_SET(kev + 1, client, EVFILT_READ, EV_ADD | EV_CLEAR | EV_RECEIPT, 0, 0, 0); kevent(kq, kev, 2, NULL, 0, NULL); EOF I'm tentatively closing this as "works as intended," but please do feel fre= e to re-open if you believe a change is necessary here after this explanation. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-229741-227-JjiFFNHKHW>