From: Cedric Le Goater Date: Tue, 1 Jun 2010 09:44:44 +0000 (+0200) Subject: add restart framework X-Git-Tag: lxc-0.7.0~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=196f1d54cef61534e6f98a47956cc87bffb6152e;p=thirdparty%2Flxc.git add restart framework Signed-off-by: Cedric Le Goater Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/restart.c b/src/lxc/restart.c index 2fbdabf30..c947b8133 100644 --- a/src/lxc/restart.c +++ b/src/lxc/restart.c @@ -20,13 +20,58 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include + +#include "../config.h" +#include +#undef _GNU_SOURCE +#include +#include +#include +#include + #include +#include /* for struct lxc_handler */ +#include +#include lxc_log_define(lxc_restart, lxc); -int lxc_restart(const char *name, int sfd, struct lxc_conf *conf, int flags) +struct restart_args { + int sfd; + int flags; +}; + +static int restart(struct lxc_handler *handler, void* data) { + struct restart_args *arg __attribute__ ((unused)) = data; + ERROR("'restart' function not implemented"); return -1; } + +static int post_restart(struct lxc_handler *handler, void* data) +{ + struct restart_args *arg __attribute__ ((unused)) = data; + + NOTICE("'%s' container restarting with pid '%d'", handler->name, + handler->pid); + return 0; +} + +static struct lxc_operations restart_ops = { + .start = restart, + .post_start = post_restart +}; + +int lxc_restart(const char *name, int sfd, struct lxc_conf *conf, int flags) +{ + struct restart_args restart_arg = { + .sfd = sfd, + .flags = flags + }; + + if (lxc_check_inherited(sfd)) + return -1; + + return __lxc_start(name, conf, &restart_ops, &restart_arg); +}