From 7d8185ccbb8051a72ccdb18480fdb4af8fa9feae Mon Sep 17 00:00:00 2001 From: Marc Alexander Lehmann Date: Fri, 22 Nov 2019 14:32:13 +0000 Subject: [PATCH] *** empty log message *** --- Changes | 5 +++++ ev.c | 23 ++++++++++++++++++++--- libev.m4 | 8 ++++++-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index 962d561..0ab34fd 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,11 @@ TODO: revisit 59.x timer in the light of modern powersaving TODO: maybe use timerfd to detect time jumps on linux TODO: document EV_TSTAMP_T +4.29 + - (libev) add io uring autoconf and non-autoconf detection, + the latter of which should disable io_uring compilation + on old systems. + 4.28 (EV only) - linuxaio backend resulted in random memory corruption when loop is forked. diff --git a/ev.c b/ev.c index 162b659..3b80a2d 100644 --- a/ev.c +++ b/ev.c @@ -126,6 +126,15 @@ # define EV_USE_LINUXAIO 0 # endif +# if HAVE_LINUX_FS_H && HAVE_SYS_TIMERFD_H && HAVE_KERNEL_RWF_T +# ifndef EV_USE_IOURING +# define EV_USE_IOURING EV_FEATURE_BACKENDS +# endif +# else +# undef EV_USE_IOURING +# define EV_USE_IOURING 0 +# endif + # if HAVE_KQUEUE && HAVE_SYS_EVENT_H # ifndef EV_USE_KQUEUE # define EV_USE_KQUEUE EV_FEATURE_BACKENDS @@ -170,7 +179,7 @@ # undef EV_USE_EVENTFD # define EV_USE_EVENTFD 0 # endif - + #endif /* OS X, in its infinite idiocy, actually HARDCODES @@ -335,8 +344,8 @@ #endif #ifndef EV_USE_IOURING -# if __linux -# define EV_USE_IOURING 0 +# if __linux /* later checks might disable again */ +# define EV_USE_IOURING 1 # else # define EV_USE_IOURING 0 # endif @@ -440,6 +449,14 @@ # define EV_USE_INOTIFY 0 #endif +#if __linux && EV_USE_IOURING +# include +# ifndef RWF_SYNC +# undef EV_USE_IOURING +# define EV_USE_IOURING 0 +# endif +#endif + #if !EV_USE_NANOSLEEP /* hp-ux has it in sys/time.h, which we unconditionally include above */ # if !defined _WIN32 && !defined __hpux diff --git a/libev.m4 b/libev.m4 index 642e7b1..f859eff 100644 --- a/libev.m4 +++ b/libev.m4 @@ -2,8 +2,8 @@ dnl this file is part of libev, do not make local modifications dnl http://software.schmorp.de/pkg/libev dnl libev support -AC_CHECK_HEADERS(sys/inotify.h sys/epoll.h sys/event.h port.h poll.h) -AC_CHECK_HEADERS(sys/select.h sys/eventfd.h sys/signalfd.h linux/aio_abi.h) +AC_CHECK_HEADERS(sys/inotify.h sys/epoll.h sys/event.h port.h poll.h sys/timerfd.h) +AC_CHECK_HEADERS(sys/select.h sys/eventfd.h sys/signalfd.h linux/aio_abi.h linux/fs.h) AC_CHECK_FUNCS(inotify_init epoll_ctl kqueue port_create poll select eventfd signalfd) @@ -36,6 +36,10 @@ AC_CHECK_FUNCS(nanosleep, [], [ fi ]) +AC_CHECK_TYPE(__kernel_rwf_t, [ + AC_DEFINE(HAVE_KERNEL_RWF_T, 1, Define to 1 if linux/fs.h defined kernel_rwf_t) +], [], [#include ]) + if test -z "$LIBEV_M4_AVOID_LIBM"; then LIBM=m fi