[CRIU] [PATCH 05/13] parasite-syscall: Add parasite_[init|fini]_threads_seized helpers

Pavel Emelyanov xemul at parallels.com
Wed Nov 7 05:07:33 EST 2012


On 11/06/2012 08:53 PM, Cyrill Gorcunov wrote:
> 
> We will use them from crtools code to save and restore blocked
> signals mask of threads.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  include/parasite-syscall.h |    4 ++++
>  parasite-syscall.c         |   44 ++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 48 insertions(+), 0 deletions(-)
> 


> +int parasite_fini_threads_seized(struct parasite_ctl *ctl, struct pstree_item *item)
> +{
> +	struct parasite_thread_args *args = parasite_args(ctl, *args);
> +	int ret = 0, i;
> +
> +	for (i = 0; i < item->nr_threads; i++) {
> +		if (item->pid.real == item->threads[i].real)
> +			continue;
> +
> +		args->tid = item->threads[i].real;
> +		ret = parasite_execute_by_pid(PARASITE_CMD_FINI_THREAD, ctl,
> +					      item->threads[i].real);
> +		if (ret && ret != -ENOENT) {

1. Why -ENOENT check?
2. For the last thread reporting ENOENT this error will be reported up w/o log message

> +			pr_err("Can't fini thread in parasite %d\n",
> +			       item->threads[i].real);
> +			break;
> +		}
> +	}
> +
> +	return ret;
> +}



More information about the CRIU mailing list