Skip to content

Commit 1684d6e

Browse files
alan-maguireanakryiko
authored andcommitted
selftests/bpf: Use syscall(SYS_gettid) instead of gettid() wrapper in bench
With glibc 2.28, selftests compilation fails for benchs/bench_trigger.c: benchs/bench_trigger.c: In function ‘inc_counter’: benchs/bench_trigger.c:25:23: error: implicit declaration of function ‘gettid’; did you mean ‘getgid’? [-Werror=implicit-function-declaration] 25 | tid = gettid(); | ^~~~~~ | getgid cc1: all warnings being treated as errors It appears support for the gettid() wrapper is variable across glibc versions, so may be safer to use syscall(SYS_gettid) instead. Fixes: 520fad2 ("selftests/bpf: scale benchmark counting by using per-CPU counters") Signed-off-by: Alan Maguire <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 4c2a26f commit 1684d6e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/bpf/benchs/bench_trigger.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static __always_inline void inc_counter(struct counter *counters)
2222
unsigned slot;
2323

2424
if (unlikely(tid == 0))
25-
tid = gettid();
25+
tid = syscall(SYS_gettid);
2626

2727
/* multiplicative hashing, it's fast */
2828
slot = 2654435769U * tid;

0 commit comments

Comments
 (0)