… | |
… | |
3 | #include "XSUB.h" |
3 | #include "XSUB.h" |
4 | |
4 | |
5 | /*#include <netinet/in.h>*/ |
5 | /*#include <netinet/in.h>*/ |
6 | |
6 | |
7 | #define EV_PROTOTYPES 1 |
7 | #define EV_PROTOTYPES 1 |
|
|
8 | #define EV_STANDALONE 1 |
8 | #include "EV/EVAPI.h" |
9 | #include "EV/EVAPI.h" |
9 | |
10 | |
10 | #include "libev/ev.c" |
11 | #include "libev/ev.c" |
11 | #include "libev/event.h" |
12 | #include "libev/event.h" |
12 | #include "libev/event.c" |
13 | #include "libev/event.c" |
|
|
14 | #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 |
|
|
15 | #define HAVE_STRUCT_IN6_ADDR 1 |
|
|
16 | #undef HAVE_STRTOK_R |
|
|
17 | #undef strtok_r |
|
|
18 | #define strtok_r fake_strtok_r |
13 | #include "libev/evdns.c" |
19 | #include "libev/evdns.c" |
14 | |
20 | |
15 | typedef int Signal; |
21 | typedef int Signal; |
16 | |
22 | |
17 | static struct EVAPI evapi; |
23 | static struct EVAPI evapi; |
… | |
… | |
137 | |
143 | |
138 | PUSHMARK (SP); |
144 | PUSHMARK (SP); |
139 | EXTEND (SP, 2); |
145 | EXTEND (SP, 2); |
140 | PUSHs (sv_self); |
146 | PUSHs (sv_self); |
141 | PUSHs (sv_events); |
147 | PUSHs (sv_events); |
142 | |
|
|
143 | if (revents & EV_CHILD) |
|
|
144 | XPUSHs (sv_status = newSViv (((struct ev_child *)w)->status)); |
|
|
145 | |
148 | |
146 | PUTBACK; |
149 | PUTBACK; |
147 | call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL); |
150 | call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL); |
148 | SP = PL_stack_base + mark; PUTBACK; |
151 | SP = PL_stack_base + mark; PUTBACK; |
149 | |
152 | |
… | |
… | |
285 | /* the poor man's shared library emulator */ |
288 | /* the poor man's shared library emulator */ |
286 | evapi.ver = EV_API_VERSION; |
289 | evapi.ver = EV_API_VERSION; |
287 | evapi.rev = EV_API_REVISION; |
290 | evapi.rev = EV_API_REVISION; |
288 | evapi.sv_fileno = sv_fileno; |
291 | evapi.sv_fileno = sv_fileno; |
289 | evapi.sv_signum = sv_signum; |
292 | evapi.sv_signum = sv_signum; |
290 | evapi.now = &ev_now; |
293 | evapi.now = ev_now; |
291 | evapi.method = &ev_method; |
294 | evapi.method = ev_method; |
292 | evapi.loop_done = &ev_loop_done; |
295 | evapi.unloop = ev_unloop; |
293 | evapi.time = ev_time; |
296 | evapi.time = ev_time; |
294 | evapi.loop = ev_loop; |
297 | evapi.loop = ev_loop; |
295 | evapi.once = ev_once; |
298 | evapi.once = ev_once; |
296 | evapi.io_start = ev_io_start; |
299 | evapi.io_start = ev_io_start; |
297 | evapi.io_stop = ev_io_stop; |
300 | evapi.io_stop = ev_io_stop; |
… | |
… | |
317 | |
320 | |
318 | pthread_atfork (ev_fork_prepare, ev_fork_parent, ev_fork_child); |
321 | pthread_atfork (ev_fork_prepare, ev_fork_parent, ev_fork_child); |
319 | } |
322 | } |
320 | |
323 | |
321 | NV ev_now () |
324 | NV ev_now () |
322 | CODE: |
|
|
323 | RETVAL = ev_now; |
|
|
324 | OUTPUT: |
|
|
325 | RETVAL |
|
|
326 | |
325 | |
327 | int ev_method () |
326 | int ev_method () |
328 | CODE: |
|
|
329 | RETVAL = ev_method; |
|
|
330 | OUTPUT: |
|
|
331 | RETVAL |
|
|
332 | |
327 | |
333 | NV ev_time () |
328 | NV ev_time () |
334 | |
329 | |
335 | void ev_init (int methods = EVMETHOD_AUTO) |
330 | int ev_init (int methods = EVMETHOD_AUTO) |
336 | |
331 | |
337 | void ev_loop (int flags = 0) |
332 | void ev_loop (int flags = 0) |
338 | |
333 | |
339 | void ev_loop_done (int value = 1) |
334 | void ev_unloop (int how = 1) |
340 | CODE: |
|
|
341 | ev_loop_done = value; |
|
|
342 | |
335 | |
343 | struct ev_io *io (SV *fh, int events, SV *cb) |
336 | struct ev_io *io (SV *fh, int events, SV *cb) |
344 | ALIAS: |
337 | ALIAS: |
345 | io_ns = 1 |
338 | io_ns = 1 |
346 | CODE: |
339 | CODE: |
… | |
… | |
422 | |
415 | |
423 | struct ev_child *child (int pid, SV *cb) |
416 | struct ev_child *child (int pid, SV *cb) |
424 | ALIAS: |
417 | ALIAS: |
425 | check_ns = 1 |
418 | check_ns = 1 |
426 | CODE: |
419 | CODE: |
427 | RETVAL = e_new (sizeof (struct ev_check), cb); |
420 | RETVAL = e_new (sizeof (struct ev_child), cb); |
428 | ev_child_set (RETVAL, pid); |
421 | ev_child_set (RETVAL, pid); |
429 | if (!ix) ev_child_start (RETVAL); |
422 | if (!ix) ev_child_start (RETVAL); |
430 | OUTPUT: |
423 | OUTPUT: |
431 | RETVAL |
424 | RETVAL |
432 | |
425 | |
… | |
… | |
719 | } |
712 | } |
720 | OUTPUT: |
713 | OUTPUT: |
721 | RETVAL |
714 | RETVAL |
722 | |
715 | |
723 | |
716 | |
724 | int status (struct ev_child *w) |
717 | int rstatus (struct ev_child *w) |
|
|
718 | ALIAS: |
|
|
719 | rpid = 1 |
725 | CODE: |
720 | CODE: |
726 | RETVAL = w->status; |
721 | RETVAL = ix ? w->rpid : w->rstatus; |
727 | OUTPUT: |
722 | OUTPUT: |
728 | RETVAL |
723 | RETVAL |
729 | |
724 | |
730 | MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ |
725 | MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ |
731 | |
726 | |