[CRIU] [PATCH 3/7] parasite: Add init_thread() helper

Pavel Emelyanov xemul at parallels.com
Tue Nov 6 04:07:28 EST 2012


On 11/05/2012 12:06 AM, Cyrill Gorcunov wrote:
> 
> The patch adds init_thread() helper function which is supposed to
> be called from seized threads context to save thread specific data
> in parasite memory slab.
> 
> At moment only blocked signals are saved but it might be extended
> in future.
> 
> Note it's done in a manner of main init() parasite function -- once
> thread is seized we save old blocked signals mask and mask all signals
> until fini() called.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  include/parasite.h |    5 +++++
>  parasite.c         |   25 +++++++++++++++++++++++++
>  2 files changed, 30 insertions(+), 0 deletions(-)
> 


> @@ -27,10 +27,13 @@ static struct tid_state_s {
>  } *tid_state;
>  
>  static unsigned int nr_tid_state;
> +static unsigned int next_tid_state;
> +
>  #define TID_STATE_SIZE(n)	\
>  	(ALIGN(sizeof(struct tid_state_s) * n, PAGE_SIZE))
>  
>  #define thread_leader	(&tid_state[0])
> +#define thread_next	(&tid_state[next_tid_state])

These are obfuscating names. Don't do that.

>  
>  #define MAX_HEAP_SIZE	(10 << 20)	/* Hope 10MB will be enough...  */
>  



More information about the CRIU mailing list