Skip to content

Commit

Permalink
kill: include sys/types.h before checking SYS_pidfd_send_signal
Browse files Browse the repository at this point in the history
Including sys/types.h must happen before SYS_pidfd_send_signal is checked,
because that header defines variable in normal conditions.  When sys/types.h
does not have SYS_pidfd_send_signal then fallback is defined in config.h
that is included by default, and has therefore worked fine before and after
this change.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
  • Loading branch information
kerolasa committed Feb 15, 2020
1 parent d8ed9e0 commit 3cfde03
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions include/pidfd-utils.h
@@ -1,26 +1,28 @@
#ifndef UTIL_LINUX_PIDFD_UTILS
#define UTIL_LINUX_PIDFD_UTILS

#if defined(__linux__) && defined(SYS_pidfd_send_signal)
# include <sys/types.h>
#if defined(__linux__)
# include <sys/syscall.h>
# if defined(SYS_pidfd_send_signal)
# include <sys/types.h>

# ifndef HAVE_PIDFD_OPEN
# ifndef HAVE_PIDFD_OPEN
static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
unsigned int flags)
{
return syscall(SYS_pidfd_send_signal, pidfd, sig, info, flags);
}
# endif
# endif

# ifndef HAVE_PIDFD_SEND_SIGNAL
# ifndef HAVE_PIDFD_SEND_SIGNAL
static inline int pidfd_open(pid_t pid, unsigned int flags)
{
return syscall(SYS_pidfd_open, pid, flags);
}
# endif
# endif

# define UL_HAVE_PIDFD 1
# define UL_HAVE_PIDFD 1

#endif /* __linux__ && SYS_pidfd_send_signal */
# endif /* SYS_pidfd_send_signal */
#endif /* __linux__ */
#endif /* UTIL_LINUX_PIDFD_UTILS */

0 comments on commit 3cfde03

Please sign in to comment.