[CRIU] Re: [PATCH 2/2] futex: Add FUTEX_WAIT_ABORT constant

Andrew Vagin avagin at parallels.com
Mon Apr 2 04:25:19 EDT 2012


On Mon, Apr 02, 2012 at 10:20:48AM +0400, Cyrill Gorcunov wrote:
> Easier to read.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  cr-restore.c   |    2 +-
>  include/lock.h |    2 ++
>  restorer.c     |    2 +-
>  3 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/cr-restore.c b/cr-restore.c
> index 68dbab7..20a899d 100644
> --- a/cr-restore.c
> +++ b/cr-restore.c
> @@ -1132,7 +1132,7 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
>  		pr_err("%d killed by signal %d\n",
>  			siginfo->si_pid, siginfo->si_status);
>  
> -	futex_set_and_wake(&task_entries->nr_in_progress, -1);
> +	futex_set_and_wake(&task_entries->nr_in_progress, FUTEX_WAIT_ABORT);
>  }
>  
>  static int restore_task_with_children(void *_arg)
> diff --git a/include/lock.h b/include/lock.h
> index 9d06da2..ee05c40 100644
> --- a/include/lock.h
> +++ b/include/lock.h
> @@ -11,6 +11,8 @@
>  #include "syscall.h"
>  #include "util.h"
>  
> +#define FUTEX_WAIT_ABORT	(-1)

I don't want to have this contant, because it's not a common logic.
Yes, we have one place where futex is used by this way.

But if we want to have this contant, we should detect it in a place,
where we wait this futex.

> +
>  typedef struct {
>  	s32	raw;
>  } futex_t;
> diff --git a/restorer.c b/restorer.c
> index a69df44..582b9ee 100644
> --- a/restorer.c
> +++ b/restorer.c
> @@ -47,7 +47,7 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
>  		write_string(" killed by signal ");
>  	write_num_n(siginfo->si_status);
>  
> -	futex_set_and_wake(&task_entries->nr_in_progress, -1);
> +	futex_set_and_wake(&task_entries->nr_in_progress, FUTEX_WAIT_ABORT);
>  	/* sa_restorer may be unmaped, so we can't go back to userspace*/
>  	sys_kill(sys_getpid(), SIGSTOP);
>  	sys_exit(1);
> -- 
> 1.7.7.6
> 


More information about the CRIU mailing list