ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev_kqueue.c
(Generate patch)

Comparing libev/ev_kqueue.c (file contents):
Revision 1.27 by root, Wed Nov 28 11:15:55 2007 UTC vs.
Revision 1.29 by root, Sun Dec 9 02:12:44 2007 UTC

81 81
82 /* need to resize so there is enough space for errors */ 82 /* need to resize so there is enough space for errors */
83 if (kqueue_changecnt > kqueue_eventmax) 83 if (kqueue_changecnt > kqueue_eventmax)
84 { 84 {
85 ev_free (kqueue_events); 85 ev_free (kqueue_events);
86 kqueue_eventmax = array_roundsize (struct kevent, kqueue_changecnt); 86 kqueue_eventmax = array_nextsize (sizeof (struct kevent), kqueue_eventmax, kqueue_changecnt);
87 kqueue_events = (struct kevent *)ev_malloc (sizeof (struct kevent) * kqueue_eventmax); 87 kqueue_events = (struct kevent *)ev_malloc (sizeof (struct kevent) * kqueue_eventmax);
88 } 88 }
89 89
90 ts.tv_sec = (time_t)timeout; 90 ts.tv_sec = (time_t)timeout;
91 ts.tv_nsec = (long)((timeout - (ev_tstamp)ts.tv_sec) * 1e9); 91 ts.tv_nsec = (long)((timeout - (ev_tstamp)ts.tv_sec) * 1e9);
92 res = kevent (backend_fd, kqueue_changes, kqueue_changecnt, kqueue_events, kqueue_eventmax, &ts); 92 res = kevent (backend_fd, kqueue_changes, kqueue_changecnt, kqueue_events, kqueue_eventmax, &ts);
93 kqueue_changecnt = 0; 93 kqueue_changecnt = 0;
94 94
95 if (res < 0) 95 if (expect_false (res < 0))
96 { 96 {
97 if (errno != EINTR) 97 if (errno != EINTR)
98 syserr ("(libev) kevent"); 98 syserr ("(libev) kevent");
99 99
100 return; 100 return;
135 } 135 }
136 136
137 if (expect_false (res == kqueue_eventmax)) 137 if (expect_false (res == kqueue_eventmax))
138 { 138 {
139 ev_free (kqueue_events); 139 ev_free (kqueue_events);
140 kqueue_eventmax = array_roundsize (struct kevent, kqueue_eventmax << 1); 140 kqueue_eventmax = array_nextsize (sizeof (struct kevent), kqueue_eventmax, kqueue_eventmax + 1);
141 kqueue_events = (struct kevent *)ev_malloc (sizeof (struct kevent) * kqueue_eventmax); 141 kqueue_events = (struct kevent *)ev_malloc (sizeof (struct kevent) * kqueue_eventmax);
142 } 142 }
143} 143}
144 144
145int inline_size 145int inline_size

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines