]> granicus.if.org Git - procps-ng/commitdiff
fix pifd_open check
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Thu, 3 Nov 2022 17:24:53 +0000 (18:24 +0100)
committerCraig Small <csmall@dropbear.xyz>
Wed, 9 Nov 2022 10:15:05 +0000 (10:15 +0000)
Replace AC_CHECK_FUNC by AC_CHECK_FUNCS otherwise HAVE_PIDFD_OPEN will
never be defined resulting in the following build failure if pidfd_open
is available but __NR_pidfd_open is not available:

pgrep.c: In function 'pidfd_open':
pgrep.c:748:17: error: '__NR_pidfd_open' undeclared (first use in this function); did you mean 'pidfd_open'?
  748 |  return syscall(__NR_pidfd_open, pid, flags);
      |                 ^~~~~~~~~~~~~~~
      |                 pidfd_open

This build failure is raised since the addition of pwait in version
3.3.17 and
https://gitlab.com/procps-ng/procps/-/commit/c8384e682c1cfb3b2dc797e0f8a3cbaaccf7a3da

Fixes:
 - http://autobuild.buildroot.org/results/f23a5156e641b2ebdd673973dec0f9c87760c688

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
configure.ac
src/pgrep.c

index 629881a6cbf93a88bd51226d7e7f6d7e6985eac5..1a3ccdb8f3f5bfdf8cc63a2f133f9a02ade59cf5 100644 (file)
@@ -160,7 +160,7 @@ AC_TRY_COMPILE([#include <errno.h>],
                AC_MSG_RESULT(yes),
                AC_MSG_RESULT(no))
 
-AC_CHECK_FUNC([pidfd_open], [enable_pidwait=yes], [
+AC_CHECK_FUNCS([pidfd_open], [enable_pidwait=yes], [
   AC_MSG_CHECKING([for __NR_pidfd_open])
   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
 #include <sys/syscall.h>
index c4ad5da381808eae31cc6d3e6f1232887b7839a3..1c15981c2a674536495cf92f5967064676464e5f 100644 (file)
 #include <stdbool.h>
 #include <time.h>
 
-#if defined(ENABLE_PIDWAIT) && !defined(HAVE_PIDFD_OPEN)
+#ifdef ENABLE_PIDWAIT
 #include <sys/epoll.h>
+#ifndef HAVE_PIDFD_OPEN
 #include <sys/syscall.h>
+#endif /* !HAVE_PIDFD_OPEN */
 #endif
 
 /* EXIT_SUCCESS is 0 */