summaryrefslogtreecommitdiffstats
path: root/include/pidfd-utils.h
blob: 4a6c3a604436ce0d77138f21536c7dbc2b698d46 (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
#ifndef UTIL_LINUX_PIDFD_UTILS
#define UTIL_LINUX_PIDFD_UTILS

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

#  ifndef HAVE_PIDFD_SEND_SIGNAL
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

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

#  define UL_HAVE_PIDFD 1

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