Skip to contentSkip to conversation

Revert "m4: Remove check for io_set_eventfd"

PATCH In review Edward Liaw via ltp 2 participants 2 messages Sep 5, 2022 – Sep 13, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Revert "m4: Remove check for io_set_eventfd"

This reverts commit 5ca0d16d66c42fbfa483c180de4c881de7f182cc.

Android has libaio headers but is missing some functions including io_set_eventfd. Without these checks it will fail to compile.

---
 m4/ltp-eventfd.m4                             |  9 +++++++++
 testcases/kernel/syscalls/eventfd/eventfd01.c | 17 +++++++++++++++++
 2 files changed, 26 insertions(+)
m4/ltp-eventfd.m4 +9 -0
index ecd7e951d..1e0ec688a 100644
@@ -10,5 +10,14 @@ AC_DEFUN([LTP_CHECK_SYSCALL_EVENTFD], [
 	if test "x$have_libaio" = "xyes" -a "x$have_aio" = "xyes"; then
 		AC_DEFINE(HAVE_LIBAIO, 1, [Define to 1 if you have libaio and it's headers installed.])
 		AC_SUBST(AIO_LIBS, "-laio")
+
+		AC_MSG_CHECKING([io_set_eventfd is defined in aio library or aio header])
+		AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
+		                                  #include <libaio.h>
+		                                ]],
+		                                [[io_set_eventfd(NULL, 0); return 0;]])],
+		               [AC_DEFINE(HAVE_IO_SET_EVENTFD, 1, [Define to 1 if you have `io_set_eventfd' function.])
+		                AC_MSG_RESULT(yes)],
+		               [AC_MSG_RESULT(no)])
 	fi
 ])
testcases/kernel/syscalls/eventfd/eventfd01.c +17 -0
index 3180ea159..c24aa3197 100644
@@ -473,6 +473,7 @@ static void child_inherit_test(int fd)
 	}
 }
 
+#ifdef HAVE_IO_SET_EVENTFD
 /*
  * Test whether counter overflow is detected and handled correctly.
  *
@@ -648,6 +649,22 @@ static void overflow_read_test(int evfd)
 	}
 	cleanup_overflow(fd, ctx);
 }
+#else
+static void overflow_select_test(int evfd)
+{
+	tst_resm(TCONF, "eventfd support is not available in AIO subsystem");
+}
+
+static void overflow_poll_test(int evfd)
+{
+	tst_resm(TCONF, "eventfd support is not available in AIO subsystem");
+}
+
+static void overflow_read_test(int evfd)
+{
+	tst_resm(TCONF, "eventfd support is not available in AIO subsystem");
+}
+#endif
 
 int main(int argc, char **argv)
 {
Signature · 5 lines
2.37.2.789.g6183377224-goog


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Edward,

thanks for fixing deprecated macro.
Merged!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp