[LTP] [PATCH v2 3/3] m4: fcntl31: Remove check for struct f_owner_ex

Petr Vorel pvorel@suse.cz
Fri Aug 8 13:01:02 CEST 2025


struct f_owner_ex support was added to glibc 2.11 released in 2009.
Other libc of course contain it as well (musl, uclibc-ng, bionic) and we
can safely assume it's widely supported.

The check m4/ltp-fcntl.m4 was unnecessarily complicated. Adding struct
into AC_CHECK_TYPES in configure.ac would be much faster than compile
with AC_COMPILE_IFELSE.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 configure.ac                              |  1 -
 m4/ltp-fcntl.m4                           | 21 ---------------------
 testcases/kernel/syscalls/fcntl/fcntl31.c |  8 --------
 3 files changed, 30 deletions(-)
 delete mode 100644 m4/ltp-fcntl.m4

diff --git a/configure.ac b/configure.ac
index 5362aaf1bc..62ae27d494 100644
--- a/configure.ac
+++ b/configure.ac
@@ -397,7 +397,6 @@ LTP_CHECK_LIBMNL
 LTP_CHECK_SELINUX
 LTP_CHECK_SYNC_ADD_AND_FETCH
 LTP_CHECK_SYSCALL_EVENTFD
-LTP_CHECK_SYSCALL_FCNTL
 LTP_CHECK_FSVERITY
 
 AX_CHECK_COMPILE_FLAG([-no-pie], [LTP_CFLAGS_NOPIE=1])
diff --git a/m4/ltp-fcntl.m4 b/m4/ltp-fcntl.m4
deleted file mode 100644
index 90ab5fd0fc..0000000000
--- a/m4/ltp-fcntl.m4
+++ /dev/null
@@ -1,21 +0,0 @@
-dnl SPDX-License-Identifier: GPL-2.0-or-later
-dnl Copyright (c) 2014 Fujitsu Ltd.
-dnl Author: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
-
-AC_DEFUN([LTP_CHECK_SYSCALL_FCNTL],[
-	AC_MSG_CHECKING([for fcntl f_owner_ex])
-	AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#define _GNU_SOURCE
-#include <fcntl.h>
-int main(void) {
-	struct f_owner_ex tst_own_ex;
-	return 0;
-}])],[has_f_owner_ex="yes"])
-
-if test "x$has_f_owner_ex" = xyes; then
-	AC_DEFINE(HAVE_STRUCT_F_OWNER_EX,1,[Define to 1 if you have struct f_owner_ex])
-	AC_MSG_RESULT(yes)
-else
-	AC_MSG_RESULT(no)
-fi
-])
diff --git a/testcases/kernel/syscalls/fcntl/fcntl31.c b/testcases/kernel/syscalls/fcntl/fcntl31.c
index f6f625e855..f5c4f83983 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl31.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl31.c
@@ -44,13 +44,11 @@ static void cleanup(void);
 static void setown_pid_test(void);
 static void setown_pgrp_test(void);
 
-#if defined(HAVE_STRUCT_F_OWNER_EX)
 static void setownex_tid_test(void);
 static void setownex_pid_test(void);
 static void setownex_pgrp_test(void);
 
 static struct f_owner_ex orig_own_ex;
-#endif
 
 static void signal_parent(void);
 static void check_io_signal(char *des);
@@ -68,9 +66,7 @@ static int pipe_fds[2];
 
 static void (*testfunc[])(void) = {
 	setown_pid_test, setown_pgrp_test,
-#if defined(HAVE_STRUCT_F_OWNER_EX)
 	setownex_tid_test, setownex_pid_test, setownex_pgrp_test
-#endif
 };
 
 char *TCID = "fcntl31";
@@ -122,14 +118,12 @@ static void setup(void)
 	if (pgrp_pid < 0)
 		tst_brkm(TBROK | TERRNO, cleanup, "getpgid() failed");
 
-#if defined(HAVE_STRUCT_F_OWNER_EX)
 	/* get original f_owner_ex info */
 	TEST(fcntl(test_fd, F_GETOWN_EX, &orig_own_ex));
 	if (TEST_RETURN < 0) {
 		tst_brkm(TFAIL | TTERRNO, cleanup,
 			 "fcntl get original f_owner_ex info failed");
 	}
-#endif
 
 	/* get original pid info */
 	TEST(fcntl(test_fd, F_GETOWN));
@@ -183,7 +177,6 @@ static void setown_pgrp_test(void)
 	}
 }
 
-#if defined(HAVE_STRUCT_F_OWNER_EX)
 static void setownex_cleanup(void)
 {
 	TEST(fcntl(test_fd, F_SETOWN_EX, &orig_own_ex));
@@ -245,7 +238,6 @@ static void setownex_pgrp_test(void)
 
 	setownex_cleanup();
 }
-#endif
 
 static void test_set_and_get_sig(int sig, char *des)
 {
-- 
2.50.1



More information about the ltp mailing list