blob: 184c42640ae4ad9b591f1620476a631c68ab6a01 [file] [log] [blame]
From dbc9c14c92a5acf450d07868a735ac8cd6ec5b90 Mon Sep 17 00:00:00 2001
From: Li Wang <liwang@redhat.com>
Date: Fri, 5 Aug 2022 14:34:00 +0800
Subject: [PATCH] lapi/pidfd: adding pidfd header file
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The newer Glibc already provided wrapper for the series pidfd syscall,
so let's include the header file conditionally.
# rpm -q glibc-devel
glibc-devel-2.35.9000-31.fc37.ppc64le
# rpm -ql glibc-devel | grep pidfd
/usr/include/sys/pidfd.h
To get rid of compiling error from fedora-rawhide:
tst_safe_macros.c: In function ‘safe_pidfd_open’:
tst_safe_macros.c:135:16: error: implicit declaration of function ‘pidfd_open’ [-Werror=implicit-function-declaration]
135 | rval = pidfd_open(pid, flags);
| ^~~~~~~~~~
Upstream-Status: Backport [https://github.com/linux-test-project/ltp/commit/dbc9c14c92a5acf450d07868a735ac8cd6ec5b90]
Signed-off-by: Li Wang <liwang@redhat.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
---
configure.ac | 1 +
include/lapi/pidfd.h | 3 +++
2 files changed, 4 insertions(+)
diff --git a/configure.ac b/configure.ac
index 69b145b5f..d50ec1ea7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,6 +71,7 @@ AC_CHECK_HEADERS_ONCE([ \
sys/epoll.h \
sys/fanotify.h \
sys/inotify.h \
+ sys/pidfd.h
sys/prctl.h \
sys/shm.h \
sys/timerfd.h \
diff --git a/include/lapi/pidfd.h b/include/lapi/pidfd.h
index 244d3acaf..9ca8e5aa2 100644
--- a/include/lapi/pidfd.h
+++ b/include/lapi/pidfd.h
@@ -8,6 +8,9 @@
#define LAPI_PIDFD_H__
#include <fcntl.h>
+#ifdef HAVE_SYS_PIDFD_H
+# include <sys/pidfd.h>
+#endif
#include "config.h"
#include "lapi/syscalls.h"
--
2.37.2