ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.c
(Generate patch)

Comparing libev/ev.c (file contents):
Revision 1.500 by root, Mon Jul 1 20:47:37 2019 UTC vs.
Revision 1.506 by root, Thu Jul 11 05:41:39 2019 UTC

332# else 332# else
333# define EV_USE_LINUXAIO 0 333# define EV_USE_LINUXAIO 0
334# endif 334# endif
335#endif 335#endif
336 336
337#ifndef EV_USE_IOURING
338# if __linux
339# define EV_USE_IOURING 0
340# else
341# define EV_USE_IOURING 0
342# endif
343#endif
344
337#ifndef EV_USE_INOTIFY 345#ifndef EV_USE_INOTIFY
338# if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 4)) 346# if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 4))
339# define EV_USE_INOTIFY EV_FEATURE_OS 347# define EV_USE_INOTIFY EV_FEATURE_OS
340# else 348# else
341# define EV_USE_INOTIFY 0 349# define EV_USE_INOTIFY 0
406# include <sys/syscall.h> 414# include <sys/syscall.h>
407# ifdef SYS_clock_gettime 415# ifdef SYS_clock_gettime
408# define clock_gettime(id, ts) syscall (SYS_clock_gettime, (id), (ts)) 416# define clock_gettime(id, ts) syscall (SYS_clock_gettime, (id), (ts))
409# undef EV_USE_MONOTONIC 417# undef EV_USE_MONOTONIC
410# define EV_USE_MONOTONIC 1 418# define EV_USE_MONOTONIC 1
419# define EV_NEED_SYSCALL 1
411# else 420# else
412# undef EV_USE_CLOCK_SYSCALL 421# undef EV_USE_CLOCK_SYSCALL
413# define EV_USE_CLOCK_SYSCALL 0 422# define EV_USE_CLOCK_SYSCALL 0
414# endif 423# endif
415#endif 424#endif
438# endif 447# endif
439#endif 448#endif
440 449
441#if EV_USE_LINUXAIO 450#if EV_USE_LINUXAIO
442# include <sys/syscall.h> 451# include <sys/syscall.h>
443# if !SYS_io_getevents || !EV_USE_EPOLL /* ev_linxaio uses ev_poll.c:ev_epoll_create */ 452# if SYS_io_getevents && EV_USE_EPOLL /* linuxaio backend requires epoll backend */
453# define EV_NEED_SYSCALL 1
454# else
444# undef EV_USE_LINUXAIO 455# undef EV_USE_LINUXAIO
445# define EV_USE_LINUXAIO 0 456# define EV_USE_LINUXAIO 0
457# endif
458#endif
459
460#if EV_USE_IOURING
461# include <sys/syscall.h>
462# if !SYS_io_uring_setup && __linux && !__alpha
463# define SYS_io_uring_setup 425
464# define SYS_io_uring_enter 426
465# define SYS_io_uring_wregister 427
466# endif
467# if SYS_io_uring_setup && EV_USE_EPOLL /* iouring backend requires epoll backend */
468# define EV_NEED_SYSCALL 1
469# else
470# undef EV_USE_IOURING
471# define EV_USE_IOURING 0
446# endif 472# endif
447#endif 473#endif
448 474
449#if EV_USE_INOTIFY 475#if EV_USE_INOTIFY
450# include <sys/statfs.h> 476# include <sys/statfs.h>
492 uint32_t ssi_signo; 518 uint32_t ssi_signo;
493 char pad[128 - sizeof (uint32_t)]; 519 char pad[128 - sizeof (uint32_t)];
494}; 520};
495#endif 521#endif
496 522
497/**/ 523/*****************************************************************************/
498 524
499#if EV_VERIFY >= 3 525#if EV_VERIFY >= 3
500# define EV_FREQUENT_CHECK ev_verify (EV_A) 526# define EV_FREQUENT_CHECK ev_verify (EV_A)
501#else 527#else
502# define EV_FREQUENT_CHECK do { } while (0) 528# define EV_FREQUENT_CHECK do { } while (0)
507 * This value is good at least till the year 4000. 533 * This value is good at least till the year 4000.
508 */ 534 */
509#define MIN_INTERVAL 0.0001220703125 /* 1/2**13, good till 4000 */ 535#define MIN_INTERVAL 0.0001220703125 /* 1/2**13, good till 4000 */
510/*#define MIN_INTERVAL 0.00000095367431640625 /* 1/2**20, good till 2200 */ 536/*#define MIN_INTERVAL 0.00000095367431640625 /* 1/2**20, good till 2200 */
511 537
512#define MIN_TIMEJUMP 1. /* minimum timejump that gets detected (if monotonic clock available) */ 538#define MIN_TIMEJUMP 1. /* minimum timejump that gets detected (if monotonic clock available) */
513#define MAX_BLOCKTIME 59.743 /* never wait longer than this time (to detect time jumps) */ 539#define MAX_BLOCKTIME 59.743 /* never wait longer than this time (to detect time jumps) */
514 540
541/* find a portable timestamp that is "always" in the future but fits into time_t.
542 * this is quite hard, and we are mostly guessing - we handle 32 bit signed/unsigned time_t,
543 * and sizes larger than 32 bit, and maybe the unlikely floating point time_t */
544#define EV_TSTAMP_HUGE \
545 (sizeof (time_t) >= 8 ? 10000000000000. \
546 : 0 < (time_t)4294967295 ? 4294967295. \
547 : 2147483647.) \
548
549#define EV_TS_TO_MS(a) a * 1e3 + 0.9999
550#define EV_TS_FROM_US(us) us * 1e-6
515#define EV_TV_SET(tv,t) do { tv.tv_sec = (long)t; tv.tv_usec = (long)((t - tv.tv_sec) * 1e6); } while (0) 551#define EV_TV_SET(tv,t) do { tv.tv_sec = (long)t; tv.tv_usec = (long)((t - tv.tv_sec) * 1e6); } while (0)
516#define EV_TS_SET(ts,t) do { ts.tv_sec = (long)t; ts.tv_nsec = (long)((t - ts.tv_sec) * 1e9); } while (0) 552#define EV_TS_SET(ts,t) do { ts.tv_sec = (long)t; ts.tv_nsec = (long)((t - ts.tv_sec) * 1e9); } while (0)
553#define EV_TV_GET(tv) ((tv).tv_sec + (tv).tv_usec * 1e-6)
554#define EV_TS_GET(ts) ((ts).tv_sec + (ts).tv_nsec * 1e-9)
517 555
518/* the following is ecb.h embedded into libev - use update_ev_c to update from an external copy */ 556/* the following is ecb.h embedded into libev - use update_ev_c to update from an external copy */
519/* ECB.H BEGIN */ 557/* ECB.H BEGIN */
520/* 558/*
521 * libecb - http://software.schmorp.de/pkg/libecb 559 * libecb - http://software.schmorp.de/pkg/libecb
1558# define inline_speed ecb_inline 1596# define inline_speed ecb_inline
1559#else 1597#else
1560# define inline_speed ecb_noinline static 1598# define inline_speed ecb_noinline static
1561#endif 1599#endif
1562 1600
1601/*****************************************************************************/
1602/* raw syscall wrappers */
1603
1604#if EV_NEED_SYSCALL
1605
1606#include <sys/syscall.h>
1607
1608/*
1609 * define some syscall wrappers for common architectures
1610 * this is mostly for nice looks during debugging, not performance.
1611 * our syscalls return < 0, not == -1, on error. which is good
1612 * enough for linux aio.
1613 * TODO: arm is also common nowadays, maybe even mips and x86
1614 * TODO: after implementing this, it suddenly looks like overkill, but its hard to remove...
1615 */
1616#if __GNUC__ && __linux && ECB_AMD64 && !defined __OPTIMIZE_SIZE__
1617 /* the costly errno access probably kills this for size optimisation */
1618
1619 #define ev_syscall(nr,narg,arg1,arg2,arg3,arg4,arg5,arg6) \
1620 ({ \
1621 long res; \
1622 register unsigned long r6 __asm__ ("r9" ); \
1623 register unsigned long r5 __asm__ ("r8" ); \
1624 register unsigned long r4 __asm__ ("r10"); \
1625 register unsigned long r3 __asm__ ("rdx"); \
1626 register unsigned long r2 __asm__ ("rsi"); \
1627 register unsigned long r1 __asm__ ("rdi"); \
1628 if (narg >= 6) r6 = (unsigned long)(arg6); \
1629 if (narg >= 5) r5 = (unsigned long)(arg5); \
1630 if (narg >= 4) r4 = (unsigned long)(arg4); \
1631 if (narg >= 3) r3 = (unsigned long)(arg3); \
1632 if (narg >= 2) r2 = (unsigned long)(arg2); \
1633 if (narg >= 1) r1 = (unsigned long)(arg1); \
1634 __asm__ __volatile__ ( \
1635 "syscall\n\t" \
1636 : "=a" (res) \
1637 : "0" (nr), "r" (r1), "r" (r2), "r" (r3), "r" (r4), "r" (r5) \
1638 : "cc", "r11", "cx", "memory"); \
1639 errno = -res; \
1640 res; \
1641 })
1642
1643#endif
1644
1645#ifdef ev_syscall
1646 #define ev_syscall0(nr) ev_syscall (nr, 0, 0, 0, 0, 0, 0, 0)
1647 #define ev_syscall1(nr,arg1) ev_syscall (nr, 1, arg1, 0, 0, 0, 0, 0)
1648 #define ev_syscall2(nr,arg1,arg2) ev_syscall (nr, 2, arg1, arg2, 0, 0, 0, 0)
1649 #define ev_syscall3(nr,arg1,arg2,arg3) ev_syscall (nr, 3, arg1, arg2, arg3, 0, 0, 0)
1650 #define ev_syscall4(nr,arg1,arg2,arg3,arg4) ev_syscall (nr, 3, arg1, arg2, arg3, arg4, 0, 0)
1651 #define ev_syscall5(nr,arg1,arg2,arg3,arg4,arg5) ev_syscall (nr, 5, arg1, arg2, arg3, arg4, arg5, 0)
1652 #define ev_syscall6(nr,arg1,arg2,arg3,arg4,arg5,arg6) ev_syscall (nr, 6, arg1, arg2, arg3, arg4, arg5,arg6)
1653#else
1654 #define ev_syscall0(nr) syscall (nr)
1655 #define ev_syscall1(nr,arg1) syscall (nr, arg1)
1656 #define ev_syscall2(nr,arg1,arg2) syscall (nr, arg1, arg2)
1657 #define ev_syscall3(nr,arg1,arg2,arg3) syscall (nr, arg1, arg2, arg3)
1658 #define ev_syscall4(nr,arg1,arg2,arg3,arg4) syscall (nr, arg1, arg2, arg3, arg4)
1659 #define ev_syscall5(nr,arg1,arg2,arg3,arg4,arg5) syscall (nr, arg1, arg2, arg3, arg4, arg5)
1660 #define ev_syscall6(nr,arg1,arg2,arg3,arg4,arg5,arg6) syscall (nr, arg1, arg2, arg3, arg4, arg5,arg6)
1661#endif
1662
1663#endif
1664
1665/*****************************************************************************/
1666
1563#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1) 1667#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1)
1564 1668
1565#if EV_MINPRI == EV_MAXPRI 1669#if EV_MINPRI == EV_MAXPRI
1566# define ABSPRI(w) (((W)w), 0) 1670# define ABSPRI(w) (((W)w), 0)
1567#else 1671#else
1626 const ev_tstamp shift = sizeof (unsigned long) >= 8 ? 10000000000000000000. : 1000000000.; 1730 const ev_tstamp shift = sizeof (unsigned long) >= 8 ? 10000000000000000000. : 1000000000.;
1627#else 1731#else
1628 const ev_tstamp shift = sizeof (unsigned long) >= 8 ? 18446744073709551616. : 4294967296.; 1732 const ev_tstamp shift = sizeof (unsigned long) >= 8 ? 18446744073709551616. : 4294967296.;
1629#endif 1733#endif
1630 1734
1735 /* special treatment for negative arguments */
1736 if (ecb_expect_false (v < 0.))
1737 {
1738 ev_tstamp f = -ev_floor (-v);
1739
1740 return f - (f == v ? 0 : 1);
1741 }
1742
1631 /* argument too large for an unsigned long? */ 1743 /* argument too large for an unsigned long? then reduce it */
1632 if (ecb_expect_false (v >= shift)) 1744 if (ecb_expect_false (v >= shift))
1633 { 1745 {
1634 ev_tstamp f; 1746 ev_tstamp f;
1635 1747
1636 if (v == v - 1.) 1748 if (v == v - 1.)
1637 return v; /* very large number */ 1749 return v; /* very large numbers are assumed to be integer */
1638 1750
1639 f = shift * ev_floor (v * (1. / shift)); 1751 f = shift * ev_floor (v * (1. / shift));
1640 return f + ev_floor (v - f); 1752 return f + ev_floor (v - f);
1641 }
1642
1643 /* special treatment for negative args? */
1644 if (ecb_expect_false (v < 0.))
1645 {
1646 ev_tstamp f = -ev_floor (-v);
1647
1648 return f - (f == v ? 0 : 1);
1649 } 1753 }
1650 1754
1651 /* fits into an unsigned long */ 1755 /* fits into an unsigned long */
1652 return (unsigned long)v; 1756 return (unsigned long)v;
1653} 1757}
1797{ 1901{
1798 WL head; 1902 WL head;
1799 unsigned char events; /* the events watched for */ 1903 unsigned char events; /* the events watched for */
1800 unsigned char reify; /* flag set when this ANFD needs reification (EV_ANFD_REIFY, EV__IOFDSET) */ 1904 unsigned char reify; /* flag set when this ANFD needs reification (EV_ANFD_REIFY, EV__IOFDSET) */
1801 unsigned char emask; /* some backends store the actual kernel mask in here */ 1905 unsigned char emask; /* some backends store the actual kernel mask in here */
1802 unsigned char unused; 1906 unsigned char eflags; /* flags field for use by backends */
1803#if EV_USE_EPOLL 1907#if EV_USE_EPOLL
1804 unsigned int egen; /* generation counter to counter epoll bugs */ 1908 unsigned int egen; /* generation counter to counter epoll bugs */
1805#endif 1909#endif
1806#if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP 1910#if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP
1807 SOCKET handle; 1911 SOCKET handle;
1893#if EV_USE_REALTIME 1997#if EV_USE_REALTIME
1894 if (ecb_expect_true (have_realtime)) 1998 if (ecb_expect_true (have_realtime))
1895 { 1999 {
1896 struct timespec ts; 2000 struct timespec ts;
1897 clock_gettime (CLOCK_REALTIME, &ts); 2001 clock_gettime (CLOCK_REALTIME, &ts);
1898 return ts.tv_sec + ts.tv_nsec * 1e-9; 2002 return EV_TS_GET (ts);
1899 } 2003 }
1900#endif 2004#endif
1901 2005
1902 struct timeval tv; 2006 struct timeval tv;
1903 gettimeofday (&tv, 0); 2007 gettimeofday (&tv, 0);
1904 return tv.tv_sec + tv.tv_usec * 1e-6; 2008 return EV_TV_GET (tv);
1905} 2009}
1906#endif 2010#endif
1907 2011
1908inline_size ev_tstamp 2012inline_size ev_tstamp
1909get_clock (void) 2013get_clock (void)
1911#if EV_USE_MONOTONIC 2015#if EV_USE_MONOTONIC
1912 if (ecb_expect_true (have_monotonic)) 2016 if (ecb_expect_true (have_monotonic))
1913 { 2017 {
1914 struct timespec ts; 2018 struct timespec ts;
1915 clock_gettime (CLOCK_MONOTONIC, &ts); 2019 clock_gettime (CLOCK_MONOTONIC, &ts);
1916 return ts.tv_sec + ts.tv_nsec * 1e-9; 2020 return EV_TS_GET (ts);
1917 } 2021 }
1918#endif 2022#endif
1919 2023
1920 return ev_time (); 2024 return ev_time ();
1921} 2025}
1939 EV_TS_SET (ts, delay); 2043 EV_TS_SET (ts, delay);
1940 nanosleep (&ts, 0); 2044 nanosleep (&ts, 0);
1941#elif defined _WIN32 2045#elif defined _WIN32
1942 /* maybe this should round up, as ms is very low resolution */ 2046 /* maybe this should round up, as ms is very low resolution */
1943 /* compared to select (µs) or nanosleep (ns) */ 2047 /* compared to select (µs) or nanosleep (ns) */
1944 Sleep ((unsigned long)(delay * 1e3)); 2048 Sleep ((unsigned long)(EV_TS_TO_MS (delay)));
1945#else 2049#else
1946 struct timeval tv; 2050 struct timeval tv;
1947 2051
1948 /* here we rely on sys/time.h + sys/types.h + unistd.h providing select */ 2052 /* here we rely on sys/time.h + sys/types.h + unistd.h providing select */
1949 /* something not guaranteed by newer posix versions, but guaranteed */ 2053 /* something not guaranteed by newer posix versions, but guaranteed */
2299 2403
2300 /* find minimum child */ 2404 /* find minimum child */
2301 if (ecb_expect_true (pos + DHEAP - 1 < E)) 2405 if (ecb_expect_true (pos + DHEAP - 1 < E))
2302 { 2406 {
2303 /* fast path */ (minpos = pos + 0), (minat = ANHE_at (*minpos)); 2407 /* fast path */ (minpos = pos + 0), (minat = ANHE_at (*minpos));
2304 if ( ANHE_at (pos [1]) < minat) (minpos = pos + 1), (minat = ANHE_at (*minpos)); 2408 if ( minat > ANHE_at (pos [1])) (minpos = pos + 1), (minat = ANHE_at (*minpos));
2305 if ( ANHE_at (pos [2]) < minat) (minpos = pos + 2), (minat = ANHE_at (*minpos)); 2409 if ( minat > ANHE_at (pos [2])) (minpos = pos + 2), (minat = ANHE_at (*minpos));
2306 if ( ANHE_at (pos [3]) < minat) (minpos = pos + 3), (minat = ANHE_at (*minpos)); 2410 if ( minat > ANHE_at (pos [3])) (minpos = pos + 3), (minat = ANHE_at (*minpos));
2307 } 2411 }
2308 else if (pos < E) 2412 else if (pos < E)
2309 { 2413 {
2310 /* slow path */ (minpos = pos + 0), (minat = ANHE_at (*minpos)); 2414 /* slow path */ (minpos = pos + 0), (minat = ANHE_at (*minpos));
2311 if (pos + 1 < E && ANHE_at (pos [1]) < minat) (minpos = pos + 1), (minat = ANHE_at (*minpos)); 2415 if (pos + 1 < E && minat > ANHE_at (pos [1])) (minpos = pos + 1), (minat = ANHE_at (*minpos));
2312 if (pos + 2 < E && ANHE_at (pos [2]) < minat) (minpos = pos + 2), (minat = ANHE_at (*minpos)); 2416 if (pos + 2 < E && minat > ANHE_at (pos [2])) (minpos = pos + 2), (minat = ANHE_at (*minpos));
2313 if (pos + 3 < E && ANHE_at (pos [3]) < minat) (minpos = pos + 3), (minat = ANHE_at (*minpos)); 2417 if (pos + 3 < E && minat > ANHE_at (pos [3])) (minpos = pos + 3), (minat = ANHE_at (*minpos));
2314 } 2418 }
2315 else 2419 else
2316 break; 2420 break;
2317 2421
2318 if (ANHE_at (he) <= minat) 2422 if (ANHE_at (he) <= minat)
2326 2430
2327 heap [k] = he; 2431 heap [k] = he;
2328 ev_active (ANHE_w (he)) = k; 2432 ev_active (ANHE_w (he)) = k;
2329} 2433}
2330 2434
2331#else /* 4HEAP */ 2435#else /* not 4HEAP */
2332 2436
2333#define HEAP0 1 2437#define HEAP0 1
2334#define HPARENT(k) ((k) >> 1) 2438#define HPARENT(k) ((k) >> 1)
2335#define UPHEAP_DONE(p,k) (!(p)) 2439#define UPHEAP_DONE(p,k) (!(p))
2336 2440
2737# include "ev_epoll.c" 2841# include "ev_epoll.c"
2738#endif 2842#endif
2739#if EV_USE_LINUXAIO 2843#if EV_USE_LINUXAIO
2740# include "ev_linuxaio.c" 2844# include "ev_linuxaio.c"
2741#endif 2845#endif
2846#if EV_USE_IOURING
2847# include "ev_iouring.c"
2848#endif
2742#if EV_USE_POLL 2849#if EV_USE_POLL
2743# include "ev_poll.c" 2850# include "ev_poll.c"
2744#endif 2851#endif
2745#if EV_USE_SELECT 2852#if EV_USE_SELECT
2746# include "ev_select.c" 2853# include "ev_select.c"
2778 2885
2779 if (EV_USE_PORT ) flags |= EVBACKEND_PORT; 2886 if (EV_USE_PORT ) flags |= EVBACKEND_PORT;
2780 if (EV_USE_KQUEUE ) flags |= EVBACKEND_KQUEUE; 2887 if (EV_USE_KQUEUE ) flags |= EVBACKEND_KQUEUE;
2781 if (EV_USE_EPOLL ) flags |= EVBACKEND_EPOLL; 2888 if (EV_USE_EPOLL ) flags |= EVBACKEND_EPOLL;
2782 if (EV_USE_LINUXAIO) flags |= EVBACKEND_LINUXAIO; 2889 if (EV_USE_LINUXAIO) flags |= EVBACKEND_LINUXAIO;
2890 if (EV_USE_IOURING ) flags |= EVBACKEND_IOURING;
2783 if (EV_USE_POLL ) flags |= EVBACKEND_POLL; 2891 if (EV_USE_POLL ) flags |= EVBACKEND_POLL;
2784 if (EV_USE_SELECT ) flags |= EVBACKEND_SELECT; 2892 if (EV_USE_SELECT ) flags |= EVBACKEND_SELECT;
2785 2893
2786 return flags; 2894 return flags;
2787} 2895}
2808 2916
2809 /* TODO: linuxaio is very experimental */ 2917 /* TODO: linuxaio is very experimental */
2810#if !EV_RECOMMEND_LINUXAIO 2918#if !EV_RECOMMEND_LINUXAIO
2811 flags &= ~EVBACKEND_LINUXAIO; 2919 flags &= ~EVBACKEND_LINUXAIO;
2812#endif 2920#endif
2921 /* TODO: linuxaio is super experimental */
2922#if !EV_RECOMMEND_IOURING
2923 flags &= ~EVBACKEND_IOURING;
2924#endif
2813 2925
2814 return flags; 2926 return flags;
2815} 2927}
2816 2928
2817ecb_cold 2929ecb_cold
2821 int flags = EVBACKEND_EPOLL | EVBACKEND_KQUEUE | EVBACKEND_PORT; 2933 int flags = EVBACKEND_EPOLL | EVBACKEND_KQUEUE | EVBACKEND_PORT;
2822 2934
2823 /* epoll embeddability broken on all linux versions up to at least 2.6.23 */ 2935 /* epoll embeddability broken on all linux versions up to at least 2.6.23 */
2824 if (ev_linux_version () < 0x020620) /* disable it on linux < 2.6.32 */ 2936 if (ev_linux_version () < 0x020620) /* disable it on linux < 2.6.32 */
2825 flags &= ~EVBACKEND_EPOLL; 2937 flags &= ~EVBACKEND_EPOLL;
2938
2939 /* EVBACKEND_LINUXAIO is theoretically embeddable, but suffers from a performance overhead */
2940
2941 /* EVBACKEND_IOURING is practically embeddable, but the current implementation is not
2942 * because our backend_fd is the epoll fd we need as fallback.
2943 * if the kernel ever is fixed, this might change...
2944 */
2826 2945
2827 return flags; 2946 return flags;
2828} 2947}
2829 2948
2830unsigned int 2949unsigned int
2961 if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags); 3080 if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags);
2962#endif 3081#endif
2963#if EV_USE_KQUEUE 3082#if EV_USE_KQUEUE
2964 if (!backend && (flags & EVBACKEND_KQUEUE )) backend = kqueue_init (EV_A_ flags); 3083 if (!backend && (flags & EVBACKEND_KQUEUE )) backend = kqueue_init (EV_A_ flags);
2965#endif 3084#endif
3085#if EV_USE_IOURING
3086 if (!backend && (flags & EVBACKEND_IOURING )) backend = iouring_init (EV_A_ flags);
3087#endif
2966#if EV_USE_LINUXAIO 3088#if EV_USE_LINUXAIO
2967 if (!backend && (flags & EVBACKEND_LINUXAIO)) backend = linuxaio_init (EV_A_ flags); 3089 if (!backend && (flags & EVBACKEND_LINUXAIO)) backend = linuxaio_init (EV_A_ flags);
2968#endif 3090#endif
2969#if EV_USE_EPOLL 3091#if EV_USE_EPOLL
2970 if (!backend && (flags & EVBACKEND_EPOLL )) backend = epoll_init (EV_A_ flags); 3092 if (!backend && (flags & EVBACKEND_EPOLL )) backend = epoll_init (EV_A_ flags);
3043#if EV_USE_PORT 3165#if EV_USE_PORT
3044 if (backend == EVBACKEND_PORT ) port_destroy (EV_A); 3166 if (backend == EVBACKEND_PORT ) port_destroy (EV_A);
3045#endif 3167#endif
3046#if EV_USE_KQUEUE 3168#if EV_USE_KQUEUE
3047 if (backend == EVBACKEND_KQUEUE ) kqueue_destroy (EV_A); 3169 if (backend == EVBACKEND_KQUEUE ) kqueue_destroy (EV_A);
3170#endif
3171#if EV_USE_IOURING
3172 if (backend == EVBACKEND_IOURING ) iouring_destroy (EV_A);
3048#endif 3173#endif
3049#if EV_USE_LINUXAIO 3174#if EV_USE_LINUXAIO
3050 if (backend == EVBACKEND_LINUXAIO) linuxaio_destroy (EV_A); 3175 if (backend == EVBACKEND_LINUXAIO) linuxaio_destroy (EV_A);
3051#endif 3176#endif
3052#if EV_USE_EPOLL 3177#if EV_USE_EPOLL
3110#if EV_USE_PORT 3235#if EV_USE_PORT
3111 if (backend == EVBACKEND_PORT ) port_fork (EV_A); 3236 if (backend == EVBACKEND_PORT ) port_fork (EV_A);
3112#endif 3237#endif
3113#if EV_USE_KQUEUE 3238#if EV_USE_KQUEUE
3114 if (backend == EVBACKEND_KQUEUE ) kqueue_fork (EV_A); 3239 if (backend == EVBACKEND_KQUEUE ) kqueue_fork (EV_A);
3240#endif
3241#if EV_USE_IOURING
3242 if (backend == EVBACKEND_IOURING ) iouring_fork (EV_A);
3115#endif 3243#endif
3116#if EV_USE_LINUXAIO 3244#if EV_USE_LINUXAIO
3117 if (backend == EVBACKEND_LINUXAIO) linuxaio_fork (EV_A); 3245 if (backend == EVBACKEND_LINUXAIO) linuxaio_fork (EV_A);
3118#endif 3246#endif
3119#if EV_USE_EPOLL 3247#if EV_USE_EPOLL

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines