linux: Use compile_c_snippet to check linux/pidfd.h availability
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 10 Aug 2022 17:24:44 +0000 (14:24 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 12 Aug 2022 12:15:11 +0000 (09:15 -0300)
Instead of tying to a specific kernel version.

Checked on x86_64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
sysdeps/unix/sysv/linux/tst-pidfd-consts.py

index e207b55..d732173 100644 (file)
@@ -33,10 +33,12 @@ def main():
                         help='C compiler (including options) to use')
     args = parser.parse_args()
 
-    linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
-    # Linux started to provide pidfd.h with 5.10.
-    if linux_version_headers < (5, 10):
+    if glibcextract.compile_c_snippet(
+            '#include <linux/pidfd.h>',
+            args.cc).returncode != 0:
         sys.exit (77)
+
+    linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
     linux_version_glibc = (5, 19)
     sys.exit(glibcextract.compare_macro_consts(
                 '#include <sys/pidfd.h>\n',