Date: Fri, 16 Dec 2005 16:55:32 -0600 (CST) From: =?ISO-8859-1?Q?Se=E1n_C=2E_Farley?= <sean-freebsd@farley.org> To: Dan Nelson <dnelson@allantgroup.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Number of kevents registered in kqueue Message-ID: <20051216165151.E4815@thor.farley.org> In-Reply-To: <20051216222045.GF89708@dan.emsphone.com> References: <20051216155717.W4815@thor.farley.org> <20051216222045.GF89708@dan.emsphone.com>
index | next in thread | previous in thread | raw e-mail
On Fri, 16 Dec 2005, Dan Nelson wrote: > 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 :) Why does this pop in my mind when reading your reply? :) Lt. Saavik: You lied. Spock: I exaggerated. In other words, there does not currently exist a method to does this on a vanilla system. I can deal with that. It still would be a nice feature to have. Seán -- sean-freebsd@farley.orghelp
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051216165151.E4815>
