summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJason Xing <kernelxing@tencent.com>2024-10-29 15:46:27 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-21 14:01:46 +0100
commit449dd20852d8563d5e9c32a9228a106d8399570a (patch)
tree00737f5978e0496ac43387067e19dc7ff018c8c9 /tools
parent728dd20c8df74e09a9f34872b26d962a0f31d529 (diff)
downloadlinux-449dd20852d8563d5e9c32a9228a106d8399570a.tar.gz
linux-449dd20852d8563d5e9c32a9228a106d8399570a.tar.bz2
linux-449dd20852d8563d5e9c32a9228a106d8399570a.zip
bpf: handle implicit declaration of function gettid in bpf_iter.c
commit 42602e3a06f8e5b9a059344e305c9bee2dcc87c8 upstream. As we can see from the title, when I compiled the selftests/bpf, I saw the error: implicit declaration of function ‘gettid’ ; did you mean ‘getgid’? [-Werror=implicit-function-declaration] skel->bss->tid = gettid(); ^~~~~~ getgid Directly call the syscall solves this issue. Signed-off-by: Jason Xing <kernelxing@tencent.com> Reviewed-by: Alan Maguire <alan.maguire@oracle.com> Tested-by: Alan Maguire <alan.maguire@oracle.com> Link: https://lore.kernel.org/r/20241029074627.80289-1-kerneljasonxing@gmail.com Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Cc: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/bpf_iter.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
index f0a3a9c18e9e..9006549a1294 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
@@ -226,7 +226,7 @@ static void test_task_common_nocheck(struct bpf_iter_attach_opts *opts,
ASSERT_OK(pthread_create(&thread_id, NULL, &do_nothing_wait, NULL),
"pthread_create");
- skel->bss->tid = gettid();
+ skel->bss->tid = syscall(SYS_gettid);
do_dummy_read_opts(skel->progs.dump_task, opts);
@@ -255,10 +255,10 @@ static void *run_test_task_tid(void *arg)
union bpf_iter_link_info linfo;
int num_unknown_tid, num_known_tid;
- ASSERT_NEQ(getpid(), gettid(), "check_new_thread_id");
+ ASSERT_NEQ(getpid(), syscall(SYS_gettid), "check_new_thread_id");
memset(&linfo, 0, sizeof(linfo));
- linfo.task.tid = gettid();
+ linfo.task.tid = syscall(SYS_gettid);
opts.link_info = &linfo;
opts.link_info_len = sizeof(linfo);
test_task_common(&opts, 0, 1);