mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-28 04:48:16 +00:00
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
48 lines
997 B
C
48 lines
997 B
C
#include <stdio.h>
|
|
#include <errno.h>
|
|
#include <sys/wait.h>
|
|
|
|
void what_err_ret_mean(int ret)
|
|
{
|
|
/* NOTE: errno is set by libcriu */
|
|
switch (ret) {
|
|
case -EBADE:
|
|
perror("RPC has returned fail");
|
|
break;
|
|
case -ECONNREFUSED:
|
|
perror("Unable to connect to CRIU");
|
|
break;
|
|
case -ECOMM:
|
|
perror("Unable to send/recv msg to/from CRIU");
|
|
break;
|
|
case -EINVAL:
|
|
perror("CRIU doesn't support this type of request."
|
|
"You should probably update CRIU");
|
|
break;
|
|
case -EBADMSG:
|
|
perror("Unexpected response from CRIU."
|
|
"You should probably update CRIU");
|
|
break;
|
|
default:
|
|
perror("Unknown error type code."
|
|
"You should probably update CRIU");
|
|
}
|
|
}
|
|
|
|
int chk_exit(int status, int want)
|
|
{
|
|
if (WIFEXITED(status)) {
|
|
if (WEXITSTATUS(status) == want)
|
|
return 0;
|
|
|
|
printf(" `- FAIL (exit %d)\n", WEXITSTATUS(status));
|
|
} else if (WIFSIGNALED(status))
|
|
printf(" `- FAIL (die %d)\n", WTERMSIG(status));
|
|
else
|
|
printf(" `- FAIL (%#x)\n", status);
|
|
|
|
return 1;
|
|
}
|
|
|
|
|