Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | From dbc9c14c92a5acf450d07868a735ac8cd6ec5b90 Mon Sep 17 00:00:00 2001 |
| 2 | From: Li Wang <liwang@redhat.com> |
| 3 | Date: Fri, 5 Aug 2022 14:34:00 +0800 |
| 4 | Subject: [PATCH] lapi/pidfd: adding pidfd header file |
| 5 | MIME-Version: 1.0 |
| 6 | Content-Type: text/plain; charset=UTF-8 |
| 7 | Content-Transfer-Encoding: 8bit |
| 8 | |
| 9 | The newer Glibc already provided wrapper for the series pidfd syscall, |
| 10 | so 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 | |
| 17 | To 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 | |
| 24 | Upstream-Status: Backport [https://github.com/linux-test-project/ltp/commit/dbc9c14c92a5acf450d07868a735ac8cd6ec5b90] |
| 25 | Signed-off-by: Li Wang <liwang@redhat.com> |
| 26 | Reviewed-by: Petr Vorel <pvorel@suse.cz> |
| 27 | --- |
| 28 | configure.ac | 1 + |
| 29 | include/lapi/pidfd.h | 3 +++ |
| 30 | 2 files changed, 4 insertions(+) |
| 31 | |
| 32 | diff --git a/configure.ac b/configure.ac |
| 33 | index 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 \ |
| 44 | diff --git a/include/lapi/pidfd.h b/include/lapi/pidfd.h |
| 45 | index 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 | -- |
| 59 | 2.37.2 |
| 60 | |