[CRIU] [PATCH 39/44] cr-restore.c: introduced the macro CONFIG_DEBUG_RESTORE to stop restoration after a fork.

Pavel Emelyanov xemul at parallels.com
Wed Jan 9 06:46:25 EST 2013


On 01/07/2013 07:05 PM, Alexander Kartashov wrote:
> 
> Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
> ---
>  cr-restore.c |   14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/cr-restore.c b/cr-restore.c
> index b248b00..01fbe4b 100644
> --- a/cr-restore.c
> +++ b/cr-restore.c
> @@ -992,6 +992,13 @@ static int restore_task_with_children(void *_arg)
>  	int ret;
>  	sigset_t blockmask;
>  
> +#ifdef CONFIG_DEBUG_RESTORE

No macro please. Let's better think on the --debug cmdline option.

> +	if (kill(getpid(), SIGSTOP) < 0) {
> +		pr_err("Failed to stop oneself: %d\n", errno);
> +		return -1;
> +	}
> +#endif
> +
>  	close_safe(&ca->fd);
>  
>  	current = ca->item;
> @@ -1114,6 +1121,8 @@ static int restore_switch_stage(int next_stage)
>  static int restore_root_task(struct pstree_item *init, struct cr_options *opts)
>  {
>  	int ret;
> +
> +#ifndef CONFIG_DEBUG_RESTORE
>  	struct sigaction act, old_act;
>  
>  	ret = sigaction(SIGCHLD, NULL, &act);
> @@ -1132,6 +1141,7 @@ static int restore_root_task(struct pstree_item *init, struct cr_options *opts)
>  		pr_perror("sigaction() failed\n");
>  		return -1;
>  	}
> +#endif
>  
>  	/*
>  	 * FIXME -- currently we assume that all the tasks live
> @@ -1177,12 +1187,16 @@ static int restore_root_task(struct pstree_item *init, struct cr_options *opts)
>  
>  	futex_wait_until(&task_entries->nr_in_progress, 0);
>  
> +
> +#ifndef CONFIG_DEBUG_RESTORE
>  	/* Restore SIGCHLD here to skip SIGCHLD from a network sctip */
> +
>  	ret = sigaction(SIGCHLD, &old_act, NULL);
>  	if (ret < 0) {
>  		pr_perror("sigaction() failed\n");
>  		goto out;
>  	}
> +#endif
>  
>  	network_unlock();
>  out:
> 




More information about the CRIU mailing list