+static void
+kqueue_destroy (EV_P)
+{
+ close (kqueue_fd);
+
+ ev_free (kqueue_events);
+ ev_free (kqueue_changes);
+}
+
+static void
+kqueue_fork (EV_P)
+{
+ for (;;)
+ {
+ kqueue_fd = kqueue ();
+
+ if (kqueue_fd >= 0)
+ break;
+
+ syserr ("(libev) kqueue");
+ }
+
+ fcntl (kqueue_fd, F_SETFD, FD_CLOEXEC);
+
+ /* re-register interest in fds */
+ fd_rearm_all (EV_A);
+}
+