[CRIU] [PATCH 03/13] parasite: Add [init|fini]_thread helpers

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


On 11/06/2012 08:53 PM, Cyrill Gorcunov wrote:
> 
> These helpers will be needed to save a blocked signals
> mask for dumpee threads.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  include/parasite.h |    6 +++++
>  parasite.c         |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 63 insertions(+), 0 deletions(-)
> 


> +struct parasite_thread_args {
> +	pid_t			tid;
> +};
> +

I see not much sense in passing tid in args. Each thread may
call sys_gettid himself.

> +static int fini_thread(struct parasite_thread_args *args)
> +{
> +	struct tid_state_s *s = find_thread_state(args->tid);

Don't initialize variable during declaration with the result of
any call.

> +	if (!s)
> +		return -ENOENT;
> +
> +	if (s->use_sig_blocked)
> +		return sys_sigprocmask(SIG_SETMASK, &s->sig_blocked,
> +				       NULL, sizeof(k_rtsigset_t));
> +
> +	return 0;
> +}



More information about the CRIU mailing list