Skip to contentSkip to conversation

Revert "m4: Remove check for io_set_eventfd"

PATCH Superseded Edward Liaw via ltp 2 participants 2 messages Sep 2, 2022 – Sep 5, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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                             | 11 ++++++++++-
 testcases/kernel/syscalls/eventfd/eventfd01.c | 18 +++++++++++++++++-
 2 files changed, 27 insertions(+), 2 deletions(-)
m4/ltp-eventfd.m4 +10 -1
index ecd7e951d..5d729a33d 100644
@@ -1,6 +1,6 @@
 dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Red Hat Inc., 2008
-dnl Copyright (c) 2017-2022 Petr Vorel <[email protected]>
+dnl Copyright (c) 2017 Petr Vorel <[email protected]>
 dnl Author: Masatake YAMATO <[email protected]>
 
 AC_DEFUN([LTP_CHECK_SYSCALL_EVENTFD], [
@@ -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_TRY_LINK([#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 -1
index 3180ea159..242e170e2 100644
@@ -1,6 +1,5 @@
 /*
  *   Copyright (c) 2008 Vijay Kumar B. <[email protected]>
- *   Copyright (c) Linux Test Project, 2008-2022
  *
  *   Based on testcases/kernel/syscalls/waitpid/waitpid01.c
  *   Original copyright message:
@@ -473,6 +472,7 @@ static void child_inherit_test(int fd)
 	}
 }
 
+#ifdef HAVE_IO_SET_EVENTFD
 /*
  * Test whether counter overflow is detected and handled correctly.
  *
@@ -648,6 +648,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,

Quoted 4 lines

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.

Ack to revert as I guess we cannot avoid this. But we should fix newly introduced warnings on 2.71:

configure.ac:391: warning: The macro `AC_TRY_LINK' is obsolete. configure.ac:391: You should run autoupdate. ./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from... m4/ltp-eventfd.m4:6: LTP_CHECK_SYSCALL_EVENTFD is expanded from... configure.ac:391: the top level

-AC_TRY_LINK([
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[

...

-],
+]],

NOTE: if you don't have 2.71 available I can fix this myself.

...

testcases/kernel/syscalls/eventfd/eventfd01.c line 3

Quoted 5 lines

+++ b/testcases/kernel/syscalls/eventfd/eventfd01.c

testcases/kernel/syscalls/eventfd/eventfd01.c +0 -1
@@ -1,6 +1,5 @@
 /*
  *   Copyright (c) 2008 Vijay Kumar B. <[email protected]>
- *   Copyright (c) Linux Test Project, 2008-2022

NOTE for person who merges this: this copyright should be kept (amend the commit before merge).

Kind regards,
Petr

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