problem with poll_poll() under FreeBSD

Marc Lehmann schmorp at schmorp.de
Thu Mar 25 15:45:35 CET 2010


On Thu, Mar 25, 2010 at 04:53:02PM +0300, Zajcev Evgeny <lg.zevlg at gmail.com> wrote:
> at the for time `polls' looks like this:
>   {fd = 3, events = 1, revents = 0}
>   {fd = 6, events = 5, revents = 4}
>   {fd = 775043377, events = 13873, revents = 11832}    (**)
>   ...
> i don't know `res' value, but i suppose it was 2.

The value of res would be helpful. If res is two, then this is a kernel
bug that you should report (or maybe upgrade to a fixed version), not a
bug in libev.

> of course this situation is incorrect for the code above, because `p'
> will eventually point to (**) uninitialized record (but present in
> memory).

Only if poll returns an illegal return code.

> So, i think `res' must decrease in conjunction with `p' increasement,
> like this:

Then we would miss events, as not all poll structs have events, and we
would only look at the first "res", and not all with nonzero result code.

>     for (p = polls; res--; ++p)

> what do you think?

All depends on what res is. If res is two, then this is clearly a kernel
bug.

> PS: i dont get any problem running current libev implementation under
> linux and in most situations under freebsd

Probably because linux poll returns 1 in the above situation.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list