Skip to content

Commit 449dd20

Browse files
JasonXinggregkh
authored andcommitted
bpf: handle implicit declaration of function gettid in bpf_iter.c
commit 42602e3 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 <[email protected]> Reviewed-by: Alan Maguire <[email protected]> Tested-by: Alan Maguire <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin KaFai Lau <[email protected]> Cc: Alan Maguire <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 728dd20 commit 449dd20

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/testing/selftests/bpf/prog_tests/bpf_iter.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static void test_task_common_nocheck(struct bpf_iter_attach_opts *opts,
226226
ASSERT_OK(pthread_create(&thread_id, NULL, &do_nothing_wait, NULL),
227227
"pthread_create");
228228

229-
skel->bss->tid = gettid();
229+
skel->bss->tid = syscall(SYS_gettid);
230230

231231
do_dummy_read_opts(skel->progs.dump_task, opts);
232232

@@ -255,10 +255,10 @@ static void *run_test_task_tid(void *arg)
255255
union bpf_iter_link_info linfo;
256256
int num_unknown_tid, num_known_tid;
257257

258-
ASSERT_NEQ(getpid(), gettid(), "check_new_thread_id");
258+
ASSERT_NEQ(getpid(), syscall(SYS_gettid), "check_new_thread_id");
259259

260260
memset(&linfo, 0, sizeof(linfo));
261-
linfo.task.tid = gettid();
261+
linfo.task.tid = syscall(SYS_gettid);
262262
opts.link_info = &linfo;
263263
opts.link_info_len = sizeof(linfo);
264264
test_task_common(&opts, 0, 1);

0 commit comments

Comments
 (0)