… | |
… | |
398 | /* AIX has a completely broken poll.h header */ |
398 | /* AIX has a completely broken poll.h header */ |
399 | # undef EV_USE_POLL |
399 | # undef EV_USE_POLL |
400 | # define EV_USE_POLL 0 |
400 | # define EV_USE_POLL 0 |
401 | #endif |
401 | #endif |
402 | |
402 | |
403 | #if EV_USE_LINUXAIO |
|
|
404 | # include <linux/aio_abi.h> /* probably only needed for aio_context_t */ |
|
|
405 | #endif |
|
|
406 | |
|
|
407 | /* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */ |
403 | /* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */ |
408 | /* which makes programs even slower. might work on other unices, too. */ |
404 | /* which makes programs even slower. might work on other unices, too. */ |
409 | #if EV_USE_CLOCK_SYSCALL |
405 | #if EV_USE_CLOCK_SYSCALL |
410 | # include <sys/syscall.h> |
406 | # include <sys/syscall.h> |
411 | # ifdef SYS_clock_gettime |
407 | # ifdef SYS_clock_gettime |
… | |
… | |
442 | # endif |
438 | # endif |
443 | #endif |
439 | #endif |
444 | |
440 | |
445 | #if EV_USE_LINUXAIO |
441 | #if EV_USE_LINUXAIO |
446 | # include <sys/syscall.h> |
442 | # include <sys/syscall.h> |
447 | # if !SYS_io_getevents |
443 | # if !SYS_io_getevents || !EV_USE_EPOLL /* ev_linxaio uses ev_poll.c:ev_epoll_create */ |
448 | # undef EV_USE_LINUXAIO |
444 | # undef EV_USE_LINUXAIO |
449 | # define EV_USE_LINUXAIO 0 |
445 | # define EV_USE_LINUXAIO 0 |
450 | # endif |
446 | # endif |
451 | #endif |
447 | #endif |
452 | |
448 | |
… | |
… | |
1607 | # include "ev_win32.c" |
1603 | # include "ev_win32.c" |
1608 | #endif |
1604 | #endif |
1609 | |
1605 | |
1610 | /*****************************************************************************/ |
1606 | /*****************************************************************************/ |
1611 | |
1607 | |
|
|
1608 | #if EV_USE_LINUXAIO |
|
|
1609 | # include <linux/aio_abi.h> /* probably only needed for aio_context_t */ |
|
|
1610 | #endif |
|
|
1611 | |
1612 | /* define a suitable floor function (only used by periodics atm) */ |
1612 | /* define a suitable floor function (only used by periodics atm) */ |
1613 | |
1613 | |
1614 | #if EV_USE_FLOOR |
1614 | #if EV_USE_FLOOR |
1615 | # include <math.h> |
1615 | # include <math.h> |
1616 | # define ev_floor(v) floor (v) |
1616 | # define ev_floor(v) floor (v) |
… | |
… | |
1989 | { |
1989 | { |
1990 | *cur = array_nextsize (elem, *cur, cnt); |
1990 | *cur = array_nextsize (elem, *cur, cnt); |
1991 | return ev_realloc (base, elem * *cur); |
1991 | return ev_realloc (base, elem * *cur); |
1992 | } |
1992 | } |
1993 | |
1993 | |
1994 | #define array_needsize_noinit(base,count) |
1994 | #define array_needsize_noinit(base,offset,count) |
1995 | |
1995 | |
1996 | #define array_needsize_zerofill(base,count) \ |
1996 | #define array_needsize_zerofill(base,offset,count) \ |
1997 | memset ((void *)(base), 0, sizeof (*(base)) * (count)) |
1997 | memset ((void *)(base + offset), 0, sizeof (*(base)) * (count)) |
1998 | |
1998 | |
1999 | #define array_needsize(type,base,cur,cnt,init) \ |
1999 | #define array_needsize(type,base,cur,cnt,init) \ |
2000 | if (expect_false ((cnt) > (cur))) \ |
2000 | if (expect_false ((cnt) > (cur))) \ |
2001 | { \ |
2001 | { \ |
2002 | ecb_unused int ocur_ = (cur); \ |
2002 | ecb_unused int ocur_ = (cur); \ |
2003 | (base) = (type *)array_realloc \ |
2003 | (base) = (type *)array_realloc \ |
2004 | (sizeof (type), (base), &(cur), (cnt)); \ |
2004 | (sizeof (type), (base), &(cur), (cnt)); \ |
2005 | init ((base) + (ocur_), (cur) - ocur_); \ |
2005 | init ((base), ocur_, ((cur) - ocur_)); \ |
2006 | } |
2006 | } |
2007 | |
2007 | |
2008 | #if 0 |
2008 | #if 0 |
2009 | #define array_slim(type,stem) \ |
2009 | #define array_slim(type,stem) \ |
2010 | if (stem ## max < array_roundsize (stem ## cnt >> 2)) \ |
2010 | if (stem ## max < array_roundsize (stem ## cnt >> 2)) \ |
… | |
… | |
2733 | # include "ev_port.c" |
2733 | # include "ev_port.c" |
2734 | #endif |
2734 | #endif |
2735 | #if EV_USE_KQUEUE |
2735 | #if EV_USE_KQUEUE |
2736 | # include "ev_kqueue.c" |
2736 | # include "ev_kqueue.c" |
2737 | #endif |
2737 | #endif |
|
|
2738 | #if EV_USE_EPOLL |
|
|
2739 | # include "ev_epoll.c" |
|
|
2740 | #endif |
2738 | #if EV_USE_LINUXAIO |
2741 | #if EV_USE_LINUXAIO |
2739 | # include "ev_linuxaio.c" |
2742 | # include "ev_linuxaio.c" |
2740 | #endif |
|
|
2741 | #if EV_USE_EPOLL |
|
|
2742 | # include "ev_epoll.c" |
|
|
2743 | #endif |
2743 | #endif |
2744 | #if EV_USE_POLL |
2744 | #if EV_USE_POLL |
2745 | # include "ev_poll.c" |
2745 | # include "ev_poll.c" |
2746 | #endif |
2746 | #endif |
2747 | #if EV_USE_SELECT |
2747 | #if EV_USE_SELECT |
… | |
… | |
2807 | #ifdef __FreeBSD__ |
2807 | #ifdef __FreeBSD__ |
2808 | flags &= ~EVBACKEND_POLL; /* poll return value is unusable (http://forums.freebsd.org/archive/index.php/t-10270.html) */ |
2808 | flags &= ~EVBACKEND_POLL; /* poll return value is unusable (http://forums.freebsd.org/archive/index.php/t-10270.html) */ |
2809 | #endif |
2809 | #endif |
2810 | |
2810 | |
2811 | /* TODO: linuxaio is very experimental */ |
2811 | /* TODO: linuxaio is very experimental */ |
|
|
2812 | #if !EV_RECOMMEND_LINUXAIO |
2812 | flags &= ~EVBACKEND_LINUXAIO; |
2813 | flags &= ~EVBACKEND_LINUXAIO; |
|
|
2814 | #endif |
2813 | |
2815 | |
2814 | return flags; |
2816 | return flags; |
2815 | } |
2817 | } |
2816 | |
2818 | |
2817 | ecb_cold |
2819 | ecb_cold |