From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oren Laadan Subject: Re: [PATCH 02/12][user-cr] restart: Add args->send_sigint Date: Sun, 14 Mar 2010 23:52:24 -0400 Message-ID: <4B9DAEF8.50700@cs.columbia.edu> References: <20100305223439.GA15300@us.ibm.com> <20100305223658.GB15939@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20100305223658.GB15939-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Sukadev Bhattiprolu Cc: Containers List-Id: containers.vger.kernel.org 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 > 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 > --- > 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) {