Quoting Bogdan Purcareata (bogdan.purcare...@freescale.com): > Following the model of f0f1d8c076ae93d8ecf735c2eeae471e27ca6abd, add a reboot > signal for special init processes that work on something other than SIGINT. > > Signed-off-by: Bogdan Purcareata <bogdan.purcare...@freescale.com>
Acked-by: Serge E. Hallyn <serge.hal...@ubuntu.com> > --- > src/lxc/conf.h | 1 + > src/lxc/confile.c | 14 ++++++++++++++ > src/lxc/lxccontainer.c | 5 ++++- > 3 files changed, 19 insertions(+), 1 deletion(-) > > diff --git a/src/lxc/conf.h b/src/lxc/conf.h > index afa5517..334ea70 100644 > --- a/src/lxc/conf.h > +++ b/src/lxc/conf.h > @@ -323,6 +323,7 @@ struct lxc_conf { > int maincmd_fd; > int autodev; // if 1, mount and fill a /dev at start > int haltsignal; // signal used to halt container > + int rebootsignal; // signal used to reboot container > int stopsignal; // signal used to hard stop container > int kmsg; // if 1, create /dev/kmsg symlink > char *rcfile; // Copy of the top level rcfile we read > diff --git a/src/lxc/confile.c b/src/lxc/confile.c > index 8544ac9..42d42e5 100644 > --- a/src/lxc/confile.c > +++ b/src/lxc/confile.c > @@ -98,6 +98,7 @@ static int config_includefile(const char *, const char *, > struct lxc_conf *); > static int config_network_nic(const char *, const char *, struct lxc_conf *); > static int config_autodev(const char *, const char *, struct lxc_conf *); > static int config_haltsignal(const char *, const char *, struct lxc_conf *); > +static int config_rebootsignal(const char *, const char *, struct lxc_conf > *); > static int config_stopsignal(const char *, const char *, struct lxc_conf *); > static int config_start(const char *, const char *, struct lxc_conf *); > static int config_group(const char *, const char *, struct lxc_conf *); > @@ -158,6 +159,7 @@ static struct lxc_config_t config[] = { > { "lxc.include", config_includefile }, > { "lxc.autodev", config_autodev }, > { "lxc.haltsignal", config_haltsignal }, > + { "lxc.rebootsignal", config_rebootsignal }, > { "lxc.stopsignal", config_stopsignal }, > { "lxc.start.auto", config_start }, > { "lxc.start.delay", config_start }, > @@ -1268,6 +1270,18 @@ static int config_haltsignal(const char *key, const > char *value, > return 0; > } > > +static int config_rebootsignal(const char *key, const char *value, > + struct lxc_conf *lxc_conf) > +{ > + int sig_n = sig_parse(value); > + > + if (sig_n < 0) > + return -1; > + lxc_conf->rebootsignal = sig_n; > + > + return 0; > +} > + > static int config_stopsignal(const char *key, const char *value, > struct lxc_conf *lxc_conf) > { > diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c > index e02ee93..4422f4a 100644 > --- a/src/lxc/lxccontainer.c > +++ b/src/lxc/lxccontainer.c > @@ -1363,6 +1363,7 @@ free_tpath: > static bool lxcapi_reboot(struct lxc_container *c) > { > pid_t pid; > + int rebootsignal = SIGINT; > > if (!c) > return false; > @@ -1371,7 +1372,9 @@ static bool lxcapi_reboot(struct lxc_container *c) > pid = c->init_pid(c); > if (pid <= 0) > return false; > - if (kill(pid, SIGINT) < 0) > + if (c->lxc_conf && c->lxc_conf->rebootsignal) > + rebootsignal = c->lxc_conf->rebootsignal; > + if (kill(pid, rebootsignal) < 0) > return false; > return true; > > -- > 2.1.4 > > _______________________________________________ > lxc-devel mailing list > lxc-devel@lists.linuxcontainers.org > http://lists.linuxcontainers.org/listinfo/lxc-devel _______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel