[CRIU] [PATCHv1 1/2] restorer: implement restore of ps tree in stopped state
Andrew Vagin
avagin at virtuozzo.com
Mon May 16 13:49:27 PDT 2016
Acked-by: Andrew Vagin <avagin at virtuozzo.com>
Thanks!
On Mon, May 02, 2016 at 06:46:05PM +0300, Eugene Batalov wrote:
> From: Kravchenko Dmitrii <equivalence1 at gmail.com>
>
> This patch adds implementation of --leave-stopped option
> to CRIU restore cmd. If --leave-stopped is passed then
> each process in ps tree gets SIGSTOP before detaching
> from it.
>
> Signed-off-by: Kravchenko Dmitrii <equivalence1 at gmail.com>
> Signed-off-by: Eugene Batalov <eabatalov89 at gmail.com>
> ---
> criu/cr-restore.c | 3 ++-
> criu/crtools.c | 10 ++++++++++
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/criu/cr-restore.c b/criu/cr-restore.c
> index ac0943b..d212abe 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -1924,7 +1924,8 @@ static void finalize_restore(void)
>
> xfree(ctl);
>
> - if (item->pid.state == TASK_STOPPED)
> + if ((item->pid.state == TASK_STOPPED) ||
> + (opts.final_state == TASK_STOPPED))
> kill(item->pid.real, SIGSTOP);
> }
> }
> diff --git a/criu/crtools.c b/criu/crtools.c
> index 7a0f977..be33f4c 100644
> --- a/criu/crtools.c
> +++ b/criu/crtools.c
> @@ -688,6 +688,16 @@ int main(int argc, char *argv[], char *envp[])
> return 1;
> }
>
> + /*
> + * When a process group becomes an orphan,
> + * its processes are sent a SIGHUP signal
> + */
> + if (!strcmp(argv[optind], "restore") &&
> + opts.restore_detach &&
> + opts.final_state == TASK_STOPPED &&
> + opts.shell_job)
> + pr_warn("Stopped and detached shell job will get SIGHUP from OS.");
> +
> if (chdir(work_dir)) {
> pr_perror("Can't change directory to %s", work_dir);
> return 1;
> --
> 1.9.1
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list