1 From 3cfde0370d3a8949df0c5bcf447cec6692910ed2 Mon Sep 17 00:00:00 2001
2 From: Sami Kerola <kerolasa@iki.fi>
3 Date: Sat, 15 Feb 2020 21:12:50 +0000
4 Subject: [PATCH] kill: include sys/types.h before checking
7 Including sys/types.h must happen before SYS_pidfd_send_signal is checked,
8 because that header defines variable in normal conditions. When sys/types.h
9 does not have SYS_pidfd_send_signal then fallback is defined in config.h
10 that is included by default, and has therefore worked fine before and after
13 Upstream-Status: Backport [https://github.com/karelzak/util-linux/commit/3cfde0370d3a8949df0c5bcf447cec6692910ed2]
15 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
16 Signed-off-by: Benjamin Fair <benjaminfair@google.com>
18 include/pidfd-utils.h | 18 ++++++++++--------
19 1 file changed, 10 insertions(+), 8 deletions(-)
21 diff --git a/include/pidfd-utils.h b/include/pidfd-utils.h
22 index 593346576..0baedd2c9 100644
23 --- a/include/pidfd-utils.h
24 +++ b/include/pidfd-utils.h
26 #ifndef UTIL_LINUX_PIDFD_UTILS
27 #define UTIL_LINUX_PIDFD_UTILS
29 -#if defined(__linux__) && defined(SYS_pidfd_send_signal)
30 -# include <sys/types.h>
31 +#if defined(__linux__)
32 # include <sys/syscall.h>
33 +# if defined(SYS_pidfd_send_signal)
34 +# include <sys/types.h>
36 -# ifndef HAVE_PIDFD_OPEN
37 +# ifndef HAVE_PIDFD_OPEN
38 static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
41 return syscall(SYS_pidfd_send_signal, pidfd, sig, info, flags);
46 -# ifndef HAVE_PIDFD_SEND_SIGNAL
47 +# ifndef HAVE_PIDFD_SEND_SIGNAL
48 static inline int pidfd_open(pid_t pid, unsigned int flags)
50 return syscall(SYS_pidfd_open, pid, flags);
55 -# define UL_HAVE_PIDFD 1
56 +# define UL_HAVE_PIDFD 1
58 -#endif /* __linux__ && SYS_pidfd_send_signal */
59 +# endif /* SYS_pidfd_send_signal */
60 +#endif /* __linux__ */
61 #endif /* UTIL_LINUX_PIDFD_UTILS */
63 2.26.1.301.g55bc3eb7cb9-goog