summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/ltp/ltp/0001-lapi-pidfd-adding-pidfd-header-file.patch
blob: 184c42640ae4ad9b591f1620476a631c68ab6a01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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