return lxc_cgroup_get_hierarchy_path_data(subsystem, d);
}
-static const char *cgfs_canonical_path(void *hdata)
-{
- struct cgfs_data *d = hdata;
- struct cgroup_process_info *info_ptr;
- char *path = NULL;
-
- if (!d)
- return NULL;
-
- for (info_ptr = d->info; info_ptr; info_ptr = info_ptr->next) {
- if (!path)
- path = info_ptr->cgroup_path;
- else if (strcmp(path, info_ptr->cgroup_path) != 0) {
- ERROR("not all paths match %s, %s has path %s", path,
- info_ptr->hierarchy->subsystems[0], info_ptr->cgroup_path);
- return NULL;
- }
- }
-
- return path;
-}
-
static bool cgfs_escape(void *hdata)
{
struct cgroup_meta_data *md;
.enter = cgfs_enter,
.create_legacy = cgfs_create_legacy,
.get_cgroup = cgfs_get_cgroup,
- .canonical_path = cgfs_canonical_path,
.escape = cgfs_escape,
.num_hierarchies = cgfs_num_hierarchies,
.get_hierarchies = cgfs_get_hierarchies,
return false;
}
-static const char *cgfsng_canonical_path(void *hdata)
-{
- struct cgfsng_handler_data *d = hdata;
-
- return d->container_cgroup;
-}
-
static bool cgfsng_enter(void *hdata, pid_t pid)
{
char pidstr[25];
.destroy = cgfsng_destroy,
.create = cgfsng_create,
.enter = cgfsng_enter,
- .canonical_path = cgfsng_canonical_path,
.escape = cgfsng_escape,
.num_hierarchies = cgfsng_num_hierarchies,
.get_hierarchies = cgfsng_get_hierarchies,
return d->cgroup_path;
}
-static const char *cgm_canonical_path(void *hdata)
-{
- struct cgm_data *d = hdata;
-
- if (!d || !d->cgroup_path)
- return NULL;
- return d->cgroup_path;
-}
-
#if HAVE_CGMANAGER_GET_PID_CGROUP_ABS_SYNC
static inline bool abs_cgroup_supported(void) {
return api_version >= CGM_SUPPORTS_GET_ABS;
.enter = cgm_enter,
.create_legacy = NULL,
.get_cgroup = cgm_get_cgroup,
- .canonical_path = cgm_canonical_path,
.escape = cgm_escape,
.num_hierarchies = cgm_num_hierarchies,
.get_hierarchies = cgm_get_hierarchies,
return false;
}
-const char *cgroup_canonical_path(struct lxc_handler *handler)
-{
- if (geteuid()) {
- WARN("cgroup_canonical_path only makes sense for privileged containers.\n");
- return NULL;
- }
-
- if (ops)
- return ops->canonical_path(handler->cgroup_data);
-
- return NULL;
-}
-
int cgroup_num_hierarchies(void)
{
if (!ops)
bool (*enter)(void *hdata, pid_t pid);
bool (*create_legacy)(void *hdata, pid_t pid);
const char *(*get_cgroup)(void *hdata, const char *subsystem);
- const char *(*canonical_path)(void *hdata);
bool (*escape)();
int (*num_hierarchies)();
bool (*get_hierarchies)(int n, char ***out);
extern bool cgroup_escape();
extern int cgroup_num_hierarchies();
extern bool cgroup_get_hierarchies(int i, char ***out);
-
-/*
- * Currently, this call only makes sense for privileged containers.
- */
-extern const char *cgroup_canonical_path(struct lxc_handler *handler);
extern bool cgroup_unfreeze(struct lxc_handler *handler);
extern void cgroup_disconnect(void);
extern cgroup_driver_t cgroup_driver(void);