mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-05 21:31:36 +00:00
[LibOS] shim_checkpoint.c: retry DkStreamRead/DkStreamWrite
On EINTR/EAGAIN (and for EWOULDBLOCK for portability) of DkStreaRead/DkStreamWrite, retry the PAL call instead of error out. Especially when it runs under debugger, EINTR often happens. This patch makes debug easier. Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
This commit is contained in:
committed by
Don Porter
parent
123e810c3e
commit
fb48d0e388
@@ -475,8 +475,12 @@ static int send_checkpoint_on_stream (PAL_HANDLE stream,
|
||||
size_t ret = DkStreamWrite(stream, 0, total_bytes - bytes,
|
||||
(void *) store->base + bytes, NULL);
|
||||
|
||||
if (!ret)
|
||||
if (!ret) {
|
||||
if (PAL_ERRNO == EINTR || PAL_ERRNO == EAGAIN ||
|
||||
PAL_ERRNO == EWOULDBLOCK)
|
||||
continue;
|
||||
return -PAL_ERRNO;
|
||||
}
|
||||
|
||||
bytes += ret;
|
||||
} while (bytes < total_bytes);
|
||||
@@ -490,8 +494,12 @@ static int send_checkpoint_on_stream (PAL_HANDLE stream,
|
||||
do {
|
||||
size_t ret = DkStreamWrite(stream, 0, mem_size - bytes,
|
||||
mem_addr + bytes, NULL);
|
||||
if (!ret)
|
||||
if (!ret) {
|
||||
if (PAL_ERRNO == EINTR || PAL_ERRNO == EAGAIN ||
|
||||
PAL_ERRNO == EWOULDBLOCK)
|
||||
continue;
|
||||
return -PAL_ERRNO;
|
||||
}
|
||||
|
||||
bytes += ret;
|
||||
} while (bytes < mem_entries[i]->size);
|
||||
@@ -1215,8 +1223,12 @@ int do_migration (struct newproc_cp_header * hdr, void ** cpptr)
|
||||
size - total_bytes,
|
||||
(void *) base + total_bytes, NULL, 0);
|
||||
|
||||
if (!bytes)
|
||||
if (!bytes) {
|
||||
if (PAL_ERRNO == EINTR || PAL_ERRNO == EAGAIN ||
|
||||
PAL_ERRNO == EWOULDBLOCK)
|
||||
continue;
|
||||
return -PAL_ERRNO;
|
||||
}
|
||||
|
||||
total_bytes += bytes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user