Hello Paul, Well, I wanted to limit the queue length of accepted connections (limit pollset ring length), and I was relying on pollset_add() returning me some error if I try to add a pollfd beyond the allocated size. Looks like I have to do this myself.
Thanks, Ashwin -----Original Message----- From: Paul Querna [mailto:[EMAIL PROTECTED] Sent: Monday, January 24, 2005 4:09 PM To: Kashyap Ashwin Cc: dev@apr.apache.org Subject: Re: epoll.c bug -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kashyap Ashwin wrote: | Hi, | | I noticed that pollset->nalloc is not checked in pollset_add in epoll.c. | | select.c has: | | if (pollset->nelts == pollset->nalloc) { | | return APR_ENOMEM; | | } | | | | Shouldn't epoll.c also have this check? | No. epoll is expandable beyond the initial nalloc. (it stores all of its pollfds in a linked list). nalloc only effects the maximum number of events that will be returned by a single _poll call. | | Also, you are incrementing nelts for every pollset_add, but never | decrementing it. This will eventually cause an overflow. It will also | make the above fix to epoll.c broken. | While this in some ways is a bug, nelts is not used for any part of the epoll implementation, and could be safely removed. This is just a left over variable from the original poll version that I didn't remove. (an overflow will not even hurt it). | | This is really causing me trouble, I am trying to implement something | like SEDA (staged event driven execution) where I have to add and remove | pollfd from a pollset a few thousand times, whenever there is some event. | It might be interesting to add a _enable and _disable set of functions to the API, since KQueue supports turning off a FD for events, but not removing it. - -Paul Querna -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iD8DBQFB9WP/94h19kJyHwARAjJJAKClE8/NOCNcvciRaKhxRItN4ZnhXwCgrfdk EAdKxmtAmf/1ypgaw65IMEQ= =58ko -----END PGP SIGNATURE-----