problem with poll_poll() under FreeBSD

Zajcev Evgeny lg.zevlg at gmail.com
Thu Mar 25 14:53:02 CET 2010


I've got problems running libev in complex environment under FreeBSD.

with gcc (GCC) 4.2.1 20070719  [FreeBSD]

I've got core dump and tracked problem to next piece of code in
ev_poll.c(poll_poll):

...
  else
    for (p = polls; res; ++p)
      if (expect_false (p->revents)) /* this expect is debatable */
        {
          --res;

          if (expect_false (p->revents & POLLNVAL))
            fd_kill (EV_A_ p->fd);
         ..
        }
...

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.

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

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

...
  else
    for (p = polls; res--; ++p)
      if (expect_false (p->revents)) /* this expect is debatable */
        {
          if (expect_false (p->revents & POLLNVAL))
            fd_kill (EV_A_ p->fd);
...

what do you think?

thanks

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

-- 
lg



More information about the libev mailing list