… | |
… | |
34 | #include <sys/queue.h> |
34 | #include <sys/queue.h> |
35 | #include <sys/event.h> |
35 | #include <sys/event.h> |
36 | #include <string.h> |
36 | #include <string.h> |
37 | #include <errno.h> |
37 | #include <errno.h> |
38 | |
38 | |
39 | static void |
39 | void inline_speed |
40 | kqueue_change (EV_P_ int fd, int filter, int flags, int fflags) |
40 | kqueue_change (EV_P_ int fd, int filter, int flags, int fflags) |
41 | { |
41 | { |
42 | struct kevent *ke; |
42 | struct kevent *ke; |
43 | |
43 | |
44 | ++kqueue_changecnt; |
44 | ++kqueue_changecnt; |
… | |
… | |
140 | kqueue_eventmax = array_roundsize (struct kevent, kqueue_eventmax << 1); |
140 | kqueue_eventmax = array_roundsize (struct kevent, 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 | |
145 | static int |
145 | int inline_size |
146 | kqueue_init (EV_P_ int flags) |
146 | kqueue_init (EV_P_ int flags) |
147 | { |
147 | { |
148 | struct kevent ch, ev; |
148 | struct kevent ch, ev; |
149 | |
149 | |
150 | /* Initalize the kernel queue */ |
150 | /* Initalize the kernel queue */ |
… | |
… | |
166 | kqueue_changecnt = 0; |
166 | kqueue_changecnt = 0; |
167 | |
167 | |
168 | return EVBACKEND_KQUEUE; |
168 | return EVBACKEND_KQUEUE; |
169 | } |
169 | } |
170 | |
170 | |
171 | static void |
171 | void inline_size |
172 | kqueue_destroy (EV_P) |
172 | kqueue_destroy (EV_P) |
173 | { |
173 | { |
174 | close (backend_fd); |
|
|
175 | |
|
|
176 | ev_free (kqueue_events); |
174 | ev_free (kqueue_events); |
177 | ev_free (kqueue_changes); |
175 | ev_free (kqueue_changes); |
178 | } |
176 | } |
179 | |
177 | |
180 | static void |
178 | void inline_size |
181 | kqueue_fork (EV_P) |
179 | kqueue_fork (EV_P) |
182 | { |
180 | { |
183 | close (backend_fd); |
181 | close (backend_fd); |
184 | |
182 | |
185 | while ((backend_fd = kqueue ()) < 0) |
183 | while ((backend_fd = kqueue ()) < 0) |