From owner-freebsd-bugs@FreeBSD.ORG Mon Oct 13 15:47:18 2003 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 229B416A4B3 for ; Mon, 13 Oct 2003 15:47:18 -0700 (PDT) Received: from mail.speakeasy.net (mail7.speakeasy.net [216.254.0.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6D8A143FBF for ; Mon, 13 Oct 2003 15:47:13 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (qmail 23403 invoked from network); 13 Oct 2003 22:47:13 -0000 Received: from unknown (HELO hydrogen.funkthat.com) ([69.17.45.168]) (envelope-sender ) by mail7.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 13 Oct 2003 22:47:13 -0000 Received: from hydrogen.funkthat.com (stojuz@localhost.funkthat.com [127.0.0.1])h9DMksJe089210; Mon, 13 Oct 2003 15:47:12 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.12.10/8.12.10/Submit) id h9DJlG9U085218; Mon, 13 Oct 2003 12:47:16 -0700 (PDT) Date: Mon, 13 Oct 2003 12:47:16 -0700 From: John-Mark Gurney To: John Polstra Message-ID: <20031013194716.GP533@funkthat.com> Mail-Followup-To: John-Mark Gurney , John Polstra , freebsd-bugs@freebsd.org, boris@cs.tu-berlin.de References: <200310130749.h9D7nWF9038579@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.2-RELEASE i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html cc: boris@cs.tu-berlin.de cc: freebsd-bugs@freebsd.org Subject: Re: kern/45291: kevent(2) ignores timeout if nevents == 0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: John-Mark Gurney List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2003 22:47:18 -0000 John Polstra wrote this message on Mon, Oct 13, 2003 at 09:37 -0700: > On 13-Oct-2003 John-Mark Gurney wrote: > > Synopsis: kevent(2) ignores timeout if nevents == 0 > > > > State-Changed-From-To: open->feedback > > State-Changed-By: jmg > > State-Changed-When: Mon Oct 13 00:46:53 PDT 2003 > > State-Changed-Why: > > to quote the man page: If timeout is a non-NULL pointer, it specifies > > a maximum interval to wait for an event, > > > > The behavior is correct since you wanted to wait for 0 events, and since > > it has delivered all the events it can (none), it returns. Unless provide > > with good reason (or maybe a patch to the manpage to document this feature?) > > I will close the PR in 5 days. > > I disagree. The current behavior is not correct. It is inconsistent > with the longstanding behavior of both poll() and select(). Also, > from a practical standpoint, returning immediately instead of > waiting for the timeout to expire makes writing a typical event loop > more awkward. It requires the addition of a special case in the > application code to deal with the situation where no events are being > awaited. That's not necessary when using poll() or select(). Simple fix, you wait for a single event, adding a struct kevent such as: struct kevent ke; ret = kevent(qfd, NULL, 0, &ke, 1, &ts); makes it wait the full 10 seconds. so, are you suggesting that we change the behavior to wait for the timeout to expire before we return ANY events? (because that is what your suggesting). Special caseing when someone passes in 0 is not good IMO... it will probably brake lots of code that may in advertantly set as ts, but expect immediate return because of not specifing any return events. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."