X-Git-Url: https://git.llucax.com/software/libev.git/blobdiff_plain/46b65b3837b54f481a93dc0be132210bd2e00f1f..54a57c74105dc818388cec05e6fc874cdbfebf7f:/ev.c diff --git a/ev.c b/ev.c index 5dbd724..88e3474 100644 --- a/ev.c +++ b/ev.c @@ -43,26 +43,53 @@ extern "C" { # ifndef EV_USE_REALTIME # define EV_USE_REALTIME 1 # endif +# else +# ifndef EV_USE_MONOTONIC +# define EV_USE_MONOTONIC 0 +# endif +# ifndef EV_USE_REALTIME +# define EV_USE_REALTIME 0 +# endif # endif -# if HAVE_SELECT && HAVE_SYS_SELECT_H && !defined (EV_USE_SELECT) -# define EV_USE_SELECT 1 +# ifndef EV_USE_SELECT +# if HAVE_SELECT && HAVE_SYS_SELECT_H +# define EV_USE_SELECT 1 +# else +# define EV_USE_SELECT 0 +# endif # endif -# if HAVE_POLL && HAVE_POLL_H && !defined (EV_USE_POLL) -# define EV_USE_POLL 1 +# ifndef EV_USE_POLL +# if HAVE_POLL && HAVE_POLL_H +# define EV_USE_POLL 1 +# else +# define EV_USE_POLL 0 +# endif # endif - -# if HAVE_EPOLL_CTL && HAVE_SYS_EPOLL_H && !defined (EV_USE_EPOLL) -# define EV_USE_EPOLL 1 + +# ifndef EV_USE_EPOLL +# if HAVE_EPOLL_CTL && HAVE_SYS_EPOLL_H +# define EV_USE_EPOLL 1 +# else +# define EV_USE_EPOLL 0 +# endif # endif - -# if HAVE_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H && !defined (EV_USE_KQUEUE) -# define EV_USE_KQUEUE 1 + +# ifndef EV_USE_KQUEUE +# if HAVE_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H +# define EV_USE_KQUEUE 1 +# else +# define EV_USE_KQUEUE 0 +# endif # endif - -# if HAVE_PORT_H && HAVE_PORT_CREATE && !defined (EV_USE_PORT) -# define EV_USE_PORT 1 + +# ifndef EV_USE_PORT +# if HAVE_PORT_H && HAVE_PORT_CREATE +# define EV_USE_PORT 1 +# else +# define EV_USE_PORT 0 +# endif # endif #endif @@ -783,11 +810,20 @@ loop_init (EV_P_ unsigned int flags) now_floor = mn_now; rtmn_diff = ev_rt_now - mn_now; - if (!(flags & EVFLAG_NOENV) && !enable_secure () && getenv ("LIBEV_FLAGS")) + if (!(flags & EVFLAG_NOENV) + && !enable_secure () + && getenv ("LIBEV_FLAGS")) flags = atoi (getenv ("LIBEV_FLAGS")); - if (!(flags & 0x0000ffff)) - flags |= 0x0000ffff; + if (!(flags & EVMETHOD_ALL)) + { + flags |= EVMETHOD_ALL; +#if EV_USE_KQUEUE && !defined (__NetBSD__) + /* kqueue is borked on everything but netbsd apparently */ + /* it usually doesn't work correctly on anything but sockets and pipes */ + flags &= ~EVMETHOD_KQUEUE; +#endif + } method = 0; #if EV_USE_PORT @@ -811,7 +847,7 @@ loop_init (EV_P_ unsigned int flags) } } -void +static void loop_destroy (EV_P) { int i; @@ -912,7 +948,7 @@ ev_loop_fork (EV_P) #if EV_MULTIPLICITY struct ev_loop * -ev_default_loop_ (unsigned int flags) +ev_default_loop_init (unsigned int flags) #else int ev_default_loop (unsigned int flags)