提交 2b5cf9fb 编写于 作者: A Andrii Nakryiko 提交者: Alexei Starovoitov

selftests/bpf: Guarantee that useep() calls nanosleep() syscall

Some implementations of C runtime library won't call nanosleep() syscall from
usleep(). But a bunch of kprobe/tracepoint selftests rely on nanosleep being
called to trigger them. To make this more reliable, "override" usleep
implementation and call nanosleep explicitly.
Signed-off-by: NAndrii Nakryiko <andriin@fb.com>
Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
Cc: Julia Kartseva <hex@fb.com>
Link: https://lore.kernel.org/bpf/20200311185345.3874602-1-andriin@fb.comSigned-off-by: NAlexei Starovoitov <ast@kernel.org>
上级 6ae32b29
......@@ -29,6 +29,15 @@ struct prog_test_def {
int old_error_cnt;
};
/* Override C runtime library's usleep() implementation to ensure nanosleep()
* is always called. Usleep is frequently used in selftests as a way to
* trigger kprobe and tracepoints.
*/
int usleep(useconds_t usec)
{
return syscall(__NR_nanosleep, usec * 1000UL);
}
static bool should_run(struct test_selector *sel, int num, const char *name)
{
int i;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册