| From 0cce3e981540c28d2f703b9ab16c04d0df8fa03d Mon Sep 17 00:00:00 2001 |
| From: Fabrice Fontaine <fontaine.fabrice@gmail.com> |
| Date: Thu, 3 Nov 2022 18:24:53 +0100 |
| Subject: [PATCH] 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 |
| https://gitlab.com/procps-ng/procps/-/commit/c8384e682c1cfb3b2dc797e0f8a3cbaaccf7a3da |
| |
| Fixes: |
| - http://autobuild.buildroot.org/results/f23a5156e641b2ebdd673973dec0f9c87760c688 |
| |
| Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> |
| [Upstream status: |
| https://gitlab.com/procps-ng/procps/-/merge_requests/166] |
| --- |
| configure.ac | 2 +- |
| src/pgrep.c | 2 +- |
| 2 files changed, 2 insertions(+), 2 deletions(-) |
| |
| diff --git a/configure.ac b/configure.ac |
| index 629881a6..1a3ccdb8 100644 |
| --- a/configure.ac |
| +++ b/configure.ac |
| @@ -160,7 +160,7 @@ AC_TRY_COMPILE([#include <errno.h>], |
| AC_MSG_RESULT(yes), |
| AC_MSG_RESULT(no)) |
| |
| -AC_CHECK_FUNC([pidfd_open], [enable_pwait=yes], [ |
| +AC_CHECK_FUNCS([pidfd_open], [enable_pwait=yes], [ |
| AC_MSG_CHECKING([for __NR_pidfd_open]) |
| AC_COMPILE_IFELSE([AC_LANG_SOURCE([ |
| #include <sys/syscall.h> |
| diff --git a/pgrep.c b/pgrep.c |
| index c4ad5da3..29cfedf7 100644 |
| --- a/pgrep.c |
| +++ b/pgrep.c |
| @@ -38,7 +38,7 @@ |
| #include <stdbool.h> |
| #include <time.h> |
| |
| -#if defined(ENABLE_PWAIT) && !defined(HAVE_PIDFD_OPEN) |
| +#if defined(ENABLE_PWAIT) |
| #include <sys/epoll.h> |
| #include <sys/syscall.h> |
| #endif |
| -- |
| 2.35.1 |
| |