… | |
… | |
5 | /*#include <netinet/in.h>*/ |
5 | /*#include <netinet/in.h>*/ |
6 | |
6 | |
7 | #define EV_PROTOTYPES 1 |
7 | #define EV_PROTOTYPES 1 |
8 | #include "EV/EVAPI.h" |
8 | #include "EV/EVAPI.h" |
9 | |
9 | |
|
|
10 | /* fix perl api breakage */ |
|
|
11 | #undef signal |
|
|
12 | #undef sigaction |
|
|
13 | |
10 | /* due to bugs in OS X we have to use libev/ explicitly here */ |
14 | /* due to bugs in OS X we have to use libev/ explicitly here */ |
11 | #include "libev/ev.c" |
15 | #include "libev/ev.c" |
12 | #include "event.c" |
16 | #include "event.c" |
|
|
17 | |
|
|
18 | #ifndef WIN32 |
13 | #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 |
19 | #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 |
14 | #if !defined (WIN32) && !defined(__CYGWIN__) |
20 | #if !defined (WIN32) && !defined(__CYGWIN__) |
15 | # define HAVE_STRUCT_IN6_ADDR 1 |
21 | # define HAVE_STRUCT_IN6_ADDR 1 |
16 | #endif |
22 | #endif |
17 | #undef HAVE_STRTOK_R |
23 | #undef HAVE_STRTOK_R |
18 | #undef strtok_r |
24 | #undef strtok_r |
19 | #define strtok_r fake_strtok_r |
25 | #define strtok_r fake_strtok_r |
20 | #include "evdns.c" |
26 | #include "evdns.c" |
|
|
27 | #endif |
21 | |
28 | |
22 | #ifndef WIN32 |
29 | #ifndef WIN32 |
23 | # include <pthread.h> |
30 | # include <pthread.h> |
24 | #endif |
31 | #endif |
25 | |
32 | |
… | |
… | |
100 | w->self = self; |
107 | w->self = self; |
101 | |
108 | |
102 | return (void *)w; |
109 | return (void *)w; |
103 | } |
110 | } |
104 | |
111 | |
105 | static void * |
112 | static void |
106 | e_destroy (void *w_) |
113 | e_destroy (void *w_) |
107 | { |
114 | { |
108 | struct ev_watcher *w = w_; |
115 | struct ev_watcher *w = w_; |
109 | |
116 | |
110 | SvREFCNT_dec (w->fh ); w->fh = 0; |
117 | SvREFCNT_dec (w->fh ); w->fh = 0; |
… | |
… | |
173 | } |
180 | } |
174 | |
181 | |
175 | ///////////////////////////////////////////////////////////////////////////// |
182 | ///////////////////////////////////////////////////////////////////////////// |
176 | // DNS |
183 | // DNS |
177 | |
184 | |
|
|
185 | #ifndef WIN32 |
178 | static void |
186 | static void |
179 | dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) |
187 | dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) |
180 | { |
188 | { |
181 | dSP; |
189 | dSP; |
182 | SV *cb = (SV *)arg; |
190 | SV *cb = (SV *)arg; |
… | |
… | |
221 | call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); |
229 | call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); |
222 | } |
230 | } |
223 | |
231 | |
224 | LEAVE; |
232 | LEAVE; |
225 | } |
233 | } |
|
|
234 | #endif |
226 | |
235 | |
227 | #define CHECK_REPEAT(repeat) if (repeat < 0.) \ |
236 | #define CHECK_REPEAT(repeat) if (repeat < 0.) \ |
228 | croak (# repeat " value must be >= 0"); |
237 | croak (# repeat " value must be >= 0"); |
229 | |
238 | |
230 | #define CHECK_FD(fh,fd) if ((fd) < 0) \ |
239 | #define CHECK_FD(fh,fd) if ((fd) < 0) \ |
… | |
… | |
237 | |
246 | |
238 | PROTOTYPES: ENABLE |
247 | PROTOTYPES: ENABLE |
239 | |
248 | |
240 | BOOT: |
249 | BOOT: |
241 | { |
250 | { |
242 | int i; |
|
|
243 | HV *stash = gv_stashpv ("EV", 1); |
251 | HV *stash = gv_stashpv ("EV", 1); |
244 | |
252 | |
245 | static const struct { |
253 | static const struct { |
246 | const char *name; |
254 | const char *name; |
247 | IV iv; |
255 | IV iv; |
… | |
… | |
320 | evapi.child_stop = ev_child_stop; |
328 | evapi.child_stop = ev_child_stop; |
321 | |
329 | |
322 | sv_setiv (sv, (IV)&evapi); |
330 | sv_setiv (sv, (IV)&evapi); |
323 | SvREADONLY_on (sv); |
331 | SvREADONLY_on (sv); |
324 | } |
332 | } |
325 | |
|
|
326 | #ifndef WIN32 |
333 | #ifndef WIN32 |
327 | pthread_atfork (0, 0, ev_default_fork); |
334 | pthread_atfork (0, 0, ev_default_fork); |
328 | #endif |
335 | #endif |
329 | } |
336 | } |
330 | |
337 | |
331 | NV ev_now () |
338 | NV ev_now () |
332 | |
339 | |
333 | int ev_method () |
340 | int ev_method () |
… | |
… | |
724 | rpid = 1 |
731 | rpid = 1 |
725 | CODE: |
732 | CODE: |
726 | RETVAL = ix ? w->rpid : w->rstatus; |
733 | RETVAL = ix ? w->rpid : w->rstatus; |
727 | OUTPUT: |
734 | OUTPUT: |
728 | RETVAL |
735 | RETVAL |
|
|
736 | |
|
|
737 | #ifndef WIN32 |
729 | |
738 | |
730 | MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ |
739 | MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ |
731 | |
740 | |
732 | BOOT: |
741 | BOOT: |
733 | { |
742 | { |
… | |
… | |
858 | |
867 | |
859 | #void DESTROY (struct evhttp_request *req); |
868 | #void DESTROY (struct evhttp_request *req); |
860 | |
869 | |
861 | #endif |
870 | #endif |
862 | |
871 | |
|
|
872 | #endif |
863 | |
873 | |
864 | |
874 | |
865 | |
875 | |
866 | |
876 | |
867 | |
877 | |