Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/procps-ng: fix build without __NR_pidfd_open
@ 2022-11-03 17:48 Fabrice Fontaine
  2022-11-03 21:38 ` Thomas Petazzoni via buildroot
  2022-11-14  7:10 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Fabrice Fontaine @ 2022-11-03 17:48 UTC (permalink / raw)
  To: buildroot; +Cc: Fabrice Fontaine

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
+-- 
+2.35.1
+
-- 
2.35.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/procps-ng: fix build without __NR_pidfd_open
  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
  2022-11-14  7:10 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-11-03 21:38 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: buildroot

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/procps-ng: fix build without __NR_pidfd_open
  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
@ 2022-11-14  7:10 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2022-11-14  7:10 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: buildroot

>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:

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

Committed to 2022.08.x and 2022.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-14  7:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2022-11-14  7:10 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox