Date: Fri, 16 Dec 2005 16:20:45 -0600 From: Dan Nelson <dnelson@allantgroup.com> To: =?utf-8?B?U2XDoW4gQy4=?= Farley <sean-freebsd@farley.org> Cc: freebsd-hackers@freebsd.org Subject: Re: Number of kevents registered in kqueue Message-ID: <20051216222045.GF89708@dan.emsphone.com> In-Reply-To: <20051216155717.W4815@thor.farley.org> References: <20051216155717.W4815@thor.farley.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Dec 16), Sen C. Farley said: > I may have missed it in the man page, but I am unable to find a way > to determine how many kevents are currently registered within a > kqueue. If there is no method for a count, how about a way to find > if a kqueue is empty or not. Besides tracking what events are still > within a kqueue, this would make for an easier way to write an event > loop. Currently, calling kevent() on an empty kqueue will still > block. I don't think there's a way currently. What I did in my local tree is modify kern_kevent so that if the magic number -1 is passed in as nchanges, it will return the entire queued event list back to the caller in *eventlist, and return the number of events as the returncode. Very useful for debugging kqueue-using programs where you want to compare what you think you're waiting for, and what the kernel thinks you're waiting for :) -- Dan Nelson dnelson@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051216222045.GF89708>