Line 24: |
Line 24: |
| Use <code>criu_set_*</code> functions to setup dump/restore options. | | Use <code>criu_set_*</code> functions to setup dump/restore options. |
| | | |
− | <pre> | + | <source lang="c"> |
| void criu_set_pid(int pid); | | void criu_set_pid(int pid); |
| void criu_set_images_dir_fd(int fd); /* must be set for dump/restore */ | | void criu_set_images_dir_fd(int fd); /* must be set for dump/restore */ |
Line 35: |
Line 35: |
| void criu_set_log_level(int log_level); | | void criu_set_log_level(int log_level); |
| void criu_set_log_file(char *log_file); | | void criu_set_log_file(char *log_file); |
− | </pre> | + | </source> |
| | | |
| If no pid is set on dump, CRIU will dump the calling process itself. | | If no pid is set on dump, CRIU will dump the calling process itself. |
Line 42: |
Line 42: |
| {{Note|<code>images_dir_fd</code> is '''required''' at dump/restore, all other options might be left unset. | | {{Note|<code>images_dir_fd</code> is '''required''' at dump/restore, all other options might be left unset. |
| The client must open directory for/with images by itself and set <code>images_dir_fd</code> to the opened directory fd. | | The client must open directory for/with images by itself and set <code>images_dir_fd</code> to the opened directory fd. |
− | CRIU will open /proc/<client's_pid>/fd/<images_dir_fd>, so it will work even if the client is in another namespace.}} | + | CRIU will open <code>/proc/''client_pid''/fd/''images_dir_fd''</code>, so it will work even if the client is in another namespace.}} |
| | | |
| The logic of setting request is the same as when setting options in console. Here is an example: | | The logic of setting request is the same as when setting options in console. Here is an example: |
| | | |
− | #criu restore -D /path/to/imgs_dir -v4 -o restore.log | + | # criu restore -D /path/to/imgs_dir -v4 -o restore.log |
| | | |
| is equal to: | | is equal to: |
− | <pre> | + | <source lang="c"> |
| criu_init_opts(); | | criu_init_opts(); |
| criu_set_service_address("/path/to/criu/service/socket"); | | criu_set_service_address("/path/to/criu/service/socket"); |
Line 60: |
Line 60: |
| | | |
| criu_restore(); | | criu_restore(); |
− | </pre> | + | </source> |
| | | |
| == Operations == | | == Operations == |