summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2022-08-07 15:26:12 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-10 08:25:28 +0100
commit6ff9060c7f1138c693dd4afefc8c29562aec300b (patch)
tree6ffadc598b9aebbdc7b48089d1ef890510ed1ac7
parent0bb5f1f99da2a3af2492b221109e696d6ba04385 (diff)
downloadpoky-6ff9060c7f1138c693dd4afefc8c29562aec300b.tar.gz
util-linux: Define pidfd_* function signatures
glibc 2.36 has added sys/pidfd.h and APIs for pidfd_send_signal and pidfd_open, therefore check for this header and include it if it exists (From OE-Core rev: c72d4ad4d3c41e6bc36e7d7542a42db04b5a2e97) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/util-linux/util-linux.inc1
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-check-for-sys-pidfd.h.patch53
2 files changed, 54 insertions, 0 deletions
diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
index c9bddfb7a6..e775712158 100644
--- a/meta/recipes-core/util-linux/util-linux.inc
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -35,6 +35,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
35 file://run-ptest \ 35 file://run-ptest \
36 file://display_testname_for_subtest.patch \ 36 file://display_testname_for_subtest.patch \
37 file://avoid_parallel_tests.patch \ 37 file://avoid_parallel_tests.patch \
38 file://0001-check-for-sys-pidfd.h.patch \
38 " 39 "
39 40
40SRC_URI[sha256sum] = "6d111cbe4d55b336db2f1fbeffbc65b89908704c01136371d32aa9bec373eb64" 41SRC_URI[sha256sum] = "6d111cbe4d55b336db2f1fbeffbc65b89908704c01136371d32aa9bec373eb64"
diff --git a/meta/recipes-core/util-linux/util-linux/0001-check-for-sys-pidfd.h.patch b/meta/recipes-core/util-linux/util-linux/0001-check-for-sys-pidfd.h.patch
new file mode 100644
index 0000000000..19f57f14bc
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/0001-check-for-sys-pidfd.h.patch
@@ -0,0 +1,53 @@
1From 548bc568f3c735e53fb5b0a5ab6473a3f1457b91 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 7 Aug 2022 14:39:19 -0700
4Subject: [PATCH] check for sys/pidfd.h
5
6This header in newer glibc defines the signatures of functions
7pidfd_send_signal() and pidfd_open() and when these functions are
8defined by libc then we need to include the relevant header to get
9the definitions. Clang 15+ has started to error out when function
10signatures are missing.
11
12Fixes errors like
13misc-utils/kill.c:402:6: error: call to undeclared function 'pidfd_send_signal'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
14 if (pidfd_send_signal(pfd, ctl->numsig, &info, 0) < 0)
15
16Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/1769]
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 configure.ac | 1 +
20 include/pidfd-utils.h | 4 +++-
21 2 files changed, 4 insertions(+), 1 deletion(-)
22
23diff --git a/configure.ac b/configure.ac
24index a511e93de..fd7d9245f 100644
25--- a/configure.ac
26+++ b/configure.ac
27@@ -342,6 +342,7 @@ AC_CHECK_HEADERS([ \
28 sys/mkdev.h \
29 sys/mount.h \
30 sys/param.h \
31+ sys/pidfd.h \
32 sys/prctl.h \
33 sys/resource.h \
34 sys/sendfile.h \
35diff --git a/include/pidfd-utils.h b/include/pidfd-utils.h
36index eddede976..d9e33cbc5 100644
37--- a/include/pidfd-utils.h
38+++ b/include/pidfd-utils.h
39@@ -4,8 +4,10 @@
40 #ifdef HAVE_SYS_SYSCALL_H
41 # include <sys/syscall.h>
42 # if defined(SYS_pidfd_send_signal) && defined(SYS_pidfd_open)
43+# ifdef HAVE_SYS_PIDFD_H
44+# include <sys/pidfd.h>
45+# endif
46 # include <sys/types.h>
47-
48 # ifndef HAVE_PIDFD_SEND_SIGNAL
49 static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
50 unsigned int flags)
51--
522.37.1
53