1 | /* |
1 | /* |
2 | * libev kqueue backend |
2 | * libev kqueue backend |
3 | * |
3 | * |
4 | * Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de> |
4 | * Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de> |
5 | * All rights reserved. |
5 | * All rights reserved. |
6 | * |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
8 | * tion, are permitted provided that the following conditions are met: |
8 | * tion, are permitted provided that the following conditions are met: |
9 | * |
9 | * |
… | |
… | |
99 | kqueue_changecnt = 0; |
99 | kqueue_changecnt = 0; |
100 | |
100 | |
101 | if (expect_false (res < 0)) |
101 | if (expect_false (res < 0)) |
102 | { |
102 | { |
103 | if (errno != EINTR) |
103 | if (errno != EINTR) |
104 | syserr ("(libev) kevent"); |
104 | ev_syserr ("(libev) kevent"); |
105 | |
105 | |
106 | return; |
106 | return; |
107 | } |
107 | } |
108 | |
108 | |
109 | for (i = 0; i < res; ++i) |
109 | for (i = 0; i < res; ++i) |
… | |
… | |
182 | kqueue_fork (EV_P) |
182 | kqueue_fork (EV_P) |
183 | { |
183 | { |
184 | close (backend_fd); |
184 | close (backend_fd); |
185 | |
185 | |
186 | while ((backend_fd = kqueue ()) < 0) |
186 | while ((backend_fd = kqueue ()) < 0) |
187 | syserr ("(libev) kqueue"); |
187 | ev_syserr ("(libev) kqueue"); |
188 | |
188 | |
189 | fcntl (backend_fd, F_SETFD, FD_CLOEXEC); |
189 | fcntl (backend_fd, F_SETFD, FD_CLOEXEC); |
190 | |
190 | |
191 | /* re-register interest in fds */ |
191 | /* re-register interest in fds */ |
192 | fd_rearm_all (EV_A); |
192 | fd_rearm_all (EV_A); |