From fb16abd855478abd802586c7c855ebfd8b0d9a41 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Thu, 4 Oct 2018 21:53:36 +0200 Subject: [PATCH] Require new libuEV API: uev_init1() to enforce a small event cache In cases where you have multiple events pending in the cache and some event may cause later ones, already sent by the kernel to userspace, to be deleted the pointer returned to the event loop for this later event may be deleted. There are two ways around this (accessing deleted memory); 1) use this function to initialize your event loop and set maxevents to 1, 2) use a free list in you application that you garbage collect at intervals relevant to your application. Signed-off-by: Joachim Nilsson --- configure.ac | 2 +- src/finit.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c2a1864a..117b8807 100644 --- a/configure.ac +++ b/configure.ac @@ -41,7 +41,7 @@ AC_TYPE_UINT16_T AC_TYPE_UINT32_T # Check for required libraries -PKG_CHECK_MODULES([uev], [libuev >= 2.1.0]) +PKG_CHECK_MODULES([uev], [libuev >= 2.2.0]) PKG_CHECK_MODULES([lite], [libite >= 2.0.1]) # Check for configured Finit features diff --git a/src/finit.c b/src/finit.c index 71272882..fafc3b25 100644 --- a/src/finit.c +++ b/src/finit.c @@ -279,7 +279,7 @@ int main(int argc, char* argv[]) /* * Initalize event context. */ - uev_init(&loop); + uev_init1(&loop, 1); ctx = &loop; /*