diff options
author | Alan Maguire <alan.maguire@oracle.com> | 2024-03-22 12:57:28 +0300 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2024-03-22 20:00:17 +0300 |
commit | 1684d6eb99e480ff653af60e20ff5e7e55e69ccd (patch) | |
tree | 9a1d84164c898b093754a35a9740d3fd0fba6bc5 | |
parent | 4c2a26fc80bcb851dc630590f2eec157991eccbf (diff) | |
download | linux-1684d6eb99e480ff653af60e20ff5e7e55e69ccd.tar.xz |
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: 520fad2e3206 ("selftests/bpf: scale benchmark counting by using per-CPU counters")
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240322095728.95671-1-alan.maguire@oracle.com
-rw-r--r-- | tools/testing/selftests/bpf/benchs/bench_trigger.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/benchs/bench_trigger.c b/tools/testing/selftests/bpf/benchs/bench_trigger.c index b7aea79495ba..9c50412f72e9 100644 --- a/tools/testing/selftests/bpf/benchs/bench_trigger.c +++ b/tools/testing/selftests/bpf/benchs/bench_trigger.c @@ -22,7 +22,7 @@ static __always_inline void inc_counter(struct counter *counters) unsigned slot; if (unlikely(tid == 0)) - tid = gettid(); + tid = syscall(SYS_gettid); /* multiplicative hashing, it's fast */ slot = 2654435769U * tid; |