diff options
| author | Andrii Nakryiko <[email protected]> | 2020-03-14 00:27:43 +0000 |
|---|---|---|
| committer | Daniel Borkmann <[email protected]> | 2020-03-17 18:29:12 +0000 |
| commit | 41078907eef0dd508d0999996d10683ae114c21a (patch) | |
| tree | 4e8e634122a0f7092025f2942ff1c27f0118a4a6 /tools/testing/selftests/bpf/prog_tests/vmlinux.c | |
| parent | selftest/bpf: Fix compilation warning in sockmap_parse_prog.c (diff) | |
| download | kernel-41078907eef0dd508d0999996d10683ae114c21a.tar.gz kernel-41078907eef0dd508d0999996d10683ae114c21a.zip | |
selftests/bpf: Fix nanosleep for real this time
Amazingly, some libc implementations don't call __NR_nanosleep syscall from
their nanosleep() APIs. Hammer it down with explicit syscall() call and never
get back to it again. Also simplify code for timespec initialization.
I verified that nanosleep is called w/ printk and in exactly same Linux image
that is used in Travis CI. So it should both sleep and call correct syscall.
v1->v2:
- math is too hard, fix usec -> nsec convertion (Martin);
- test_vmlinux has explicit nanosleep() call, convert that one as well.
Fixes: 4e1fd25d19e8 ("selftests/bpf: Fix usleep() implementation")
Signed-off-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Martin KaFai Lau <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/vmlinux.c')
| -rw-r--r-- | tools/testing/selftests/bpf/prog_tests/vmlinux.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/vmlinux.c b/tools/testing/selftests/bpf/prog_tests/vmlinux.c index 04939eda1325..72310cfc6474 100644 --- a/tools/testing/selftests/bpf/prog_tests/vmlinux.c +++ b/tools/testing/selftests/bpf/prog_tests/vmlinux.c @@ -11,7 +11,7 @@ static void nsleep() { struct timespec ts = { .tv_nsec = MY_TV_NSEC }; - (void)nanosleep(&ts, NULL); + (void)syscall(__NR_nanosleep, &ts, NULL); } void test_vmlinux(void) |
