Commit c12409fc authored by Andrey Vagin's avatar Andrey Vagin Committed by Andrei Vagin

zdtm: calling futex via syscall saves error codes in errno

man 2 futex:
  In  the  event  of  an error (and assuming that futex() was invoked via
  syscall(2)), all operations return -1 and set  errno  to  indicate  the
  cause of the error.
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 348b1695
...@@ -144,7 +144,9 @@ static void inline mutex_lock(mutex_t *m) ...@@ -144,7 +144,9 @@ static void inline mutex_lock(mutex_t *m)
while ((c = atomic_inc(&m->raw))) { while ((c = atomic_inc(&m->raw))) {
ret = sys_futex(&m->raw, FUTEX_WAIT, c + 1, NULL, NULL, 0); ret = sys_futex(&m->raw, FUTEX_WAIT, c + 1, NULL, NULL, 0);
BUG_ON(ret < 0 && ret != -EWOULDBLOCK); if (ret < 0)
pr_perror("futex");
BUG_ON(ret < 0 && errno != -EWOULDBLOCK);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment