… | |
… | |
325 | #ifndef EV_USE_PORT |
325 | #ifndef EV_USE_PORT |
326 | # define EV_USE_PORT 0 |
326 | # define EV_USE_PORT 0 |
327 | #endif |
327 | #endif |
328 | |
328 | |
329 | #ifndef EV_USE_LINUXAIO |
329 | #ifndef EV_USE_LINUXAIO |
|
|
330 | # if __linux /* libev currently assumes linux/aio_abi.h is always available on linux */ |
|
|
331 | # define EV_USE_LINUXAIO 1 |
|
|
332 | # else |
330 | # define EV_USE_LINUXAIO 0 |
333 | # define EV_USE_LINUXAIO 0 |
|
|
334 | # endif |
331 | #endif |
335 | #endif |
332 | |
336 | |
333 | #ifndef EV_USE_INOTIFY |
337 | #ifndef EV_USE_INOTIFY |
334 | # if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 4)) |
338 | # if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 4)) |
335 | # define EV_USE_INOTIFY EV_FEATURE_OS |
339 | # define EV_USE_INOTIFY EV_FEATURE_OS |
… | |
… | |
392 | /* aix's poll.h seems to cause lots of trouble */ |
396 | /* aix's poll.h seems to cause lots of trouble */ |
393 | #ifdef _AIX |
397 | #ifdef _AIX |
394 | /* AIX has a completely broken poll.h header */ |
398 | /* AIX has a completely broken poll.h header */ |
395 | # undef EV_USE_POLL |
399 | # undef EV_USE_POLL |
396 | # define EV_USE_POLL 0 |
400 | # define EV_USE_POLL 0 |
397 | #endif |
|
|
398 | |
|
|
399 | #if EV_USE_LINUXAIO |
|
|
400 | # include <linux/aio_abi.h> /* probably only needed for aio_context_t */ |
|
|
401 | #endif |
401 | #endif |
402 | |
402 | |
403 | /* 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, */ |
404 | /* which makes programs even slower. might work on other unices, too. */ |
404 | /* which makes programs even slower. might work on other unices, too. */ |
405 | #if EV_USE_CLOCK_SYSCALL |
405 | #if EV_USE_CLOCK_SYSCALL |
… | |
… | |
438 | # endif |
438 | # endif |
439 | #endif |
439 | #endif |
440 | |
440 | |
441 | #if EV_USE_LINUXAIO |
441 | #if EV_USE_LINUXAIO |
442 | # include <sys/syscall.h> |
442 | # include <sys/syscall.h> |
443 | # if !SYS_io_getevents |
443 | # if !SYS_io_getevents || !EV_USE_EPOLL /* ev_linxaio uses ev_poll.c:ev_epoll_create */ |
444 | # undef EV_USE_LINUXAIO |
444 | # undef EV_USE_LINUXAIO |
445 | # define EV_USE_LINUXAIO 0 |
445 | # define EV_USE_LINUXAIO 0 |
446 | # endif |
446 | # endif |
447 | #endif |
447 | #endif |
448 | |
448 | |
… | |
… | |
1603 | # include "ev_win32.c" |
1603 | # include "ev_win32.c" |
1604 | #endif |
1604 | #endif |
1605 | |
1605 | |
1606 | /*****************************************************************************/ |
1606 | /*****************************************************************************/ |
1607 | |
1607 | |
|
|
1608 | #if EV_USE_LINUXAIO |
|
|
1609 | # include <linux/aio_abi.h> /* probably only needed for aio_context_t */ |
|
|
1610 | #endif |
|
|
1611 | |
1608 | /* define a suitable floor function (only used by periodics atm) */ |
1612 | /* define a suitable floor function (only used by periodics atm) */ |
1609 | |
1613 | |
1610 | #if EV_USE_FLOOR |
1614 | #if EV_USE_FLOOR |
1611 | # include <math.h> |
1615 | # include <math.h> |
1612 | # define ev_floor(v) floor (v) |
1616 | # define ev_floor(v) floor (v) |
… | |
… | |
1985 | { |
1989 | { |
1986 | *cur = array_nextsize (elem, *cur, cnt); |
1990 | *cur = array_nextsize (elem, *cur, cnt); |
1987 | return ev_realloc (base, elem * *cur); |
1991 | return ev_realloc (base, elem * *cur); |
1988 | } |
1992 | } |
1989 | |
1993 | |
1990 | #define array_needsize_noinit(base,count) |
1994 | #define array_needsize_noinit(base,offset,count) |
1991 | |
1995 | |
1992 | #define array_needsize_zerofill(base,count) \ |
1996 | #define array_needsize_zerofill(base,offset,count) \ |
1993 | memset ((void *)(base), 0, sizeof (*(base)) * (count)) |
1997 | memset ((void *)(base + offset), 0, sizeof (*(base)) * (count)) |
1994 | |
1998 | |
1995 | #define array_needsize(type,base,cur,cnt,init) \ |
1999 | #define array_needsize(type,base,cur,cnt,init) \ |
1996 | if (expect_false ((cnt) > (cur))) \ |
2000 | if (expect_false ((cnt) > (cur))) \ |
1997 | { \ |
2001 | { \ |
1998 | ecb_unused int ocur_ = (cur); \ |
2002 | ecb_unused int ocur_ = (cur); \ |
1999 | (base) = (type *)array_realloc \ |
2003 | (base) = (type *)array_realloc \ |
2000 | (sizeof (type), (base), &(cur), (cnt)); \ |
2004 | (sizeof (type), (base), &(cur), (cnt)); \ |
2001 | init ((base) + (ocur_), (cur) - ocur_); \ |
2005 | init ((base), ocur_, ((cur) - ocur_)); \ |
2002 | } |
2006 | } |
2003 | |
2007 | |
2004 | #if 0 |
2008 | #if 0 |
2005 | #define array_slim(type,stem) \ |
2009 | #define array_slim(type,stem) \ |
2006 | if (stem ## max < array_roundsize (stem ## cnt >> 2)) \ |
2010 | if (stem ## max < array_roundsize (stem ## cnt >> 2)) \ |
… | |
… | |
2729 | # include "ev_port.c" |
2733 | # include "ev_port.c" |
2730 | #endif |
2734 | #endif |
2731 | #if EV_USE_KQUEUE |
2735 | #if EV_USE_KQUEUE |
2732 | # include "ev_kqueue.c" |
2736 | # include "ev_kqueue.c" |
2733 | #endif |
2737 | #endif |
|
|
2738 | #if EV_USE_EPOLL |
|
|
2739 | # include "ev_epoll.c" |
|
|
2740 | #endif |
2734 | #if EV_USE_LINUXAIO |
2741 | #if EV_USE_LINUXAIO |
2735 | # include "ev_linuxaio.c" |
2742 | # include "ev_linuxaio.c" |
2736 | #endif |
|
|
2737 | #if EV_USE_EPOLL |
|
|
2738 | # include "ev_epoll.c" |
|
|
2739 | #endif |
2743 | #endif |
2740 | #if EV_USE_POLL |
2744 | #if EV_USE_POLL |
2741 | # include "ev_poll.c" |
2745 | # include "ev_poll.c" |
2742 | #endif |
2746 | #endif |
2743 | #if EV_USE_SELECT |
2747 | #if EV_USE_SELECT |
… | |
… | |
2803 | #ifdef __FreeBSD__ |
2807 | #ifdef __FreeBSD__ |
2804 | 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) */ |
2805 | #endif |
2809 | #endif |
2806 | |
2810 | |
2807 | /* TODO: linuxaio is very experimental */ |
2811 | /* TODO: linuxaio is very experimental */ |
|
|
2812 | #if !EV_RECOMMEND_LINUXAIO |
2808 | flags &= ~EVBACKEND_LINUXAIO; |
2813 | flags &= ~EVBACKEND_LINUXAIO; |
|
|
2814 | #endif |
2809 | |
2815 | |
2810 | return flags; |
2816 | return flags; |
2811 | } |
2817 | } |
2812 | |
2818 | |
2813 | ecb_cold |
2819 | ecb_cold |