diff options
-rw-r--r-- | tools/testing/selftests/bpf/test_progs.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index 2b0bc1171c9c..b6201dd82edf 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -35,7 +35,16 @@ struct prog_test_def { */ int usleep(useconds_t usec) { - return syscall(__NR_nanosleep, usec * 1000UL); + struct timespec ts; + + if (usec > 999999) { + ts.tv_sec = usec / 1000000; + ts.tv_nsec = usec % 1000000; + } else { + ts.tv_sec = 0; + ts.tv_nsec = usec; + } + return nanosleep(&ts, NULL); } static bool should_run(struct test_selector *sel, int num, const char *name) |