static void cgm_dbus_disconnect(void)
{
- nih_free(cgroup_manager);
+ if (cgroup_manager)
+ nih_free(cgroup_manager);
cgroup_manager = NULL;
}
.attach = cgm_attach,
.mount_cgroup = cgm_mount_cgroup,
.nrtasks = cgm_get_nrtasks,
+ .disconnect = cgm_dbus_disconnect,
};
#endif
return ops->get(filename, value, len, name, lxcpath);
return -1;
}
+
+void restart_cgroups(void)
+{
+ if (ops && ops->disconnect)
+ ops->disconnect();
+ ops = NULL;
+ cgroup_ops_init();
+}
bool (*attach)(const char *name, const char *lxcpath, pid_t pid);
bool (*mount_cgroup)(void *hdata, const char *root, int type);
int (*nrtasks)(void *hdata);
+ void (*disconnect)(void);
};
extern bool cgroup_attach(const char *name, const char *lxcpath, pid_t pid);
extern int cgroup_nrtasks(struct lxc_handler *handler);
extern const char *cgroup_get_cgroup(struct lxc_handler *handler, const char *subsystem);
extern bool cgroup_unfreeze(struct lxc_handler *handler);
+extern void restart_cgroups(void);
#endif
open("/dev/null", O_RDWR);
open("/dev/null", O_RDWR);
setsid();
+ restart_cgroups();
} else {
if (!am_single_threaded()) {
ERROR("Cannot start non-daemonized container when threaded");