… | |
… | |
37 | static void |
37 | static void |
38 | kqueue_change (EV_P_ int fd, int filter, int flags, int fflags) |
38 | kqueue_change (EV_P_ int fd, int filter, int flags, int fflags) |
39 | { |
39 | { |
40 | struct kevent *ke; |
40 | struct kevent *ke; |
41 | |
41 | |
42 | array_needsize (kqueue_changes, kqueue_changemax, ++kqueue_changecnt, ); |
42 | array_needsize (struct kevent, kqueue_changes, kqueue_changemax, ++kqueue_changecnt, ); |
43 | |
43 | |
44 | ke = &kqueue_changes [kqueue_changecnt - 1]; |
44 | ke = &kqueue_changes [kqueue_changecnt - 1]; |
45 | memset (ke, 0, sizeof (struct kevent)); |
45 | memset (ke, 0, sizeof (struct kevent)); |
46 | ke->ident = fd; |
46 | ke->ident = fd; |
47 | ke->filter = filter; |
47 | ke->filter = filter; |
… | |
… | |
85 | kqueue_changecnt = 0; |
85 | kqueue_changecnt = 0; |
86 | |
86 | |
87 | if (res < 0) |
87 | if (res < 0) |
88 | { |
88 | { |
89 | if (errno != EINTR) |
89 | if (errno != EINTR) |
90 | syserr (); |
90 | syserr ("(libev) kevent"); |
91 | |
91 | |
92 | return; |
92 | return; |
93 | } |
93 | } |
94 | |
94 | |
95 | for (i = 0; i < res; ++i) |
95 | for (i = 0; i < res; ++i) |
… | |
… | |
183 | } |
183 | } |
184 | |
184 | |
185 | static void |
185 | static void |
186 | kqueue_fork (EV_P) |
186 | kqueue_fork (EV_P) |
187 | { |
187 | { |
|
|
188 | close (kqueue_fd); |
|
|
189 | |
188 | kqueue_fd = kqueue (); |
190 | while ((kqueue_fd = kqueue ()) < 0) |
|
|
191 | syserr ("(libev) kqueue"); |
|
|
192 | |
189 | fcntl (kqueue_fd, F_SETFD, FD_CLOEXEC); |
193 | fcntl (kqueue_fd, F_SETFD, FD_CLOEXEC); |
190 | |
194 | |
191 | /* re-register interest in fds */ |
195 | /* re-register interest in fds */ |
192 | fd_rearm_all (EV_A); |
196 | fd_rearm_all (EV_A); |
193 | } |
197 | } |