}
}
- conf->reboot = 0;
+ conf->reboot = REBOOT_NONE;
/* Unshare the mount namespace if requested */
if (conf->monitor_unshare) {
}
reboot:
- if (conf->reboot == 2) {
+ if (conf->reboot == REBOOT_INIT) {
/* initialize handler */
handler = lxc_init_handler(c->name, conf, c->config_path, c->daemonize);
if (!handler) {
ret = lxc_start(c->name, argv, handler, c->config_path,
c->daemonize, &c->error_num);
- if (conf->reboot == 1) {
+ if (conf->reboot == REBOOT_REQ) {
INFO("Container requested reboot");
- conf->reboot = 2;
+ conf->reboot = REBOOT_INIT;
goto reboot;
}
lxc_put_nsfds(handler);
- if (handler->conf && handler->conf->reboot == 0)
+ if (handler->conf && handler->conf->reboot == REBOOT_NONE)
if (handler->conf->maincmd_fd >= 0)
close(handler->conf->maincmd_fd);
handler->sigfd = -EBADF;
handler->init_died = false;
handler->state_socket_pair[0] = handler->state_socket_pair[1] = -1;
- if (handler->conf->reboot == 0)
+ if (handler->conf->reboot == REBOOT_NONE)
lxc_list_init(&handler->conf->state_clients);
for (i = 0; i < LXC_NS_MAX; i++)
handler->name = name;
- if (daemonize && !handler->conf->reboot) {
+ if (daemonize && handler->conf->reboot == REBOOT_NONE) {
/* Create socketpair() to synchronize on daemonized startup.
* When the container reboots we don't need to synchronize
* again currently so don't open another socketpair().
handler->state_socket_pair[1]);
}
- if (handler->conf->reboot == 0) {
+ if (handler->conf->reboot == REBOOT_NONE) {
handler->conf->maincmd_fd = lxc_cmd_init(name, lxcpath, "command");
if (handler->conf->maincmd_fd < 0) {
ERROR("Failed to set up command socket");
}
namespaces[namespace_count] = NULL;
- if (handler->conf->reboot) {
+ if (handler->conf->reboot > REBOOT_NONE) {
ret = setenv("LXC_TARGET", "reboot", 1);
if (ret < 0)
SYSERROR("Failed to set environment variable: "
"LXC_TARGET=reboot");
}
- if (!handler->conf->reboot) {
+ if (handler->conf->reboot == REBOOT_NONE) {
ret = setenv("LXC_TARGET", "stop", 1);
if (ret < 0)
SYSERROR("Failed to set environment variable: "
cgroup_ops->destroy(cgroup_ops, handler);
cgroup_exit(cgroup_ops);
- if (handler->conf->reboot == 0) {
+ if (handler->conf->reboot == REBOOT_NONE) {
/* For all new state clients simply close the command socket.
* This will inform all state clients that the container is
* STOPPED and also prevents a race between a open()/close() on
ret = run_lxc_hooks(name, "post-stop", handler->conf, NULL);
if (ret < 0) {
ERROR("Failed to run lxc.hook.post-stop for container \"%s\"", name);
- if (handler->conf->reboot) {
+ if (handler->conf->reboot > REBOOT_NONE) {
WARN("Container will be stopped instead of rebooted");
- handler->conf->reboot = 0;
+ handler->conf->reboot = REBOOT_NONE;
ret = setenv("LXC_TARGET", "stop", 1);
if (ret < 0)
struct lxc_state_client *client = cur->elem;
/* Keep state clients that want to be notified about reboots. */
- if ((handler->conf->reboot > 0) && (client->states[RUNNING] == 2))
+ if ((handler->conf->reboot > REBOOT_NONE) &&
+ (client->states[RUNNING] == 2))
continue;
/* close state client socket */
free(cur);
}
- if (handler->conf->ephemeral == 1 && handler->conf->reboot != 1)
+ if (handler->conf->ephemeral == 1 && handler->conf->reboot != REBOOT_REQ)
lxc_destroy_container_on_signal(handler, name);
lxc_free_handler(handler);
close(handler->data_sock[1]);
handler->data_sock[1] = -1;
- handler->conf->reboot = 0;
+ handler->conf->reboot = REBOOT_NONE;
ret = lxc_poll(name, handler);
if (ret) {
break;
case SIGHUP: /* reboot */
DEBUG("Container \"%s\" is rebooting", name);
- handler->conf->reboot = 1;
+ handler->conf->reboot = REBOOT_REQ;
break;
case SIGSYS: /* seccomp */
DEBUG("Container \"%s\" violated its seccomp policy", name);