提交 2430ec65 编写于 作者: J John Stultz 提交者: Shuah Khan

selftests/timers: Quiet warning due to lack of return check on brk

The posix_timers.c test has a loop that tries to keep it in
kernel space, repeatedly calling brk(). However, it doesn't
check the return value, which causes warnings.

This patch adds a err value which captures the return value
and modifies the test so it will quit if a failure occurs.

Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
Tested-by: NPrarit Bhargava <prarit@redhat.com>
Signed-off-by: NShuah Khan <shuahkh@osg.samsung.com>
上级 03438212
...@@ -35,10 +35,11 @@ static void user_loop(void) ...@@ -35,10 +35,11 @@ static void user_loop(void)
static void kernel_loop(void) static void kernel_loop(void)
{ {
void *addr = sbrk(0); void *addr = sbrk(0);
int err = 0;
while (!done) { while (!done && !err) {
brk(addr + 4096); err = brk(addr + 4096);
brk(addr); err |= brk(addr);
} }
} }
...@@ -190,8 +191,6 @@ static int check_timer_create(int which) ...@@ -190,8 +191,6 @@ static int check_timer_create(int which)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int err;
printf("Testing posix timers. False negative may happen on CPU execution \n"); printf("Testing posix timers. False negative may happen on CPU execution \n");
printf("based timers if other threads run on the CPU...\n"); printf("based timers if other threads run on the CPU...\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册