Commit def23744 authored by Kravchenko Dmitrii's avatar Kravchenko Dmitrii Committed by Pavel Emelyanov

restorer: implement restore of ps tree in stopped state

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: 's avatarKravchenko Dmitrii <equivalence1@gmail.com>
Signed-off-by: 's avatarEugene Batalov <eabatalov89@gmail.com>
Acked-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent c0314172
......@@ -1541,7 +1541,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);
}
}
......
......@@ -653,6 +653,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(opts.work_dir)) {
pr_perror("Can't change directory to %s", opts.work_dir);
return 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment