2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00
Files
criu/test/zdtm/static/dumpable01.c
Adrian Reber 93dd984ca0 Run 'make indent' on all C files
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00

49 lines
1013 B
C

#include <sys/prctl.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include "zdtmtst.h"
const char *test_doc = "Check dumpable flag handling (dumpable case)";
const char *test_author = "Filipe Brandenburger <filbranden@google.com>";
int main(int argc, char **argv)
{
int save_dumpable;
int dumpable;
test_init(argc, argv);
save_dumpable = prctl(PR_GET_DUMPABLE);
if (save_dumpable < 0) {
pr_perror("error getting prctl(PR_GET_DUMPABLE) before dump");
return 1;
}
#ifdef DEBUG
test_msg("DEBUG: before dump: dumpable=%d\n", save_dumpable);
#endif
/* Wait for criu dump and restore. */
test_daemon();
test_waitsig();
dumpable = prctl(PR_GET_DUMPABLE);
if (dumpable < 0) {
pr_perror("error getting prctl(PR_GET_DUMPABLE) after restore");
return 1;
}
#ifdef DEBUG
test_msg("DEBUG: after dump: dumpable=%d\n", dumpable);
#endif
if (dumpable != save_dumpable) {
errno = 0;
fail("dumpable flag was not preserved over migration");
return 1;
}
pass();
return 0;
}