summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/task_local_storage_helpers.h
diff options
context:
space:
mode:
authorHou Tao <houtao1@huawei.com>2022-10-11 10:12:49 +0300
committerAndrii Nakryiko <andrii@kernel.org>2022-10-13 22:09:19 +0300
commit62c69e89e81bfbdb9a87ae3e0599dcc6aacf786b (patch)
treef3fd7ad771f817ed752b19f95481a4b903d9d694 /tools/testing/selftests/bpf/task_local_storage_helpers.h
parente94e0a2d3730cd718a3a67682b038b05fa40d2a7 (diff)
downloadlinux-62c69e89e81bfbdb9a87ae3e0599dcc6aacf786b.tar.xz
selftests/bpf: Use sys_pidfd_open() helper when possible
SYS_pidfd_open may be undefined for old glibc, so using sys_pidfd_open() helper defined in task_local_storage_helpers.h instead to fix potential build failure. And according to commit 7615d9e1780e ("arch: wire-up pidfd_open()"), the syscall number of pidfd_open is always 434 except for alpha architure, so update the definition of __NR_pidfd_open accordingly. Signed-off-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20221011071249.3471760-1-houtao@huaweicloud.com
Diffstat (limited to 'tools/testing/selftests/bpf/task_local_storage_helpers.h')
-rw-r--r--tools/testing/selftests/bpf/task_local_storage_helpers.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/task_local_storage_helpers.h b/tools/testing/selftests/bpf/task_local_storage_helpers.h
index 711d5abb7d51..281f86132766 100644
--- a/tools/testing/selftests/bpf/task_local_storage_helpers.h
+++ b/tools/testing/selftests/bpf/task_local_storage_helpers.h
@@ -7,8 +7,12 @@
#include <sys/types.h>
#ifndef __NR_pidfd_open
+#ifdef __alpha__
+#define __NR_pidfd_open 544
+#else
#define __NR_pidfd_open 434
#endif
+#endif
static inline int sys_pidfd_open(pid_t pid, unsigned int flags)
{