fix pifd_open check

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
c8384e682c

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

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
This commit is contained in:
Fabrice Fontaine 2022-11-03 18:24:53 +01:00 committed by Craig Small
parent d99c213af9
commit 17f94796a9
2 changed files with 4 additions and 2 deletions

View 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>

View File

@ -38,9 +38,11 @@
#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 */