selftests/bpf: Fix selftest build with old libc

pidfd_open was added in 2019. Some versions of libc library don't define it.
Define it manually if it's not available.

Reported-by: Sergei Iudin <siudin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
Alexei Starovoitov 2020-11-06 12:33:46 -08:00
parent 4170bc6baa
commit f055f355fa
1 changed files with 4 additions and 0 deletions

View File

@ -12,6 +12,10 @@
#include "local_storage.skel.h"
#include "network_helpers.h"
#ifndef __NR_pidfd_open
#define __NR_pidfd_open 434
#endif
static inline int sys_pidfd_open(pid_t pid, unsigned int flags)
{
return syscall(__NR_pidfd_open, pid, flags);