[PATCH 02/12][user-cr] restart: Add args->send_sigint

Oren Laadan orenl at cs.columbia.edu
Sun Mar 14 20:52:24 PDT 2010


Nack - the library should not handle signals for callers.

Instead, there should be an interface through which the caller
can ask the library to destroy the tree that it just created.
Thus it will be the caller who catches the signal and acts on
it.

Oren.

Sukadev Bhattiprolu wrote:
> From: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
> Date: Thu, 4 Mar 2010 17:37:39 -0800
> Subject: [PATCH 02/12][user-cr] restart: Add args->send_sigint
> 
> restart command supports a command line option, --send-sigint to let
> user specify whether SIGINT signal should be processed/ignored during
> restart. Make this a field in 'struct app_restart_args' so that other
> callers of app_restart() in the future can also control the SIGINT
> behavior.
> 
> Signed-off-by: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
> ---
>  restart.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/restart.c b/restart.c
> index 0c74bb6..314390c 100644
> --- a/restart.c
> +++ b/restart.c
> @@ -376,6 +376,7 @@ struct app_restart_args {
>  	int pids;
>  	int pidns;
>  	int inspect;
> +	int send_sigint;
>  	char *root;
>  	int wait;
>  	int mntns;
> @@ -497,6 +498,7 @@ static void parse_args(struct app_restart_args *args, int argc, char *argv[])
>  	args->klogfd = -1;
>  	args->warn = CKPT_COND_WARN;
>  	args->fail = CKPT_COND_FAIL;
> +	args->send_sigint = -1;
>  	no_pidns = 0;
>  
>  	klogfile = NULL;
> @@ -554,7 +556,7 @@ static void parse_args(struct app_restart_args *args, int argc, char *argv[])
>  				ckpt_err("restart: invalid signal\n");
>  				exit(1);
>  			}
> -			global_send_sigint = sig;
> +			args->send_sigint = sig;
>  			break;
>  		case 3:  /* --pids */
>  			args->pids = 1;
> @@ -815,6 +817,8 @@ int app_restart(struct app_restart_args *args)
>  	memset(&ctx, 0, sizeof(ctx));
>  	ctx.args = args;
>  
> +	global_send_sigint = args->send_sigint;
> +
>  	/* input file descriptor (default: stdin) */
>  	if (args->infd >= 0) {
>  		if (dup2(args->infd, STDIN_FILENO) < 0) {


More information about the Containers mailing list