From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 1/1] package/procps-ng: fix build without __NR_pidfd_open
Date: Thu, 3 Nov 2022 22:38:34 +0100 [thread overview]
Message-ID: <20221103223834.1e9564a5@windsurf> (raw)
In-Reply-To: <20221103174818.1469409-1-fontaine.fabrice@gmail.com>
On Thu, 3 Nov 2022 18:48:18 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> Fix the following build failure without __NR_pidfd_open raised since
> bump to version 3.3.17 in commit
> cc28c7aa6df7798ce5ca79d6d1c7c2eb115ba220 and
> https://gitlab.com/procps-ng/procps/-/commit/c8384e682c1cfb3b2dc797e0f8a3cbaaccf7a3da:
>
> 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
>
> Fixes:
> - http://autobuild.buildroot.org/results/f23a5156e641b2ebdd673973dec0f9c87760c688
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> .../procps-ng/0003-fix-pifd_open-check.patch | 59 +++++++++++++++++++
> 1 file changed, 59 insertions(+)
> create mode 100644 package/procps-ng/0003-fix-pifd_open-check.patch
>
> diff --git a/package/procps-ng/0003-fix-pifd_open-check.patch b/package/procps-ng/0003-fix-pifd_open-check.patch
> new file mode 100644
> index 0000000000..7152901e70
> --- /dev/null
> +++ b/package/procps-ng/0003-fix-pifd_open-check.patch
> @@ -0,0 +1,59 @@
> +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
I think here the change should have been:
#if defined(ENABLE_PWAIT)
#include <sys/epoll.h>
#if !defined(HAVE_PIDFD_OPEN)
#include <sys/syscall.h>
#endif /* !HAVE_PIDFD_OPEN */
#endif
Indeed, the <sys/epoll.h> is needed for the pwait functionality.
However, the <sys/syscall.h> is only needed when the replacement
pidfd_open() function is provided, i.e when !HAVE_PIDFD_OPEN.
Anyway, I've applied as-is to Buildroot, but maybe for upstream this
change would be more correct.
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2022-11-03 21:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 17:48 [Buildroot] [PATCH 1/1] package/procps-ng: fix build without __NR_pidfd_open Fabrice Fontaine
2022-11-03 21:38 ` Thomas Petazzoni via buildroot [this message]
2022-11-14 7:10 ` Peter Korsgaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221103223834.1e9564a5@windsurf \
--to=buildroot@buildroot.org \
--cc=fontaine.fabrice@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.