[CRIU] [PATCH] restorer: Report child's death reason correctly

Andrei Vagin avagin at virtuozzo.com
Fri Jun 16 21:19:58 MSK 2017


Applied, thanks!

On Mon, Jun 05, 2017 at 10:23:58PM +0300, Dmitry Safonov wrote:
> E.g, if child was killed by SIGSEGV, this message
> previously was "exited, status=11", as si_code == CLD_DUMPED == 3
> in this case will result in (si_code & CLD_KILLED) == (si_code & 1).
> Which is misleading as you may try to look for exit() calls
> with 11 arg.
> Correct if to compare si_code with CLD_*.
> 
> Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
> ---
>  criu/pie/restorer.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
> index f6c30d180da6..8655934dcb01 100644
> --- a/criu/pie/restorer.c
> +++ b/criu/pie/restorer.c
> @@ -111,12 +111,18 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
>  		if (siginfo->si_pid == zombies[i])
>  			return;
>  
> -	if (siginfo->si_code & CLD_EXITED)
> -		r = " exited, status=";
> -	else if (siginfo->si_code & CLD_KILLED)
> -		r = " killed by signal ";
> +	if (siginfo->si_code == CLD_EXITED)
> +		r = "exited, status=";
> +	else if (siginfo->si_code == CLD_KILLED)
> +		r = "killed by signal";
> +	else if (siginfo->si_code == CLD_DUMPED)
> +		r = "terminated abnormally with";
> +	else if (siginfo->si_code == CLD_TRAPPED)
> +		r = "trapped with";
> +	else if (siginfo->si_code == CLD_STOPPED)
> +		r = "stopped with";
>  	else
> -		r = "disappeared with ";
> +		r = "disappeared with";
>  
>  	pr_info("Task %d %s %d\n", siginfo->si_pid, r, siginfo->si_status);
>  
> -- 
> 2.12.2
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list