… | |
… | |
9 | |
9 | |
10 | /* fix perl api breakage */ |
10 | /* fix perl api breakage */ |
11 | #undef signal |
11 | #undef signal |
12 | #undef sigaction |
12 | #undef sigaction |
13 | |
13 | |
14 | #define EV_SELECT_USE_WIN32_HANDLES 0 |
14 | #define EV_SELECT_IS_WINSOCKET 0 |
|
|
15 | #ifdef _WIN32 |
15 | #define EV_SELECT_USE_FD_SET 0 |
16 | # define EV_SELECT_USE_FD_SET 0 |
|
|
17 | # define NFDBITS PERL_NFDBITS |
|
|
18 | # define fd_mask Perl_fd_mask |
|
|
19 | #endif |
16 | /* due to bugs in OS X we have to use libev/ explicitly here */ |
20 | /* due to bugs in OS X we have to use libev/ explicitly here */ |
17 | #include "libev/ev.c" |
21 | #include "libev/ev.c" |
18 | #include "event.c" |
22 | #include "event.c" |
19 | |
23 | |
20 | #ifndef WIN32 |
24 | #ifndef _WIN32 |
21 | #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 |
25 | #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 |
22 | #if !defined (WIN32) && !defined(__CYGWIN__) |
26 | #if !defined (WIN32) && !defined(__CYGWIN__) |
23 | # define HAVE_STRUCT_IN6_ADDR 1 |
27 | # define HAVE_STRUCT_IN6_ADDR 1 |
24 | #endif |
28 | #endif |
25 | #undef HAVE_STRTOK_R |
29 | #undef HAVE_STRTOK_R |
26 | #undef strtok_r |
30 | #undef strtok_r |
27 | #define strtok_r fake_strtok_r |
31 | #define strtok_r fake_strtok_r |
|
|
32 | #include "evdns.h" |
28 | #include "evdns.c" |
33 | #include "evdns.c" |
29 | #endif |
34 | #endif |
30 | |
35 | |
31 | #ifndef WIN32 |
36 | #ifndef _WIN32 |
32 | # include <pthread.h> |
37 | # include <pthread.h> |
33 | #endif |
38 | #endif |
34 | |
39 | |
35 | typedef int Signal; |
40 | typedef int Signal; |
36 | |
41 | |
… | |
… | |
100 | SvPOK_only (self); |
105 | SvPOK_only (self); |
101 | SvCUR_set (self, size); |
106 | SvCUR_set (self, size); |
102 | |
107 | |
103 | w = (struct ev_watcher *)SvPVX (self); |
108 | w = (struct ev_watcher *)SvPVX (self); |
104 | |
109 | |
105 | ev_watcher_init (w, e_cb); |
110 | ev_init (w, e_cb); |
106 | |
111 | |
107 | w->data = 0; |
112 | w->data = 0; |
108 | w->fh = 0; |
113 | w->fh = 0; |
109 | w->cb_sv = newSVsv (cb_sv); |
114 | w->cb_sv = newSVsv (cb_sv); |
110 | w->self = self; |
115 | w->self = self; |
… | |
… | |
227 | } |
232 | } |
228 | |
233 | |
229 | ///////////////////////////////////////////////////////////////////////////// |
234 | ///////////////////////////////////////////////////////////////////////////// |
230 | // DNS |
235 | // DNS |
231 | |
236 | |
232 | #ifndef WIN32 |
237 | #ifndef _WIN32 |
233 | static void |
238 | static void |
234 | dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) |
239 | dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) |
235 | { |
240 | { |
236 | dSP; |
241 | dSP; |
237 | SV *cb = (SV *)arg; |
242 | SV *cb = (SV *)arg; |
… | |
… | |
315 | const_iv (EV_, CHECK) |
320 | const_iv (EV_, CHECK) |
316 | const_iv (EV_, ERROR) |
321 | const_iv (EV_, ERROR) |
317 | |
322 | |
318 | const_iv (EV, LOOP_ONESHOT) |
323 | const_iv (EV, LOOP_ONESHOT) |
319 | const_iv (EV, LOOP_NONBLOCK) |
324 | const_iv (EV, LOOP_NONBLOCK) |
|
|
325 | const_iv (EV, UNLOOP_ONE) |
|
|
326 | const_iv (EV, UNLOOP_ALL) |
320 | |
327 | |
321 | const_iv (EV, METHOD_AUTO) |
|
|
322 | const_iv (EV, METHOD_SELECT) |
328 | const_iv (EV, METHOD_SELECT) |
323 | const_iv (EV, METHOD_POLL) |
329 | const_iv (EV, METHOD_POLL) |
324 | const_iv (EV, METHOD_EPOLL) |
330 | const_iv (EV, METHOD_EPOLL) |
325 | const_iv (EV, METHOD_KQUEUE) |
331 | const_iv (EV, METHOD_KQUEUE) |
326 | const_iv (EV, METHOD_DEVPOLL) |
332 | const_iv (EV, METHOD_DEVPOLL) |
327 | const_iv (EV, METHOD_PORT) |
333 | const_iv (EV, METHOD_PORT) |
328 | const_iv (EV, METHOD_ANY) |
334 | const_iv (EV, FLAG_AUTO) |
|
|
335 | const_iv (EV, FLAG_NOENV) |
329 | }; |
336 | }; |
330 | |
337 | |
331 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
338 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
332 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
339 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
333 | |
340 | |
… | |
… | |
375 | evapi.child_stop = ev_child_stop; |
382 | evapi.child_stop = ev_child_stop; |
376 | |
383 | |
377 | sv_setiv (sv, (IV)&evapi); |
384 | sv_setiv (sv, (IV)&evapi); |
378 | SvREADONLY_on (sv); |
385 | SvREADONLY_on (sv); |
379 | } |
386 | } |
380 | #ifndef WIN32 |
387 | #ifndef _WIN32 |
381 | pthread_atfork (0, 0, ev_default_fork); |
388 | pthread_atfork (0, 0, ev_default_fork); |
382 | #endif |
389 | #endif |
383 | } |
390 | } |
384 | |
391 | |
385 | NV ev_now () |
392 | NV ev_now () |
386 | |
393 | |
387 | int ev_method () |
394 | int ev_method () |
388 | |
395 | |
389 | NV ev_time () |
396 | NV ev_time () |
390 | |
397 | |
391 | int ev_default_loop (int methods = EVMETHOD_AUTO) |
398 | int ev_default_loop (int methods = EVFLAG_AUTO) |
392 | |
399 | |
393 | void ev_loop (int flags = 0) |
400 | void ev_loop (int flags = 0) |
394 | |
401 | |
395 | void ev_unloop (int how = 1) |
402 | void ev_unloop (int how = 1) |
396 | |
403 | |
… | |
… | |
796 | CODE: |
803 | CODE: |
797 | RETVAL = ix ? w->rpid : w->rstatus; |
804 | RETVAL = ix ? w->rpid : w->rstatus; |
798 | OUTPUT: |
805 | OUTPUT: |
799 | RETVAL |
806 | RETVAL |
800 | |
807 | |
801 | #ifndef WIN32 |
808 | #ifndef _WIN32 |
802 | |
809 | |
803 | MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ |
810 | MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ |
804 | |
811 | |
805 | BOOT: |
812 | BOOT: |
806 | { |
813 | { |
… | |
… | |
877 | |
884 | |
878 | int evdns_set_option (char *option, char *val, int flags) |
885 | int evdns_set_option (char *option, char *val, int flags) |
879 | |
886 | |
880 | int evdns_resolv_conf_parse (int flags, const char *filename) |
887 | int evdns_resolv_conf_parse (int flags, const char *filename) |
881 | |
888 | |
882 | #ifdef MS_WINDOWS |
889 | #ifdef _WIN32 |
883 | |
890 | |
884 | int evdns_config_windows_nameservers () |
891 | int evdns_config_windows_nameservers () |
885 | |
892 | |
886 | #endif |
893 | #endif |
887 | |
894 | |