[CRIU] [PATCH] zdtm: calling futex via syscall saves error codes in errno
Andrei Vagin
avagin at virtuozzo.com
Tue Apr 24 21:18:45 MSK 2018
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: Andrei Vagin <avagin at virtuozzo.com>
---
test/zdtm/lib/lock.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/test/zdtm/lib/lock.h b/test/zdtm/lib/lock.h
index db9e96d0e..972ed5769 100644
--- a/test/zdtm/lib/lock.h
+++ b/test/zdtm/lib/lock.h
@@ -144,7 +144,9 @@ static void inline mutex_lock(mutex_t *m)
while ((c = atomic_inc(&m->raw))) {
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);
}
}
--
2.14.3
More information about the CRIU
mailing list