Last active
November 14, 2020 02:41
-
-
Save mbien/176f699a161ce15e15f1cfd89147e1e6 to your computer and use it in GitHub Desktop.
minimal criu dump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <criu.h> | |
#include <fcntl.h> | |
// requires setcap cap_checkpoint_restore,cap_sys_ptrace+eip /path/to/exec | |
int main(int argc, char** argv) { | |
printf("hello criu\n"); | |
criu_init_opts(); | |
criu_set_log_file("dump.log"); | |
criu_set_log_level(4); | |
criu_set_shell_job(true); | |
criu_set_leave_running(true); | |
int fd = open("/tmp/cdump", O_DIRECTORY); | |
criu_set_images_dir_fd(fd); | |
printf("pre-dump\n"); | |
int ret = criu_dump(); | |
printf("ret: %i\n", ret); | |
printf("post-dump\n"); | |
return (EXIT_SUCCESS); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment