if (kqueue_changecnt > kqueue_eventmax)
{
ev_free (kqueue_events);
- kqueue_eventmax = array_roundsize (struct kevent, kqueue_changecnt);
+ kqueue_eventmax = array_nextsize (sizeof (struct kevent), kqueue_eventmax, kqueue_changecnt);
kqueue_events = (struct kevent *)ev_malloc (sizeof (struct kevent) * kqueue_eventmax);
}
res = kevent (backend_fd, kqueue_changes, kqueue_changecnt, kqueue_events, kqueue_eventmax, &ts);
kqueue_changecnt = 0;
- if (res < 0)
+ if (expect_false (res < 0))
{
if (errno != EINTR)
syserr ("(libev) kevent");
if (expect_false (res == kqueue_eventmax))
{
ev_free (kqueue_events);
- kqueue_eventmax = array_roundsize (struct kevent, kqueue_eventmax << 1);
+ kqueue_eventmax = array_nextsize (sizeof (struct kevent), kqueue_eventmax, kqueue_eventmax + 1);
kqueue_events = (struct kevent *)ev_malloc (sizeof (struct kevent) * kqueue_eventmax);
}
}
fcntl (backend_fd, F_SETFD, FD_CLOEXEC); /* not sure if necessary, hopefully doesn't hurt */
- /* fudge *might* be zero from the documentation, but bsd docs are notoriously wrong */
backend_fudge = 1e-3; /* needed to compensate for kevent returning early */
backend_modify = kqueue_modify;
backend_poll = kqueue_poll;