ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/EV.xs
(Generate patch)

Comparing EV/EV.xs (file contents):
Revision 1.63 by root, Sat Nov 10 03:19:21 2007 UTC vs.
Revision 1.74 by root, Fri Nov 23 05:13:48 2007 UTC

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
27#define strtok_r fake_strtok_r 31#define strtok_r fake_strtok_r
28#include "evdns.h" 32#include "evdns.h"
29#include "evdns.c" 33#include "evdns.c"
30#endif 34#endif
31 35
32#ifndef WIN32 36#ifndef _WIN32
33# include <pthread.h> 37# include <pthread.h>
34#endif 38#endif
35 39
36typedef int Signal; 40typedef int Signal;
37 41
163 PUSHs (sv_self); 167 PUSHs (sv_self);
164 PUSHs (sv_events); 168 PUSHs (sv_events);
165 169
166 PUTBACK; 170 PUTBACK;
167 call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL); 171 call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL);
168 SP = PL_stack_base + mark; PUTBACK;
169 172
170 SvREFCNT_dec (sv_self); 173 SvREFCNT_dec (sv_self);
171 SvREFCNT_dec (sv_status); 174 SvREFCNT_dec (sv_status);
172 175
173 if (sv_events_cache) 176 if (sv_events_cache)
178 if (SvTRUE (ERRSV)) 181 if (SvTRUE (ERRSV))
179 { 182 {
180 PUSHMARK (SP); 183 PUSHMARK (SP);
181 PUTBACK; 184 PUTBACK;
182 call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); 185 call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR);
183 SP = PL_stack_base + mark; PUTBACK;
184 } 186 }
187
188 SP = PL_stack_base + mark;
189 PUTBACK;
185} 190}
186 191
187static ev_tstamp 192static ev_tstamp
188e_periodic_cb (struct ev_periodic *w, ev_tstamp now) 193e_periodic_cb (struct ev_periodic *w, ev_tstamp now)
189{ 194{
228} 233}
229 234
230///////////////////////////////////////////////////////////////////////////// 235/////////////////////////////////////////////////////////////////////////////
231// DNS 236// DNS
232 237
233#ifndef WIN32 238#ifndef _WIN32
234static void 239static void
235dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg) 240dns_cb (int result, char type, int count, int ttl, void *addresses, void *arg)
236{ 241{
237 dSP; 242 dSP;
238 SV *cb = (SV *)arg; 243 SV *cb = (SV *)arg;
316 const_iv (EV_, CHECK) 321 const_iv (EV_, CHECK)
317 const_iv (EV_, ERROR) 322 const_iv (EV_, ERROR)
318 323
319 const_iv (EV, LOOP_ONESHOT) 324 const_iv (EV, LOOP_ONESHOT)
320 const_iv (EV, LOOP_NONBLOCK) 325 const_iv (EV, LOOP_NONBLOCK)
326 const_iv (EV, UNLOOP_ONE)
327 const_iv (EV, UNLOOP_ALL)
321 328
322 const_iv (EV, METHOD_AUTO)
323 const_iv (EV, METHOD_SELECT) 329 const_iv (EV, BACKEND_SELECT)
324 const_iv (EV, METHOD_POLL) 330 const_iv (EV, BACKEND_POLL)
325 const_iv (EV, METHOD_EPOLL) 331 const_iv (EV, BACKEND_EPOLL)
326 const_iv (EV, METHOD_KQUEUE) 332 const_iv (EV, BACKEND_KQUEUE)
327 const_iv (EV, METHOD_DEVPOLL) 333 const_iv (EV, BACKEND_DEVPOLL)
328 const_iv (EV, METHOD_PORT) 334 const_iv (EV, BACKEND_PORT)
329 const_iv (EV, METHOD_ANY) 335 const_iv (EV, FLAG_AUTO)
336 const_iv (EV, FLAG_NOENV)
330 }; 337 };
331 338
332 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 339 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
333 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 340 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
334 341
350 evapi.ver = EV_API_VERSION; 357 evapi.ver = EV_API_VERSION;
351 evapi.rev = EV_API_REVISION; 358 evapi.rev = EV_API_REVISION;
352 evapi.sv_fileno = sv_fileno; 359 evapi.sv_fileno = sv_fileno;
353 evapi.sv_signum = sv_signum; 360 evapi.sv_signum = sv_signum;
354 evapi.now = ev_now; 361 evapi.now = ev_now;
355 evapi.method = ev_method; 362 evapi.backend = ev_backend;
356 evapi.unloop = ev_unloop; 363 evapi.unloop = ev_unloop;
357 evapi.time = ev_time; 364 evapi.time = ev_time;
358 evapi.loop = ev_loop; 365 evapi.loop = ev_loop;
359 evapi.once = ev_once; 366 evapi.once = ev_once;
360 evapi.io_start = ev_io_start; 367 evapi.io_start = ev_io_start;
376 evapi.child_stop = ev_child_stop; 383 evapi.child_stop = ev_child_stop;
377 384
378 sv_setiv (sv, (IV)&evapi); 385 sv_setiv (sv, (IV)&evapi);
379 SvREADONLY_on (sv); 386 SvREADONLY_on (sv);
380 } 387 }
381#ifndef WIN32 388#ifndef _WIN32
382 pthread_atfork (0, 0, ev_default_fork); 389 pthread_atfork (0, 0, ev_default_fork);
383#endif 390#endif
384} 391}
385 392
386NV ev_now () 393NV ev_now ()
387 394
388int ev_method () 395unsigned int ev_backend ()
389 396
390NV ev_time () 397NV ev_time ()
391 398
392int ev_default_loop (int methods = EVMETHOD_AUTO) 399unsigned int ev_default_loop (unsigned int flags = ev_supported_backends ())
393 400
394void ev_loop (int flags = 0) 401void ev_loop (int flags = 0)
395 402
396void ev_unloop (int how = 1) 403void ev_unloop (int how = 1)
397 404
480 OUTPUT: 487 OUTPUT:
481 RETVAL 488 RETVAL
482 489
483struct ev_child *child (int pid, SV *cb) 490struct ev_child *child (int pid, SV *cb)
484 ALIAS: 491 ALIAS:
485 check_ns = 1 492 child_ns = 1
486 CODE: 493 CODE:
487 RETVAL = e_new (sizeof (struct ev_child), cb); 494 RETVAL = e_new (sizeof (struct ev_child), cb);
488 ev_child_set (RETVAL, pid); 495 ev_child_set (RETVAL, pid);
489 if (!ix) ev_child_start (RETVAL); 496 if (!ix) ev_child_start (RETVAL);
490 OUTPUT: 497 OUTPUT:
797 CODE: 804 CODE:
798 RETVAL = ix ? w->rpid : w->rstatus; 805 RETVAL = ix ? w->rpid : w->rstatus;
799 OUTPUT: 806 OUTPUT:
800 RETVAL 807 RETVAL
801 808
802#ifndef WIN32 809#ifndef _WIN32
803 810
804MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ 811MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_
805 812
806BOOT: 813BOOT:
807{ 814{
878 885
879int evdns_set_option (char *option, char *val, int flags) 886int evdns_set_option (char *option, char *val, int flags)
880 887
881int evdns_resolv_conf_parse (int flags, const char *filename) 888int evdns_resolv_conf_parse (int flags, const char *filename)
882 889
883#ifdef MS_WINDOWS 890#ifdef _WIN32
884 891
885int evdns_config_windows_nameservers () 892int evdns_config_windows_nameservers ()
886 893
887#endif 894#endif
888 895

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines