blob: 184c42640ae4ad9b591f1620476a631c68ab6a01 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001From dbc9c14c92a5acf450d07868a735ac8cd6ec5b90 Mon Sep 17 00:00:00 2001
2From: Li Wang <liwang@redhat.com>
3Date: Fri, 5 Aug 2022 14:34:00 +0800
4Subject: [PATCH] lapi/pidfd: adding pidfd header file
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9The newer Glibc already provided wrapper for the series pidfd syscall,
10so let's include the header file conditionally.
11
12 # rpm -q glibc-devel
13 glibc-devel-2.35.9000-31.fc37.ppc64le
14 # rpm -ql glibc-devel | grep pidfd
15 /usr/include/sys/pidfd.h
16
17To get rid of compiling error from fedora-rawhide:
18
19 tst_safe_macros.c: In function ‘safe_pidfd_open’:
20 tst_safe_macros.c:135:16: error: implicit declaration of function ‘pidfd_open’ [-Werror=implicit-function-declaration]
21 135 | rval = pidfd_open(pid, flags);
22 | ^~~~~~~~~~
23
24Upstream-Status: Backport [https://github.com/linux-test-project/ltp/commit/dbc9c14c92a5acf450d07868a735ac8cd6ec5b90]
25Signed-off-by: Li Wang <liwang@redhat.com>
26Reviewed-by: Petr Vorel <pvorel@suse.cz>
27---
28 configure.ac | 1 +
29 include/lapi/pidfd.h | 3 +++
30 2 files changed, 4 insertions(+)
31
32diff --git a/configure.ac b/configure.ac
33index 69b145b5f..d50ec1ea7 100644
34--- a/configure.ac
35+++ b/configure.ac
36@@ -71,6 +71,7 @@ AC_CHECK_HEADERS_ONCE([ \
37 sys/epoll.h \
38 sys/fanotify.h \
39 sys/inotify.h \
40+ sys/pidfd.h
41 sys/prctl.h \
42 sys/shm.h \
43 sys/timerfd.h \
44diff --git a/include/lapi/pidfd.h b/include/lapi/pidfd.h
45index 244d3acaf..9ca8e5aa2 100644
46--- a/include/lapi/pidfd.h
47+++ b/include/lapi/pidfd.h
48@@ -8,6 +8,9 @@
49 #define LAPI_PIDFD_H__
50
51 #include <fcntl.h>
52+#ifdef HAVE_SYS_PIDFD_H
53+# include <sys/pidfd.h>
54+#endif
55 #include "config.h"
56 #include "lapi/syscalls.h"
57
58--
592.37.2
60