mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
zdtm: don't trigger BUG if futex returns EINTR
It can hapen in tty tests, where we get SIGHUP. Signed-off-by: Andrei Vagin <avagin@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
18c0fbc27c
commit
ada6312984
@@ -64,7 +64,7 @@ static inline void futex_add_and_wake(futex_t *f, uint32_t v)
|
|||||||
break; \
|
break; \
|
||||||
ret = sys_futex(&(__f)->raw, FUTEX_WAIT,\
|
ret = sys_futex(&(__f)->raw, FUTEX_WAIT,\
|
||||||
tmp, NULL, NULL, 0); \
|
tmp, NULL, NULL, 0); \
|
||||||
if (ret < 0 && errno == EAGAIN) \
|
if (ret < 0 && (errno == EAGAIN || errno == EINTR)) \
|
||||||
continue; \
|
continue; \
|
||||||
BUG_ON(ret < 0 && errno != EWOULDBLOCK); \
|
BUG_ON(ret < 0 && errno != EWOULDBLOCK); \
|
||||||
} \
|
} \
|
||||||
@@ -119,7 +119,7 @@ static inline uint32_t futex_wait_while(futex_t *f, uint32_t v)
|
|||||||
{
|
{
|
||||||
while (f->raw == v) {
|
while (f->raw == v) {
|
||||||
int ret = sys_futex(&f->raw, FUTEX_WAIT, v, NULL, NULL, 0);
|
int ret = sys_futex(&f->raw, FUTEX_WAIT, v, NULL, NULL, 0);
|
||||||
if (ret < 0 && errno == EAGAIN)
|
if (ret < 0 && (errno == EAGAIN || errno == EINTR))
|
||||||
continue;
|
continue;
|
||||||
BUG_ON(ret < 0 && errno != EWOULDBLOCK);
|
BUG_ON(ret < 0 && errno != EWOULDBLOCK);
|
||||||
}
|
}
|
||||||
|
@@ -97,8 +97,10 @@ int main(int argc, char ** argv)
|
|||||||
fail("The child returned %d", WEXITSTATUS(status));
|
fail("The child returned %d", WEXITSTATUS(status));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
test_msg("The child has been killed by %d\n", WTERMSIG(status));
|
test_msg("The child has been killed by %d\n", WTERMSIG(status));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
pass();
|
pass();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user